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