Source Code Cross Referenced for SQLSettingsInitializer.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » plugins » syntax » netbeans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » squirrel sql 2.6.5a » net.sourceforge.squirrel_sql.plugins.syntax.netbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.plugins.syntax.netbeans;
002:
003:        import java.awt.Font;
004:        import java.awt.event.InputEvent;
005:        import java.awt.event.KeyEvent;
006:        import java.util.Map;
007:
008:        import javax.swing.KeyStroke;
009:
010:        import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPreferences;
011:        import net.sourceforge.squirrel_sql.plugins.syntax.SyntaxPugin;
012:
013:        import org.netbeans.editor.BaseKit;
014:        import org.netbeans.editor.Coloring;
015:        import org.netbeans.editor.MultiKeyBinding;
016:        import org.netbeans.editor.Settings;
017:        import org.netbeans.editor.SettingsDefaults;
018:        import org.netbeans.editor.SettingsNames;
019:        import org.netbeans.editor.SettingsUtil;
020:        import org.netbeans.editor.TokenContext;
021:        import org.netbeans.editor.ext.ExtKit;
022:        import org.netbeans.editor.ext.ExtSettingsDefaults;
023:        import org.netbeans.editor.ext.ExtSettingsNames;
024:        import org.netbeans.editor.ext.java.JavaLayerTokenContext;
025:        import org.netbeans.editor.ext.java.JavaSettingsDefaults;
026:        import org.netbeans.editor.ext.java.JavaSettingsNames;
027:
028:        public class SQLSettingsInitializer extends
029:                Settings.AbstractInitializer {
030:
031:            /**
032:             * Name assigned to initializer
033:             */
034:            public static final String NAME = "sql-settings-initializer"; // NOI18N
035:
036:            private Class<?> sqlKitClass;
037:            private SyntaxPreferences _syntaxPreferences;
038:
039:            private static int MENU_MASK = java.awt.Toolkit.getDefaultToolkit()
040:                    .getMenuShortcutKeyMask();
041:            private SyntaxPugin _plugin;
042:            private Font _font;
043:
044:            /**
045:             * Construct new java-settings-initializer.
046:             *
047:             * @param sqlKitClass the real kit class for which the settings are created.
048:             * @param syntaxPreferences
049:             * @param plugin
050:             */
051:            public SQLSettingsInitializer(Class<?> sqlKitClass,
052:                    SyntaxPreferences syntaxPreferences, Font font,
053:                    SyntaxPugin plugin) {
054:                super (NAME);
055:                this .sqlKitClass = sqlKitClass;
056:                _syntaxPreferences = syntaxPreferences;
057:                _plugin = plugin;
058:                _font = font;
059:            }
060:
061:            /**
062:             * Update map filled with the settings.
063:             *
064:             * @param kitClass    kit class for which the settings are being updated.
065:             *                    It is always non-null value.
066:             * @param settingsMap map holding [setting-name, setting-value] pairs.
067:             *                    The map can be empty if this is the first initializer
068:             *                    that updates it or if no previous initializers updated it.
069:             */
070:            /* Suppress warnings for issues that are present in this old release of 
071:             * NetBeans editor libraries we are using.
072:             */
073:            @SuppressWarnings("unchecked")
074:            public void updateSettingsMap(Class kitClass, Map map) {
075:                @SuppressWarnings("cast")
076:                Map<String, Object> settingsMap = (Map<String, Object>) map;
077:                // Update java colorings
078:                if (kitClass == BaseKit.class) {
079:
080:                    new SQLSettingsDefaults.SQLTokenColoringInitializer(
081:                            _syntaxPreferences, _font).updateSettingsMap(
082:                            kitClass, settingsMap);
083:                    new SQLSettingsDefaults.SQLLayerTokenColoringInitializer()
084:                            .updateSettingsMap(kitClass, settingsMap);
085:
086:                    SettingsUtil
087:                            .updateListSetting(settingsMap,
088:                                    SettingsNames.KEY_BINDING_LIST,
089:                                    squirrelKeyBindings);
090:
091:                    settingsMap.put(JavaSettingsNames.FIND_HIGHLIGHT_SEARCH,
092:                            Boolean.FALSE);
093:                }
094:
095:                if (kitClass == sqlKitClass) {
096:
097:                    SettingsUtil.updateListSetting(settingsMap,
098:                            SettingsNames.KEY_BINDING_LIST,
099:                            JavaSettingsDefaults.getJavaKeyBindings());
100:
101:                    SettingsUtil.updateListSetting(settingsMap,
102:                            SettingsNames.TOKEN_CONTEXT_LIST,
103:                            new TokenContext[] { SQLTokenContext.context,
104:                                    JavaLayerTokenContext.context });
105:
106:                    // List of the additional colorings
107:                    SettingsUtil
108:                            .updateListSetting(
109:                                    settingsMap,
110:                                    SettingsNames.COLORING_NAME_LIST,
111:                                    new String[] {
112:                                            ExtSettingsNames.HIGHLIGHT_CARET_ROW_COLORING,
113:                                            ExtSettingsNames.HIGHLIGHT_MATCH_BRACE_COLORING, });
114:
115:                    // ExtCaret highlighting options
116:                    settingsMap.put(ExtSettingsNames.HIGHLIGHT_CARET_ROW,
117:                            ExtSettingsDefaults.defaultHighlightCaretRow);
118:                    settingsMap.put(ExtSettingsNames.HIGHLIGHT_MATCH_BRACE,
119:                            ExtSettingsDefaults.defaultHighlightMatchBrace);
120:
121:                    // ExtCaret highlighting colorings
122:                    SettingsUtil
123:                            .setColoring(
124:                                    settingsMap,
125:                                    ExtSettingsNames.HIGHLIGHT_CARET_ROW_COLORING,
126:                                    ExtSettingsDefaults.defaultHighlightCaretRowColoring);
127:                    SettingsUtil
128:                            .setColoring(
129:                                    settingsMap,
130:                                    ExtSettingsNames.HIGHLIGHT_MATCH_BRACE_COLORING,
131:                                    ExtSettingsDefaults.defaultHighlightMatchBraceColoring);
132:
133:                    settingsMap.put(SettingsNames.TEXT_LIMIT_LINE_VISIBLE,
134:                            Boolean.valueOf(_syntaxPreferences
135:                                    .isTextLimitLineVisible()));
136:
137:                    settingsMap.put(SettingsNames.LINE_NUMBER_VISIBLE, Boolean
138:                            .valueOf(true));
139:
140:                    settingsMap.put(SettingsNames.TEXT_LIMIT_WIDTH,
141:                            Integer.valueOf(_syntaxPreferences
142:                                    .getTextLimitLineWidth()));
143:
144:                    settingsMap.put(SettingsNames.ABBREV_MAP,
145:                            SQLSettingsDefaults.getAbbrevMap(_plugin));
146:
147:                    settingsMap.put(SettingsNames.MACRO_MAP,
148:                            JavaSettingsDefaults.getJavaMacroMap());
149:
150:                    settingsMap.put(ExtSettingsNames.CARET_SIMPLE_MATCH_BRACE,
151:                            JavaSettingsDefaults.defaultCaretSimpleMatchBrace);
152:
153:                    settingsMap.put(ExtSettingsNames.HIGHLIGHT_MATCH_BRACE,
154:                            JavaSettingsDefaults.defaultHighlightMatchBrace);
155:
156:                    settingsMap.put(SettingsNames.IDENTIFIER_ACCEPTOR,
157:                            JavaSettingsDefaults.defaultIdentifierAcceptor);
158:
159:                    settingsMap.put(SettingsNames.ABBREV_RESET_ACCEPTOR,
160:                            JavaSettingsDefaults.defaultAbbrevResetAcceptor);
161:
162:                    settingsMap.put(SettingsNames.WORD_MATCH_MATCH_CASE,
163:                            JavaSettingsDefaults.defaultWordMatchMatchCase);
164:
165:                    settingsMap.put(SettingsNames.WORD_MATCH_STATIC_WORDS,
166:                            JavaSettingsDefaults.defaultWordMatchStaticWords);
167:
168:                    // Formatting settings
169:                    settingsMap
170:                            .put(
171:                                    JavaSettingsNames.JAVA_FORMAT_SPACE_BEFORE_PARENTHESIS,
172:                                    JavaSettingsDefaults.defaultJavaFormatSpaceBeforeParenthesis);
173:
174:                    settingsMap
175:                            .put(
176:                                    JavaSettingsNames.JAVA_FORMAT_SPACE_AFTER_COMMA,
177:                                    JavaSettingsDefaults.defaultJavaFormatSpaceAfterComma);
178:
179:                    settingsMap
180:                            .put(
181:                                    JavaSettingsNames.JAVA_FORMAT_NEWLINE_BEFORE_BRACE,
182:                                    JavaSettingsDefaults.defaultJavaFormatNewlineBeforeBrace);
183:
184:                    settingsMap
185:                            .put(
186:                                    JavaSettingsNames.JAVA_FORMAT_LEADING_SPACE_IN_COMMENT,
187:                                    JavaSettingsDefaults.defaultJavaFormatLeadingSpaceInComment);
188:
189:                    settingsMap
190:                            .put(
191:                                    JavaSettingsNames.JAVA_FORMAT_LEADING_STAR_IN_COMMENT,
192:                                    JavaSettingsDefaults.defaultJavaFormatLeadingStarInComment);
193:
194:                    settingsMap.put(
195:                            JavaSettingsNames.INDENT_HOT_CHARS_ACCEPTOR,
196:                            JavaSettingsDefaults.defaultIndentHotCharsAcceptor);
197:
198:                    settingsMap.put(ExtSettingsNames.REINDENT_WITH_TEXT_BEFORE,
199:                            Boolean.FALSE);
200:
201:                    settingsMap
202:                            .put(
203:                                    JavaSettingsNames.PAIR_CHARACTERS_COMPLETION,
204:                                    JavaSettingsDefaults.defaultPairCharactersCompletion);
205:
206:                    settingsMap.put(
207:                            JavaSettingsNames.GOTO_CLASS_CASE_SENSITIVE,
208:                            JavaSettingsDefaults.defaultGotoClassCaseSensitive);
209:
210:                    settingsMap
211:                            .put(
212:                                    JavaSettingsNames.GOTO_CLASS_SHOW_INNER_CLASSES,
213:                                    JavaSettingsDefaults.defaultGotoClassShowInnerClasses);
214:
215:                    settingsMap
216:                            .put(
217:                                    JavaSettingsNames.GOTO_CLASS_SHOW_LIBRARY_CLASSES,
218:                                    JavaSettingsDefaults.defaultGotoClassShowLibraryClasses);
219:
220:                    Coloring col = new Coloring(_font,
221:                            SettingsDefaults.defaultForeColor,
222:                            SettingsDefaults.defaultBackColor);
223:
224:                    SettingsUtil.setColoring(settingsMap,
225:                            SettingsNames.DEFAULT_COLORING, col);
226:
227:                }
228:            }
229:
230:            public static final MultiKeyBinding[] squirrelKeyBindings = new MultiKeyBinding[] {
231:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F,
232:                            MENU_MASK), ExtKit.findAction),
233:                    new MultiKeyBinding(KeyStroke.getKeyStroke(
234:                            KeyEvent.VK_FIND, 0), ExtKit.findAction),
235:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_H,
236:                            MENU_MASK), ExtKit.replaceAction),
237:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_G,
238:                            InputEvent.CTRL_MASK), ExtKit.gotoAction),
239:                    new MultiKeyBinding(KeyStroke.getKeyStroke(
240:                            KeyEvent.VK_ESCAPE, 0), ExtKit.escapeAction),
241:
242:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_U,
243:                            InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
244:                            BaseKit.toUpperCaseAction),
245:
246:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_L,
247:                            InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
248:                            BaseKit.toLowerCaseAction),
249:
250:                    //         new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK),
251:                    //            ExtKit.matchBraceAction),
252:                    //         new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK | InputEvent.SHIFT_MASK),
253:                    //            ExtKit.selectionMatchBraceAction),
254:                    //         new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F10, InputEvent.SHIFT_MASK),
255:                    //            ExtKit.showPopupMenuAction),
256:
257:                    new MultiKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F7,
258:                            InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
259:                            BaseKit.toggleHighlightSearchAction),
260:
261:            //         new MultiKeyBinding(
262:            //            KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK),
263:            //            SQLKit.duplicateLineAction),
264:            };
265:
266:            public static final String ACCELERATOR_STRING_TO_UPPER_CASE = "ctrl shift u";
267:            public static final String ACCELERATOR_STRING_TO_LOWER_CASE = "ctrl shift l";
268:
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.