View Javadoc

1   package com.explosion.datastream.exql;
2   /* =============================================================================
3    *       
4    *     Copyright 2004 Stephen Cowx
5    *
6    *     Licensed under the Apache License, Version 2.0 (the "License");
7    *     you may not use this file except in compliance with the License.
8    *     You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *     Unless required by applicable law or agreed to in writing, software
13   *     distributed under the License is distributed on an "AS IS" BASIS,
14   *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *     See the License for the specific language governing permissions and
16   *     limitations under the License.
17   * 
18   * =============================================================================
19   */
20  
21  import java.awt.Color;
22  import java.awt.Image;
23  import java.util.Hashtable;
24  import java.util.Properties;
25  import java.util.Vector;
26  import java.util.prefs.Preferences;
27  
28  import javax.swing.JButton;
29  import javax.swing.JPanel;
30  
31  import com.explosion.expf.Application;
32  import com.explosion.expf.ExpActionListener;
33  import com.explosion.expf.ExpConstants;
34  import com.explosion.expf.ExpFrame;
35  import com.explosion.expf.ExpModuleManager;
36  import com.explosion.expf.menusandtools.menu.ExpMenu;
37  import com.explosion.expf.menusandtools.menu.ExpMenuBar;
38  import com.explosion.expf.menusandtools.menu.MenuHelper;
39  import com.explosion.expf.menusandtools.menu.segmented.ExpMenuSegment;
40  import com.explosion.expf.menusandtools.tool.ExpToolBar;
41  import com.explosion.expf.menusandtools.tool.ExpToolBarSegment;
42  import com.explosion.expf.preferences.SystemPreferences;
43  import com.explosion.expfmodules.rdbmsconn.RdbmsConnModuleManager;
44  import com.explosion.utilities.preferences.Preference;
45  /***
46   * Author: Stephen Cowx
47   * Date: Dec 9, 2002
48   * Time: 11:48:47 PM
49    */
50  public class EXQLModuleManager implements ExpModuleManager
51  {
52    private Vector preferences = new Vector();
53    private Hashtable preferenceHash = new Hashtable();
54    private static EXQLModuleManager instance = null;
55    private ExpActionListener globalActionListener = null;
56    
57    /* Open connections menusegment */
58    ExpMenuSegment openSegment = null;
59    ExpMenu menuOpen = null; 
60    ExpMenuBar menuBar = null; 
61    ExpMenu menuConnection = null;
62    
63    private Image[] defaultBusyImages;
64    
65    public EXQLModuleManager()
66    {
67    	instance = this;
68    }
69    
70    public void initialiseGui() throws Exception
71    {
72      menuBar = ((ExpFrame) Application.getApplicationFrame()).getExpMenuBar();
73      menuConnection = menuBar.createExpMenu("Database", 'c', EXQLConstants.MENU_CONNECTION, 1, true);
74      menuOpen       = menuBar.createExpMenu("Connect to", 'o', EXQLConstants.MENU_OPEN_CONNECTION, 1, false);
75      MenuHelper helper = menuBar.getMenuHelper();
76  
77      /* Connections menu */
78      ExpMenuSegment connectionsSegment = menuConnection.createNewSegment(ExpMenuSegment.ANY_POSITION);
79      connectionsSegment.addElement(helper.createMenuItem("Connection wizard", 'c', EXQLConstants.MENU_NEW_CONNECTION, null, 1));
80      connectionsSegment.addElement(helper.createMenuItem("Driver wizard", 'd', EXQLConstants.MENU_NEW_DRIVER, null, 1));
81      connectionsSegment.addElement(menuOpen);
82      connectionsSegment.addElement(helper.createMenuItem("Refresh",'r', EXQLConstants.MENU_REFRESH,null, 1));
83      connectionsSegment.addElement(helper.createMenuItem("Run script",'s', EXQLConstants.MENU_RUNSCRIPT,null, 1));
84  	connectionsSegment.addElement(helper.createMenuItem("View SQL",'e', EXQLConstants.MENU_EDIT_SQL,null, 1));
85      connectionsSegment.addElement(helper.createMenuItem("Close connection",'c', EXQLConstants.MENU_CLOSE_CONNECTION,null, 1));
86      connectionsSegment.addElement(helper.createMenuItem("Close all",'a', EXQLConstants.MENU_CLOSEALL_CONNECTIONS,null, 2));
87      
88      ExpMenuSegment configSegment = menuConnection.createNewSegment(ExpMenuSegment.ANY_POSITION);
89      configSegment.addElement(helper.createMenuItem("All connections", 'f', EXQLConstants.MENU_CONNECTIONS, null, 1));
90      configSegment.addElement(helper.createMenuItem("JDBC drivers",'j',EXQLConstants.MENU_DRIVERS,null,1));
91      
92      /* Toolbar buttons */
93      ExpToolBar toolbar = ((ExpFrame) Application.getApplicationFrame()).getExpToolBar();
94      ExpToolBarSegment exqlSegment = toolbar.createNewSegment(ExpToolBarSegment.ANY_POSITION);
95  
96      JButton connectionsButton   = toolbar.createExpToolBarItem(EXQLConstants.EDIT_CONNECTIONS_IMAGE   ,"Configure database connections",EXQLConstants.MENU_CONNECTIONS,1);
97      exqlSegment.addElement(connectionsButton);
98      JButton driversButton   = toolbar.createExpToolBarItem(EXQLConstants.EDIT_DRIVERS_IMAGE   ,"Configure JDBC drivers",EXQLConstants.MENU_DRIVERS,1);
99      exqlSegment.addElement(driversButton);    
100 	exqlSegment.addElement(null);
101 	
102     /* Default enablements */
103     Application.addToGlobalCookie(EXQLConstants.MENU_CONNECTION, 1);
104     Application.addToGlobalCookie(EXQLConstants.MENU_RDBMS_ADD, 1);
105     Application.addToGlobalCookie(EXQLConstants.MENU_NEW_CONNECTION, 1);
106     Application.addToGlobalCookie(EXQLConstants.MENU_NEW_DRIVER, 1);
107     Application.addToGlobalCookie(EXQLConstants.MENU_CONNECTIONS, 1);
108     Application.addToGlobalCookie(EXQLConstants.MENU_DRIVERS, 1);
109     Application.addToGlobalCookie(EXQLConstants.MENU_TEST, 1);
110     
111     globalActionListener = new EXQLListener();
112     
113     rebuildOpenMenu();
114   }
115   
116   public void rebuildOpenMenu() throws Exception
117   {
118     RdbmsConnModuleManager.instance().getConnectionDescriptorManager().sort();
119   	
120     menuOpen.removeAll();
121     Vector connectionIds = RdbmsConnModuleManager.instance().getConnectionDescriptorManager().getIdentifiers();
122     if (connectionIds == null || connectionIds.size() < 1)
123       Application.ensureGlobalCookie(EXQLConstants.MENU_OPEN_CONNECTION, 0);
124     else   
125     {
126       Application.ensureGlobalCookie(EXQLConstants.MENU_OPEN_CONNECTION, 1);
127       
128       for (int i=0;i<connectionIds.size();i++)
129       {
130          String displayName  = (i+1) + "." + (String)connectionIds.elementAt(i); 	
131          menuOpen.add(menuBar.getMenuHelper().createMenuItem(displayName, (char)i, EXQLConstants.MENU_OPEN_CONNECTION, null, 1));
132          Application.addToGlobalCookie(EXQLConstants.MENU_OPEN_CONNECTION, 1);
133       } 
134     }  
135   }
136 
137   public String getVersion()
138   {
139     return "1.0";
140   }
141 
142   public String getName()
143   {
144     return "Sql Database Module";
145   }
146 
147   public String getDescription()
148   {
149     return "A SQL database analysis toolset";
150   }
151 
152   public void applyPreferences()
153   {
154   }
155 	/***
156 	 * This method initilialises the core properties as well as the driver descriptor manager
157 	 * and the COnnection Descriptor Manager.
158 	 * 
159 	 * To override the default use of driver.propeties with another file, make sure the name of the file
160 	 * you want to use ins in the properties passed into this method under the key EXQLConstants.DRIVER_PROPERTIES_FILE_NAME_OVERRIDE
161 	 * and that the file is in the classpath
162 	 * @see com.explosion.expf.ExpModuleManager#initialiseCore(java.util.Properties)
163 	 * @param properties
164 	 */
165   public void initialiseCore(Properties properties)
166   {
167     try
168     {
169       String appPrefix =  (String) SystemPreferences.getPreference(ExpConstants.EXPF_APP_PREFIX).getValue();
170       
171       Preferences prefs = Preferences.userRoot().node(appPrefix+"/exql");
172       	  
173       Preference allowDbUpdates = new Preference(EXQLConstants.RDBMS_OPTION_ALLOW_DB_UPDATES, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(true), prefs);
174       allowDbUpdates.setLongName("Allow updates to db through table based UI");
175       allowDbUpdates.setDescription("Determines whether or not to allow table data to be updated fromthe user interface, this will depend on what database is being accessed and what version of jdbc driver is being used.");
176       preferences.addElement(allowDbUpdates);
177       preferenceHash.put(EXQLConstants.RDBMS_OPTION_ALLOW_DB_UPDATES, allowDbUpdates);
178       
179       Preference persistCommandHistory = new Preference(EXQLConstants.RDBMS_OPTION_REMEMBER_COMMAND_HISTORY, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(true), prefs);
180       persistCommandHistory.setLongName("Persist command history between sessions");
181       persistCommandHistory.setDescription("Determines whether or not to persist command history.");
182       preferences.addElement(persistCommandHistory);
183       preferenceHash.put(EXQLConstants.RDBMS_OPTION_REMEMBER_COMMAND_HISTORY, persistCommandHistory);
184       
185       Preference maxPersistedCommands = new Preference(EXQLConstants.RDBMS_OPTION_MAXCOMMANDSPERSISTED, Preference.PROPERTY_TYPE_INT, new Integer(500), prefs);
186       maxPersistedCommands.setLongName("Max persisted commands.");
187       maxPersistedCommands.setDescription("This indicates the maximum number of rsql commands that will be remembered.");
188       preferences.addElement(maxPersistedCommands);
189       preferenceHash.put(EXQLConstants.RDBMS_OPTION_MAXCOMMANDSPERSISTED, maxPersistedCommands);
190 	  
191 	  Preference maxAutoColumnWidth = new Preference(EXQLConstants.RDBMS_OPTION_MAX_AUTO_COLUMNWIDTH, Preference.PROPERTY_TYPE_INT, new Integer(1000), prefs);
192 	  maxAutoColumnWidth.setLongName("Max auto column width.");
193 	  maxAutoColumnWidth.setDescription("This indicates the maximum width to which columns will automatically be sized to contain the data in them. If data in columns is wider than this, they will be displayed truncated with a '...' at the end.  The columns can be widened by hand after they have been loaded initialy.");
194       preferences.addElement(maxAutoColumnWidth);
195       preferenceHash.put(EXQLConstants.RDBMS_OPTION_MAX_AUTO_COLUMNWIDTH, maxAutoColumnWidth);
196 	  
197       Preference fullTableInfoOnStartup = new Preference(EXQLConstants.RDBMS_OPTION_FULL_TABLE_INFO_ON_STARTUP, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(false), prefs);
198       fullTableInfoOnStartup.setLongName("Prefetch table info");
199       fullTableInfoOnStartup.setDescription("When true, complete table information is collected when a schema or catalog is selected in the browser tree rather than when the table itself is selected in the browser tree.");
200       preferences.addElement(fullTableInfoOnStartup);
201       preferenceHash.put(EXQLConstants.RDBMS_OPTION_FULL_TABLE_INFO_ON_STARTUP, fullTableInfoOnStartup);
202       	  
203       Preference height = new Preference(ExpConstants.HEIGHT, Preference.PROPERTY_TYPE_INT, new Integer(500), prefs);
204       height.setLongName("Last height");
205       height.setDescription("This is the saved window canvasHeight.");
206       height.setEditable(false);
207       preferences.addElement(height);
208       preferenceHash.put(ExpConstants.HEIGHT, height);
209 	  	  
210       Preference width = new Preference(ExpConstants.WIDTH, Preference.PROPERTY_TYPE_INT, new Integer(600), prefs);
211       width.setLongName("Last width");
212       width.setDescription("This is the saved window canvasWidth.");
213       width.setEditable(false);
214       preferences.addElement(width);
215       preferenceHash.put(ExpConstants.WIDTH, width);
216 	  	  
217       Preference foregroundColor = new Preference(EXQLConstants.BROWSER_COLORS_FOREGROUND, Preference.PROPERTY_TYPE_COLOR, Color.black, prefs);
218       foregroundColor.setLongName("Browser foreground colour");
219       foregroundColor.setDescription("This is the colour of the foreground in the database browser.");
220       preferences.addElement(foregroundColor);
221       preferenceHash.put(EXQLConstants.BROWSER_COLORS_FOREGROUND, foregroundColor);
222 	  	  
223       Preference backgroundColor = new Preference(EXQLConstants.BROWSER_COLORS_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
224       backgroundColor.setLongName("Browser background colour");
225       backgroundColor.setDescription("This is the colour of the background in the database browser.");
226       preferences.addElement(backgroundColor);
227       preferenceHash.put(EXQLConstants.BROWSER_COLORS_BACKGROUND, backgroundColor);
228 	  	  
229       Preference selectedForegroundColor = new Preference(EXQLConstants.BROWSER_COLOR_SELECTEDFORGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
230       selectedForegroundColor.setLongName("Browser selected foreground colour");
231       selectedForegroundColor.setDescription("This is the colour of the foreground text in the database browser when that text has been highlighted.");
232       preferences.addElement(selectedForegroundColor);
233       preferenceHash.put(EXQLConstants.BROWSER_COLOR_SELECTEDFORGROUND, selectedForegroundColor);
234 	  	  
235       Preference selectedBackgroundColor = new Preference(EXQLConstants.BROWSER_COLOR_SELECTEDBACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.gray, prefs);
236       selectedBackgroundColor.setLongName("Browser selected background colour");
237       selectedBackgroundColor.setDescription("This is the colour of the backround in the database browser when it is behind text has been highlighted.");
238       preferences.addElement(selectedBackgroundColor);
239       preferenceHash.put(EXQLConstants.BROWSER_COLOR_SELECTEDBACKGROUND, selectedBackgroundColor);
240       
241       Preference browserFont = new Preference(EXQLConstants.BROWSER_FONT, Preference.PROPERTY_TYPE_FONT, SystemPreferences.getPreference(ExpConstants.BASE_FONT).getValue(), prefs);
242       browserFont.setLongName("Database browser font");
243       browserFont.setDescription("This is the font which gets used by the database browser.");
244       preferences.addElement(browserFont);
245       preferenceHash.put(EXQLConstants.BROWSER_FONT, browserFont);
246 	  
247 	  Preference showGridLines = new Preference(EXQLConstants.RDBMS_OPTION_SHOW_GRID, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(true), prefs);
248       showGridLines.setLongName("Show grid lines in tables");
249       showGridLines.setDescription("Determines whether or not the grid should be visible in data display tables.");
250       preferences.addElement(showGridLines);
251       preferenceHash.put(EXQLConstants.RDBMS_OPTION_SHOW_GRID, showGridLines);
252       
253       Preference showHGridLines = new Preference(EXQLConstants.RDBMS_OPTION_SHOW_HORIZONTAL_GRID_LINES, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(false), prefs);
254       showHGridLines.setLongName("Show horizontal grid lines in tables");
255       showHGridLines.setDescription("Determines whether or not the horizontal grid lines should be visible in data display tables.");
256       preferences.addElement(showHGridLines);
257       preferenceHash.put(EXQLConstants.RDBMS_OPTION_SHOW_HORIZONTAL_GRID_LINES, showHGridLines);
258 	  	  
259       Preference showVGridLines = new Preference(EXQLConstants.RDBMS_OPTION_SHOW_VERTICAL_GRID_LINES, Preference.PROPERTY_TYPE_BOOLEAN, new Boolean(false), prefs);
260       showVGridLines.setLongName("Show vertical grid lines in tables");
261       showVGridLines.setDescription("Determines whether or not the vertical grid lines should be visible in data display tables.");
262       preferences.addElement(showVGridLines);
263       preferenceHash.put(EXQLConstants.RDBMS_OPTION_SHOW_VERTICAL_GRID_LINES, showVGridLines);
264 	  	  
265       Preference tablesForegroundColor = new Preference(EXQLConstants.TABLE_COLORS_FOREGROUND, Preference.PROPERTY_TYPE_COLOR, Color.black, prefs);
266       tablesForegroundColor.setLongName("Data tables foreground colour");
267       tablesForegroundColor.setDescription("This is the colour of the foreground in data tables.");
268       preferences.addElement(tablesForegroundColor);
269       preferenceHash.put(EXQLConstants.TABLE_COLORS_FOREGROUND, tablesForegroundColor);
270 	  	  
271       Preference tablesBackgroundColor = new Preference(EXQLConstants.TABLE_COLORS_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
272       tablesBackgroundColor.setLongName("Data tables background colour");
273       tablesBackgroundColor.setDescription("This is the colour of the background in data tables.");
274       preferences.addElement(tablesBackgroundColor);
275       preferenceHash.put(EXQLConstants.TABLE_COLORS_BACKGROUND, tablesBackgroundColor);
276 	  	  
277       Preference tablesSelectedForegroundColor = new Preference(EXQLConstants.TABLE_COLOR_SELECTEDFORGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
278       tablesSelectedForegroundColor.setLongName("Data tables selected foreground colour");
279       tablesSelectedForegroundColor.setDescription("This is the colour of the foreground text in data tables when that text has been highlighted.");
280       preferences.addElement(tablesSelectedForegroundColor);
281       preferenceHash.put(EXQLConstants.TABLE_COLOR_SELECTEDFORGROUND, tablesSelectedForegroundColor);
282 	  	  
283       Preference tablesSelectedBackgroundColor = new Preference(EXQLConstants.TABLE_COLOR_SELECTEDBACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.lightGray, prefs);
284       tablesSelectedBackgroundColor.setLongName("Data tables selected background colour");
285       tablesSelectedBackgroundColor.setDescription("This is the colour of the backround in data tables when it is behind text has been highlighted.");
286       preferences.addElement(tablesSelectedBackgroundColor);
287       preferenceHash.put(EXQLConstants.TABLE_COLOR_SELECTEDBACKGROUND, tablesSelectedBackgroundColor);
288       
289       Preference tablesNullBackgroundColor = new Preference(EXQLConstants.TABLE_NULL_INDICATOR_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, new Color(-984083), prefs);
290       tablesNullBackgroundColor.setLongName("Data tables NULL value background colour");
291       tablesNullBackgroundColor.setDescription("This is the colour of the backround in data tables when the value in that cell is NULL.");
292       preferences.addElement(tablesNullBackgroundColor);
293       preferenceHash.put(EXQLConstants.TABLE_NULL_INDICATOR_BACKGROUND, tablesNullBackgroundColor);
294 	  	  
295       Preference tablesGridColor = new Preference(EXQLConstants.TABLE_GRID_COLOR, Preference.PROPERTY_TYPE_COLOR, Color.gray, prefs);
296       tablesGridColor.setLongName("Data tables grid colour");
297       tablesGridColor.setDescription("This is the colour of the grid in data tables.");
298       preferences.addElement(tablesGridColor);
299       preferenceHash.put(EXQLConstants.TABLE_GRID_COLOR, tablesGridColor);
300       
301       Preference tableFont = new Preference(EXQLConstants.TABLE_FONT, Preference.PROPERTY_TYPE_FONT, SystemPreferences.getPreference(ExpConstants.BASE_FONT), prefs);
302       tableFont.setLongName("Data tables font");
303       tableFont.setDescription("This is the font which gets used by the Data tables.");
304       preferences.addElement(tableFont);
305       preferenceHash.put(EXQLConstants.TABLE_FONT, tableFont);
306 	  	  
307       Preference cmmndrForgroundEditModeColor = new Preference(EXQLConstants.COMMANDER_EDIT_MODE_FOREGROUND_COLOR, Preference.PROPERTY_TYPE_COLOR, Color.black, prefs);
308       cmmndrForgroundEditModeColor.setLongName("Query writer foreground colour - edit mode.");
309       cmmndrForgroundEditModeColor.setDescription("This is the colour of the foreground when the SQL query writer is in command edit mode.");
310       preferences.addElement(cmmndrForgroundEditModeColor);
311       preferenceHash.put(EXQLConstants.COMMANDER_EDIT_MODE_FOREGROUND_COLOR, cmmndrForgroundEditModeColor);
312 	  	  
313       Preference cmmndrBackroundEditModeColor = new Preference(EXQLConstants.COMMANDER_EDIT_MODE_BACKGROUND_COLOR, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
314       cmmndrBackroundEditModeColor.setLongName("Query writer background colour - edit mode.");
315       cmmndrBackroundEditModeColor.setDescription("This is the colour of the background when the SQL query writer is in command edit mode.");
316       preferences.addElement(cmmndrBackroundEditModeColor);
317       preferenceHash.put(EXQLConstants.COMMANDER_EDIT_MODE_BACKGROUND_COLOR, cmmndrBackroundEditModeColor);
318 	  	  
319       Preference cmmndrForgroundBrowseModeColor = new Preference(EXQLConstants.COMMANDER_BROWSE_MODE_FOREGROUND_COLOR, Preference.PROPERTY_TYPE_COLOR, Color.gray, prefs);
320       cmmndrForgroundBrowseModeColor.setLongName("Query writer foreground colour - command history mode.");
321       cmmndrForgroundBrowseModeColor.setDescription("This is the colour of the foreground when the SQL query writer is in command history mode.");
322       preferences.addElement(cmmndrForgroundBrowseModeColor);
323       preferenceHash.put(EXQLConstants.COMMANDER_BROWSE_MODE_FOREGROUND_COLOR, cmmndrForgroundBrowseModeColor);
324 	  	  
325       Preference cmmndrBackroundBrowseModeColor = new Preference(EXQLConstants.COMMANDER_BROWSE_MODE_BACKGROUND_COLOR, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
326       cmmndrBackroundBrowseModeColor.setLongName("Query writer background colour - command history mode.");
327       cmmndrBackroundBrowseModeColor.setDescription("This is the colour of the background when the SQL query writer is in command history mode.");
328       preferences.addElement(cmmndrBackroundBrowseModeColor);
329       preferenceHash.put(EXQLConstants.COMMANDER_BROWSE_MODE_BACKGROUND_COLOR, cmmndrBackroundBrowseModeColor);
330 	  	  
331       Preference cmmndrSelectedForegroundColor = new Preference(EXQLConstants.COMMANDER_COLOR_SELECTEDFORGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
332       cmmndrSelectedForegroundColor.setLongName("Query writer selected foreground colour");
333       cmmndrSelectedForegroundColor.setDescription("This is the colour of the foreground text in the SQL query writer when that text has been highlighted.");
334       preferences.addElement(cmmndrSelectedForegroundColor);
335       preferenceHash.put(EXQLConstants.COMMANDER_COLOR_SELECTEDFORGROUND, cmmndrSelectedForegroundColor);
336 	  	  
337       Preference cmmndrSelectedBackgroundColor = new Preference(EXQLConstants.COMMANDER_COLOR_SELECTEDBACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.gray, prefs);
338       cmmndrSelectedBackgroundColor.setLongName("Query writer selected background colour");
339       cmmndrSelectedBackgroundColor.setDescription("This is the colour of the backround in the SQL query writer when it is behind text has been highlighted.");
340       preferences.addElement(cmmndrSelectedBackgroundColor);
341       preferenceHash.put(EXQLConstants.COMMANDER_COLOR_SELECTEDBACKGROUND, cmmndrSelectedBackgroundColor);
342 	  	  
343       Preference commanderFont = new Preference(EXQLConstants.COMMANDER_FONT, Preference.PROPERTY_TYPE_FONT, SystemPreferences.getPreference(ExpConstants.BASE_FONT), prefs);
344       commanderFont.setLongName("Query writer font");
345       commanderFont.setDescription("This is the font which gets used by the SQL query writer.");
346       preferences.addElement(commanderFont);
347       preferenceHash.put(EXQLConstants.COMMANDER_FONT, commanderFont);
348 	  	  
349       Preference addForegroundColor = new Preference(EXQLConstants.TABLE_EDIT_ADD_COLORS_FOREGROUND, Preference.PROPERTY_TYPE_COLOR, Color.blue, prefs);
350       addForegroundColor.setLongName("Added data foreground colour");
351       addForegroundColor.setDescription("This is the colour of the foreground used for added rows in the browser.");
352       preferences.addElement(addForegroundColor);
353       preferenceHash.put(EXQLConstants.TABLE_EDIT_ADD_COLORS_FOREGROUND, addForegroundColor);
354       
355       Preference addBackgroundColor = new Preference(EXQLConstants.TABLE_EDIT_ADD_COLORS_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
356       addBackgroundColor.setLongName("Added data background colour");
357       addBackgroundColor.setDescription("This is the colour of the background used for added rows in the browser.");
358       preferences.addElement(addBackgroundColor);
359       preferenceHash.put(EXQLConstants.TABLE_EDIT_ADD_COLORS_BACKGROUND, addBackgroundColor);
360       
361       Preference deletedForegroundColor = new Preference(EXQLConstants.TABLE_EDIT_DELETED_COLORS_FOREGROUND, Preference.PROPERTY_TYPE_COLOR, Color.red, prefs);
362       deletedForegroundColor.setLongName("Deleted data foreground colour");
363       deletedForegroundColor.setDescription("This is the colour of the foreground used for deleted rows in the browser.");
364       preferences.addElement(deletedForegroundColor);
365       preferenceHash.put(EXQLConstants.TABLE_EDIT_DELETED_COLORS_FOREGROUND, deletedForegroundColor);
366       
367       Preference deletedBackgroundColor = new Preference(EXQLConstants.TABLE_EDIT_DELETED_COLORS_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
368       deletedBackgroundColor.setLongName("Deleted data background colour");
369       deletedBackgroundColor.setDescription("This is the colour of the background used for deleted rows in the browser.");
370       preferences.addElement(deletedBackgroundColor);
371       preferenceHash.put(EXQLConstants.TABLE_EDIT_DELETED_COLORS_BACKGROUND, deletedBackgroundColor);
372       
373       Preference nonEditableForegroundColor = new Preference(EXQLConstants.TABLE_NONEDITABLE_COLORS_FOREGROUND, Preference.PROPERTY_TYPE_COLOR, Color.DARK_GRAY, prefs);
374       nonEditableForegroundColor.setLongName("Non editable data foreground colour");
375       nonEditableForegroundColor.setDescription("This is the colour of the foreground used for non editable values in the browser.");
376       preferences.addElement(nonEditableForegroundColor);
377       preferenceHash.put(EXQLConstants.TABLE_NONEDITABLE_COLORS_FOREGROUND, nonEditableForegroundColor);
378       
379       Preference nonEditableBackgroundColor = new Preference(EXQLConstants.TABLE_NONEDITABLE_COLORS_BACKGROUND, Preference.PROPERTY_TYPE_COLOR, Color.white, prefs);
380       nonEditableBackgroundColor.setLongName("Non editable data background colour");
381       nonEditableBackgroundColor.setDescription("This is the colour of the background used for non editable values in the browser.");
382       preferences.addElement(nonEditableBackgroundColor);
383       preferenceHash.put(EXQLConstants.TABLE_NONEDITABLE_COLORS_BACKGROUND, nonEditableBackgroundColor);
384     }
385     catch (Exception e)
386     {
387       com.explosion.utilities.exception.ExceptionManagerFactory.getExceptionManager().manageException(e, "Exception caught while initialising editor support properties.");
388     }
389   }
390 
391   public Vector getPreferences()
392   {
393     return preferences;
394   }
395 
396 
397   public Preference getPreference(String preferenceName)
398   {
399   	return (Preference) preferenceHash.get(preferenceName);
400   }
401   
402   public JPanel getPreferencesEditor()
403   {
404     return null;
405   }
406   
407   public ExpActionListener getGlobalListener()
408   {
409   	return globalActionListener;
410   }
411   
412   public static EXQLModuleManager instance()
413   {
414     return instance;
415   }
416 
417   public String getPreferenceRoot()
418   {
419     return (String) SystemPreferences.getPreference(ExpConstants.EXPF_APP_PREFIX).getValue()+"/exql";
420   }
421 
422   
423 }