Some javadoc added
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPSyntaxEditorPreferencePage.java
1 package net.sourceforge.phpeclipse;
2
3 import java.util.HashMap;
4 import java.util.Iterator;
5 import java.util.Map;
6
7 import net.sourceforge.phpeclipse.preferences.ColorEditor;
8 import net.sourceforge.phpeclipse.preferences.OverlayPreferenceStore;
9 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
10 import org.eclipse.core.runtime.IStatus;
11 import org.eclipse.jface.preference.FileFieldEditor;
12 import org.eclipse.jface.preference.IPreferenceStore;
13 import org.eclipse.jface.preference.PreferenceConverter;
14 import org.eclipse.jface.preference.PreferencePage;
15 import org.eclipse.jface.text.source.ISourceViewer;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.custom.StyledText;
18 import org.eclipse.swt.events.SelectionEvent;
19 import org.eclipse.swt.events.SelectionListener;
20 import org.eclipse.swt.graphics.Color;
21 import org.eclipse.swt.graphics.RGB;
22 import org.eclipse.swt.layout.GridData;
23 import org.eclipse.swt.layout.GridLayout;
24 import org.eclipse.swt.widgets.Button;
25 import org.eclipse.swt.widgets.Composite;
26 import org.eclipse.swt.widgets.Control;
27 import org.eclipse.swt.widgets.Display;
28 import org.eclipse.swt.widgets.Group;
29 import org.eclipse.swt.widgets.Label;
30 import org.eclipse.swt.widgets.List;
31 import org.eclipse.ui.IWorkbench;
32 import org.eclipse.ui.IWorkbenchPreferencePage;
33
34 /*
35  * The preference page for setting the PHP Editor options.
36  */
37 public class PHPSyntaxEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
38
39   public final OverlayPreferenceStore.OverlayKey[] Keys =
40     new OverlayPreferenceStore.OverlayKey[] {
41       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_MULTILINE_COMMENT),
42       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_MULTILINE_COMMENT_BOLD),
43       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_MULTILINE_COMMENT_ITALIC),
44       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_MULTILINE_COMMENT_UNDERLINE),
45       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_SINGLELINE_COMMENT),
46       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_SINGLELINE_COMMENT_BOLD),
47       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_SINGLELINE_COMMENT_ITALIC),
48       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_SINGLELINE_COMMENT_UNDERLINE),
49       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_KEYWORD),
50       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_KEYWORD_BOLD),
51       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_KEYWORD_ITALIC),
52       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_KEYWORD_UNDERLINE),
53       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_VARIABLE),
54       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_VARIABLE_BOLD),
55       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_VARIABLE_ITALIC),
56       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_VARIABLE_UNDERLINE),
57       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_TYPE),
58       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_TYPE_BOLD),
59       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_TYPE_ITALIC),
60       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_TYPE_UNDERLINE),
61       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_CONSTANT),
62       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_CONSTANT_BOLD),
63       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_CONSTANT_ITALIC),
64       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_CONSTANT_UNDERLINE),
65       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_FUNCTIONNAME),
66       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_BOLD),
67       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_ITALIC),
68       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_FUNCTIONNAME_UNDERLINE),
69       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_STRING),
70       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_BOLD),
71       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_ITALIC),
72       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_STRING_UNDERLINE),
73       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_DEFAULT),
74       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_BOLD),
75       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_ITALIC),
76       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IPreferenceConstants.PHP_DEFAULT_UNDERLINE),
77       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
78       new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_EDITOR_BACKGROUND)};
79
80   private final String[][] SyntaxColorListModel =
81     new String[][] {
82       {
83         PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.multiLineComment"),
84         IPreferenceConstants.PHP_MULTILINE_COMMENT },
85       {
86       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.singleLineComment"),
87         IPreferenceConstants.PHP_SINGLELINE_COMMENT },
88         {
89       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.keywords"), IPreferenceConstants.PHP_KEYWORD }, {
90       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.variables"), IPreferenceConstants.PHP_VARIABLE }, {
91       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.types"), IPreferenceConstants.PHP_TYPE }, {
92       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.functions"), IPreferenceConstants.PHP_FUNCTIONNAME }, {
93       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.constants"), IPreferenceConstants.PHP_CONSTANT }, {
94       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.strings"), IPreferenceConstants.PHP_STRING }, {
95       PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.others"), IPreferenceConstants.PHP_DEFAULT }
96   };
97
98   private OverlayPreferenceStore OverlayStore;
99
100   private Map ColorButtons = new HashMap();
101   private SelectionListener ColorButtonListener = new SelectionListener() {
102     public void widgetDefaultSelected(SelectionEvent e) {
103     }
104     public void widgetSelected(SelectionEvent e) {
105       ColorEditor editor = (ColorEditor) e.widget.getData();
106       PreferenceConverter.setValue(OverlayStore, (String) ColorButtons.get(editor), editor.getColorValue());
107     }
108   };
109
110   private Map CheckBoxes = new HashMap();
111   private SelectionListener CheckBoxListener = new SelectionListener() {
112     public void widgetDefaultSelected(SelectionEvent e) {
113     }
114     public void widgetSelected(SelectionEvent e) {
115       Button button = (Button) e.widget;
116       OverlayStore.setValue((String) CheckBoxes.get(button), button.getSelection());
117     }
118   };
119
120   private List SyntaxColorList;
121   /** The ColorEditor that choose the foreground color. */
122   private ColorEditor SyntaxForegroundColorEditor;
123   private Button BoldCheckBox;
124   private Button ItalicCheckBox;
125   private Button UnderlineCheckBox;
126   private FileFieldEditor userdefPHPSyntaxFileFFE;
127
128   public PHPSyntaxEditorPreferencePage() {
129     setDescription(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.description")); //$NON-NLS-1$
130     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
131     OverlayStore = new OverlayPreferenceStore(getPreferenceStore(), Keys);
132   }
133
134   public void init(IWorkbench workbench) {
135   }
136
137   public void createControl(Composite parent) {
138     super.createControl(parent);
139   }
140
141   private void handleSyntaxColorListSelection() {
142     int i = SyntaxColorList.getSelectionIndex();
143     String key = SyntaxColorListModel[i][1];
144     RGB rgb = PreferenceConverter.getColor(OverlayStore, key);
145     SyntaxForegroundColorEditor.setColorValue(rgb);
146     BoldCheckBox.setSelection(OverlayStore.getBoolean(key + "_bold"));
147     ItalicCheckBox.setSelection(OverlayStore.getBoolean(key + "_italic"));
148     UnderlineCheckBox.setSelection(OverlayStore.getBoolean(key + "_underline"));
149   }
150
151   /**
152    * Create the group of options for other parameters (background color for example).
153    * @param parent the parent component
154    */
155   private void backgroundOptionPage(Composite parent) {
156     Label label = new Label(parent, SWT.LEFT);
157     label.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.color")); //$NON-NLS-1$
158     GridData gd = new GridData();
159     gd.horizontalAlignment = GridData.BEGINNING;
160     label.setLayoutData(gd);
161     final ColorEditor syntaxBackgroundColorEditor = new ColorEditor(parent);
162     RGB rgb = PreferenceConverter.getColor(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND);
163     syntaxBackgroundColorEditor.setColorValue(rgb);
164     Button backgroundColorButton = syntaxBackgroundColorEditor.getButton();
165     gd = new GridData(GridData.FILL_HORIZONTAL);
166     gd.horizontalAlignment = GridData.BEGINNING;
167     backgroundColorButton.setLayoutData(gd);
168     backgroundColorButton.addSelectionListener(new SelectionListener() {
169       public void widgetDefaultSelected(SelectionEvent e) {
170         // do nothing
171       }
172       public void widgetSelected(SelectionEvent e) {
173         PreferenceConverter.setValue(OverlayStore, IPreferenceConstants.PHP_EDITOR_BACKGROUND, syntaxBackgroundColorEditor.getColorValue());
174       }
175     });
176   }
177
178   /**
179    * Create the group of options for the syntax parameters.
180    * @param parent the parent component
181    * @return
182    */
183   private Control createSyntaxPage(Composite parent) {
184
185     Composite colorComposite = new Composite(parent, SWT.NULL);
186     colorComposite.setLayout(new GridLayout());
187
188     Label label = new Label(colorComposite, SWT.LEFT);
189     label.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntax")); //$NON-NLS-1$
190     label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
191
192     Composite editorComposite = new Composite(colorComposite, SWT.NONE);
193     GridLayout layout = new GridLayout();
194     layout.numColumns = 2;
195     layout.marginHeight = 0;
196     layout.marginWidth = 0;
197     editorComposite.setLayout(layout);
198     GridData gd = new GridData(GridData.FILL_BOTH);
199     editorComposite.setLayoutData(gd);
200
201     SyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
202     gd = new GridData(GridData.FILL_BOTH);
203     gd.heightHint = convertHeightInCharsToPixels(5);
204     SyntaxColorList.setLayoutData(gd);
205
206     Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
207     layout = new GridLayout();
208     layout.marginHeight = 0;
209     layout.marginWidth = 0;
210     layout.numColumns = 2;
211     stylesComposite.setLayout(layout);
212     stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
213
214     label = new Label(stylesComposite, SWT.LEFT);
215     label.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.color")); //$NON-NLS-1$
216     gd = new GridData();
217     gd.horizontalAlignment = GridData.BEGINNING;
218     label.setLayoutData(gd);
219
220     SyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
221     Button foregroundColorButton = SyntaxForegroundColorEditor.getButton();
222     gd = new GridData(GridData.FILL_HORIZONTAL);
223     gd.horizontalAlignment = GridData.BEGINNING;
224     foregroundColorButton.setLayoutData(gd);
225
226     BoldCheckBox = new Button(stylesComposite, SWT.CHECK);
227     BoldCheckBox.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.bold")); //$NON-NLS-1$
228     gd = new GridData(GridData.FILL_HORIZONTAL);
229     gd.horizontalAlignment = GridData.BEGINNING;
230     gd.horizontalSpan = 2;
231     BoldCheckBox.setLayoutData(gd);
232
233     ItalicCheckBox = new Button(stylesComposite, SWT.CHECK);
234     ItalicCheckBox.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.italic")); //$NON-NLS-1$
235     ItalicCheckBox.setEnabled(false);
236     gd = new GridData(GridData.FILL_HORIZONTAL);
237     gd.horizontalAlignment = GridData.BEGINNING;
238     gd.horizontalSpan = 2;
239     ItalicCheckBox.setLayoutData(gd);
240
241     UnderlineCheckBox = new Button(stylesComposite, SWT.CHECK);
242     UnderlineCheckBox.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.underline")); //$NON-NLS-1$
243     UnderlineCheckBox.setEnabled(false);
244     gd = new GridData(GridData.FILL_HORIZONTAL);
245     gd.horizontalAlignment = GridData.BEGINNING;
246     gd.horizontalSpan = 2;
247     UnderlineCheckBox.setLayoutData(gd);
248
249     Composite customSyntaxComposite = new Composite(colorComposite, SWT.NONE);
250     layout = new GridLayout();
251     layout.marginHeight = 0;
252     layout.marginWidth = 0;
253     layout.numColumns = 3;
254     stylesComposite.setLayout(layout);
255     stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
256
257     userdefPHPSyntaxFileFFE =
258       new FileFieldEditor(
259         IPreferenceConstants.PHP_USERDEF_XMLFILE,
260         PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
261         colorComposite);
262     userdefPHPSyntaxFileFFE.setPreferencePage(this);
263     userdefPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
264     userdefPHPSyntaxFileFFE.load();
265
266     SyntaxColorList.addSelectionListener(new SelectionListener() {
267       public void widgetDefaultSelected(SelectionEvent e) {
268         // do nothing
269       }
270       public void widgetSelected(SelectionEvent e) {
271         handleSyntaxColorListSelection();
272       }
273     });
274
275     foregroundColorButton.addSelectionListener(new SelectionListener() {
276       public void widgetDefaultSelected(SelectionEvent e) {
277         // do nothing
278       }
279       public void widgetSelected(SelectionEvent e) {
280         int i = SyntaxColorList.getSelectionIndex();
281         String key = SyntaxColorListModel[i][1];
282
283         PreferenceConverter.setValue(OverlayStore, key, SyntaxForegroundColorEditor.getColorValue());
284       }
285     });
286     BoldCheckBox.addSelectionListener(new SelectionListener() {
287       public void widgetDefaultSelected(SelectionEvent e) {
288         // do nothing
289       }
290       public void widgetSelected(SelectionEvent e) {
291         int i = SyntaxColorList.getSelectionIndex();
292         String key = SyntaxColorListModel[i][1];
293         OverlayStore.setValue(key + "_bold", BoldCheckBox.getSelection());
294       }
295     });
296
297     ItalicCheckBox.addSelectionListener(new SelectionListener() {
298       public void widgetDefaultSelected(SelectionEvent e) {
299         // do nothing
300       }
301       public void widgetSelected(SelectionEvent e) {
302         int i = SyntaxColorList.getSelectionIndex();
303         String key = SyntaxColorListModel[i][1];
304         OverlayStore.setValue(key + "_italic", ItalicCheckBox.getSelection());
305       }
306     });
307
308     UnderlineCheckBox.addSelectionListener(new SelectionListener() {
309       public void widgetDefaultSelected(SelectionEvent e) {
310         // do nothing
311       }
312       public void widgetSelected(SelectionEvent e) {
313         int i = SyntaxColorList.getSelectionIndex();
314         String key = SyntaxColorListModel[i][1];
315         OverlayStore.setValue(key + "_underline", UnderlineCheckBox.getSelection());
316       }
317     });
318     return colorComposite;
319   }
320
321   private void initializeViewerColors(ISourceViewer viewer) {
322
323     IPreferenceStore store = OverlayStore;
324     if (store != null) {
325
326       StyledText styledText = viewer.getTextWidget();
327     }
328   }
329
330   private Color createColor(IPreferenceStore store, String key, Display display) {
331     RGB rgb = null;
332     if (store.contains(key)) {
333       if (store.isDefault(key))
334         rgb = PreferenceConverter.getDefaultColor(store, key);
335       else
336         rgb = PreferenceConverter.getColor(store, key);
337       if (rgb != null)
338         return new Color(display, rgb);
339     }
340     return null;
341   }
342
343   private static void setEnabled(Control control, boolean enable) {
344     control.setEnabled(enable);
345     if (control instanceof Composite) {
346       Composite composite = (Composite) control;
347       Control[] children = composite.getChildren();
348       for (int i = 0; i < children.length; i++)
349         setEnabled(children[i], enable);
350     }
351   }
352
353   private static void indent(Control control) {
354     GridData gridData = new GridData();
355     gridData.horizontalIndent = 20;
356     control.setLayoutData(gridData);
357   }
358
359   private static void createDependency(final Button master, final Control slave) {
360     indent(slave);
361     master.addSelectionListener(new SelectionListener() {
362       public void widgetSelected(SelectionEvent e) {
363         slave.setEnabled(master.getSelection());
364       }
365
366       public void widgetDefaultSelected(SelectionEvent e) {
367       }
368     });
369   }
370
371   protected Control createContents(Composite parent) {
372     OverlayStore.load();
373     OverlayStore.start();
374     //Create overall composite
375     Composite composite = new Composite(parent, SWT.NONE);
376     GridLayout layout = new GridLayout();
377     layout.marginHeight = 0;
378     layout.marginWidth = 0;
379     composite.setLayout(layout);
380     Composite syntaxComposite = new Composite(composite, SWT.NULL);
381     syntaxComposite.setLayout(new GridLayout());
382     layout = new GridLayout();
383     layout.numColumns = 3;
384     Group syntaxGroup = new Group(syntaxComposite, SWT.NONE);
385     syntaxGroup.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.foreground"));
386     syntaxGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
387     syntaxGroup.setLayout(layout);
388     createSyntaxPage(syntaxGroup);
389
390     Composite backgroundOptions = new Composite(composite,SWT.NULL);
391     backgroundOptions.setLayout(new GridLayout());
392     layout = new GridLayout();
393     layout.numColumns = 3;
394     Group backgroundOptionsGroup = new Group(backgroundOptions,SWT.NONE);
395     backgroundOptionsGroup.setText(PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.background"));
396     backgroundOptionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
397     backgroundOptionsGroup.setLayout(layout);
398     backgroundOptionPage(backgroundOptionsGroup);
399
400     initialize();
401     return composite;
402   }
403
404   private void initialize() {
405     initializeFields();
406     for (int i = 0; i < SyntaxColorListModel.length; i++)
407       SyntaxColorList.add(SyntaxColorListModel[i][0]);
408     SyntaxColorList.getDisplay().asyncExec(new Runnable() {
409       public void run() {
410         if (SyntaxColorList != null && !SyntaxColorList.isDisposed()) {
411           SyntaxColorList.select(0);
412           handleSyntaxColorListSelection();
413         }
414       }
415     });
416   }
417
418   private void initializeFields() {
419
420     Iterator e = ColorButtons.keySet().iterator();
421     while (e.hasNext()) {
422       ColorEditor c = (ColorEditor) e.next();
423       String key = (String) ColorButtons.get(c);
424       RGB rgb = PreferenceConverter.getColor(OverlayStore, key);
425       c.setColorValue(rgb);
426     }
427
428     e = CheckBoxes.keySet().iterator();
429     while (e.hasNext()) {
430       Button b = (Button) e.next();
431       String key = (String) CheckBoxes.get(b);
432       b.setSelection(OverlayStore.getBoolean(key));
433     }
434   }
435
436   public boolean performOk() {
437     OverlayStore.propagate();
438     IPreferenceStore store = getPreferenceStore();
439     PHPeclipsePlugin.getDefault().savePluginPreferences();
440     userdefPHPSyntaxFileFFE.store();
441     return true;
442   }
443
444   protected void performDefaults() {
445     OverlayStore.loadDefaults();
446     initializeFields();
447     handleSyntaxColorListSelection();
448     userdefPHPSyntaxFileFFE.loadDefault();
449     super.performDefaults();
450   }
451
452   public void dispose() {
453     if (OverlayStore != null) {
454       OverlayStore.stop();
455       OverlayStore = null;
456     }
457     super.dispose();
458   }
459
460   private Control addColorButton(Composite composite, String label, String key, int indentation) {
461     Label labelControl = new Label(composite, SWT.NONE);
462     labelControl.setText(label);
463     GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
464     gd.horizontalIndent = indentation;
465     labelControl.setLayoutData(gd);
466     ColorEditor editor = new ColorEditor(composite);
467     Button button = editor.getButton();
468     button.setData(editor);
469     gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
470     button.setLayoutData(gd);
471     button.addSelectionListener(ColorButtonListener);
472     ColorButtons.put(editor, key);
473     return composite;
474   }
475
476   private Button addCheckBox(Composite parent, String label, String key, int indentation) {
477     Button checkBox = new Button(parent, SWT.CHECK);
478     checkBox.setText(label);
479     GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
480     gd.horizontalIndent = indentation;
481     gd.horizontalSpan = 2;
482     checkBox.setLayoutData(gd);
483     checkBox.addSelectionListener(CheckBoxListener);
484     CheckBoxes.put(checkBox, key);
485     return checkBox;
486   }
487
488   private void updateStatus(IStatus status) {
489   }
490
491   /**
492    * @deprecated Inline to avoid reference to preference page
493    */
494   public static boolean indicateQuixFixableProblems() {
495     //          return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
496     return false;
497   }
498
499   /**
500    * @deprecated Inline to avoid reference to preference page
501    */
502   static public boolean synchronizeOutlineOnCursorMove() {
503     //          return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);
504     return false;
505   }
506
507 }