1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
10 **********************************************************************/
12 package net.sourceforge.phpdt.internal.ui.preferences;
14 import java.io.BufferedReader;
15 import java.io.IOException;
16 import java.io.InputStreamReader;
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.Iterator;
22 import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
23 import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
24 import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil;
25 import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
26 import net.sourceforge.phpdt.ui.PreferenceConstants;
27 import net.sourceforge.phpdt.ui.text.JavaTextTools;
28 import net.sourceforge.phpeclipse.IPreferenceConstants;
29 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
30 import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
31 import net.sourceforge.phpeclipse.preferences.ColorEditor;
32 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
34 import org.eclipse.core.runtime.IStatus;
35 import org.eclipse.jface.preference.FileFieldEditor;
36 import org.eclipse.jface.preference.IPreferenceStore;
37 import org.eclipse.jface.preference.PreferenceConverter;
38 import org.eclipse.jface.preference.PreferencePage;
39 import org.eclipse.jface.resource.JFaceResources;
40 import org.eclipse.jface.text.Document;
41 import org.eclipse.jface.text.IDocument;
42 import org.eclipse.jface.text.IDocumentPartitioner;
43 import org.eclipse.jface.text.source.ISourceViewer;
44 import org.eclipse.jface.text.source.SourceViewer;
45 import org.eclipse.jface.util.IPropertyChangeListener;
46 import org.eclipse.jface.util.PropertyChangeEvent;
47 import org.eclipse.swt.SWT;
48 import org.eclipse.swt.custom.StyledText;
49 import org.eclipse.swt.events.ModifyEvent;
50 import org.eclipse.swt.events.ModifyListener;
51 import org.eclipse.swt.events.SelectionAdapter;
52 import org.eclipse.swt.events.SelectionEvent;
53 import org.eclipse.swt.events.SelectionListener;
54 import org.eclipse.swt.graphics.Color;
55 import org.eclipse.swt.graphics.RGB;
56 import org.eclipse.swt.layout.GridData;
57 import org.eclipse.swt.layout.GridLayout;
58 import org.eclipse.swt.layout.RowLayout;
59 import org.eclipse.swt.widgets.Button;
60 import org.eclipse.swt.widgets.Composite;
61 import org.eclipse.swt.widgets.Control;
62 import org.eclipse.swt.widgets.Display;
63 import org.eclipse.swt.widgets.Group;
64 import org.eclipse.swt.widgets.Label;
65 import org.eclipse.swt.widgets.List;
66 import org.eclipse.swt.widgets.TabFolder;
67 import org.eclipse.swt.widgets.TabItem;
68 import org.eclipse.swt.widgets.Text;
69 import org.eclipse.ui.IWorkbench;
70 import org.eclipse.ui.IWorkbenchPreferencePage;
71 import org.eclipse.ui.texteditor.AbstractTextEditor;
72 import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
75 * The page for setting the editor options.
77 public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
79 private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
81 public final OverlayPreferenceStore.OverlayKey[] fKeys =
82 new OverlayPreferenceStore.OverlayKey[] {
83 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FOREGROUND_COLOR),
84 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
85 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BACKGROUND_COLOR),
86 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
87 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH),
88 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
89 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
90 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
91 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
92 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
93 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
94 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
95 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
96 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
97 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
98 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
99 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
100 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
101 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
102 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
103 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
104 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
105 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
106 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
107 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
108 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
109 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
110 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
111 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
112 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
113 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
114 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
115 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
116 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
117 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CURRENT_LINE),
118 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
119 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
120 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PRINT_MARGIN),
121 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
122 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
123 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR),
124 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
125 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PROBLEM_INDICATION),
126 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
127 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WARNING_INDICATION),
128 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
129 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION),
130 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
131 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
132 new OverlayPreferenceStore.OverlayKey(
133 OverlayPreferenceStore.STRING,
134 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
135 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
136 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
137 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
138 new OverlayPreferenceStore.OverlayKey(
139 OverlayPreferenceStore.BOOLEAN,
140 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
141 new OverlayPreferenceStore.OverlayKey(
142 OverlayPreferenceStore.BOOLEAN,
143 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
144 new OverlayPreferenceStore.OverlayKey(
145 OverlayPreferenceStore.BOOLEAN,
146 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
147 new OverlayPreferenceStore.OverlayKey(
148 OverlayPreferenceStore.BOOLEAN,
149 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
150 new OverlayPreferenceStore.OverlayKey(
151 OverlayPreferenceStore.BOOLEAN,
152 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
153 new OverlayPreferenceStore.OverlayKey(
154 OverlayPreferenceStore.BOOLEAN,
155 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
156 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION),
157 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
158 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
159 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_OVERVIEW_RULER),
160 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
161 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
162 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS),
163 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION),
164 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
165 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT),
166 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
167 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
168 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
169 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
170 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
171 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
172 new OverlayPreferenceStore.OverlayKey(
173 OverlayPreferenceStore.STRING,
174 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
175 new OverlayPreferenceStore.OverlayKey(
176 OverlayPreferenceStore.STRING,
177 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
178 new OverlayPreferenceStore.OverlayKey(
179 OverlayPreferenceStore.STRING,
180 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
181 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
182 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
183 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
184 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT),
185 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
186 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
187 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
188 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
189 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
190 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
191 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
192 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
193 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
194 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
195 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
196 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END),
197 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
198 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
199 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_DEFAULT_HOVER),
200 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_NONE_HOVER),
201 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_HOVER),
202 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SHIFT_HOVER),
203 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
204 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
205 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
206 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
207 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
208 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
211 private final String[][] fSyntaxColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
213 PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
215 PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
217 PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
219 PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
221 PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
223 PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
225 PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
227 PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
229 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
231 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD }, //$NON-NLS-1$
233 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
235 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
238 private final String[][] fAppearanceColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, //$NON-NLS-1$
240 PHPUIMessages.getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$
242 PHPUIMessages.getString("PHPEditorPreferencePage.currentLineHighlighColor"), PreferenceConstants.EDITOR_CURRENT_LINE_COLOR }, //$NON-NLS-1$
244 PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"), PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR }, //$NON-NLS-1$
246 PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR }, //$NON-NLS-1$
248 PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"), PreferenceConstants.EDITOR_LINKED_POSITION_COLOR }, //$NON-NLS-1$
250 PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR }, //$NON-NLS-1$
253 private final String[][] fProblemIndicationColorListModel =
257 PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
258 PreferenceConstants.EDITOR_PROBLEM_INDICATION,
259 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
262 PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
263 PreferenceConstants.EDITOR_WARNING_INDICATION,
264 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
267 PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
268 PreferenceConstants.EDITOR_TASK_INDICATION,
269 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
272 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
273 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
274 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
277 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
278 PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
279 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
282 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
283 PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
284 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
287 private OverlayPreferenceStore fOverlayStore;
288 private JavaTextTools fJavaTextTools;
289 // private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
291 private Map fColorButtons = new HashMap();
292 private SelectionListener fColorButtonListener = new SelectionListener() {
293 public void widgetDefaultSelected(SelectionEvent e) {
295 public void widgetSelected(SelectionEvent e) {
296 ColorEditor editor = (ColorEditor) e.widget.getData();
297 PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons.get(editor), editor.getColorValue());
301 private Map fCheckBoxes = new HashMap();
302 private SelectionListener fCheckBoxListener = new SelectionListener() {
303 public void widgetDefaultSelected(SelectionEvent e) {
305 public void widgetSelected(SelectionEvent e) {
306 Button button = (Button) e.widget;
307 fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
311 private Map fTextFields = new HashMap();
312 private ModifyListener fTextFieldListener = new ModifyListener() {
313 public void modifyText(ModifyEvent e) {
314 Text text = (Text) e.widget;
315 fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
319 private ArrayList fNumberFields = new ArrayList();
320 private ModifyListener fNumberFieldListener = new ModifyListener() {
321 public void modifyText(ModifyEvent e) {
322 numberFieldChanged((Text) e.widget);
326 private WorkbenchChainedTextFontFieldEditor fFontEditor;
327 private List fSyntaxColorList;
328 private List fAppearanceColorList;
329 private List fProblemIndicationList;
330 private ColorEditor fSyntaxForegroundColorEditor;
331 private ColorEditor fAppearanceForegroundColorEditor;
332 private ColorEditor fProblemIndicationForegroundColorEditor;
333 private ColorEditor fBackgroundColorEditor;
334 private Button fBackgroundDefaultRadioButton;
335 private Button fBackgroundCustomRadioButton;
336 private Button fBackgroundColorButton;
337 private Button fBoldCheckBox;
338 //private Button fAddJavaDocTagsButton;
339 // private Button fGuessMethodArgumentsButton;
340 private SourceViewer fPreviewViewer;
341 private Color fBackgroundColor;
342 private Control fAutoInsertDelayText;
343 private Control fAutoInsertJavaTriggerText;
344 private Control fAutoInsertJavaDocTriggerText;
345 private Control fAutoInsertHTMLTriggerText;
346 private Button fShowInTextCheckBox;
347 private Button fShowInOverviewRulerCheckBox;
348 // private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
350 public PHPEditorPreferencePage() {
351 setDescription(PHPUIMessages.getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
352 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
353 fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
357 * @see IWorkbenchPreferencePage#init()
359 public void init(IWorkbench workbench) {
363 * @see PreferencePage#createControl(Composite)
365 public void createControl(Composite parent) {
366 super.createControl(parent);
367 // WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
370 private void handleSyntaxColorListSelection() {
371 int i = fSyntaxColorList.getSelectionIndex();
372 String key = fSyntaxColorListModel[i][1];
373 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
374 fSyntaxForegroundColorEditor.setColorValue(rgb);
375 fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
378 private void handleAppearanceColorListSelection() {
379 int i = fAppearanceColorList.getSelectionIndex();
380 String key = fAppearanceColorListModel[i][1];
381 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
382 fAppearanceForegroundColorEditor.setColorValue(rgb);
385 private void handleProblemIndicationColorListSelection() {
386 int i = fProblemIndicationList.getSelectionIndex();
388 String key = fProblemIndicationColorListModel[i][1];
389 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
390 fProblemIndicationForegroundColorEditor.setColorValue(rgb);
392 key = fProblemIndicationColorListModel[i][2];
393 fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
395 key = fProblemIndicationColorListModel[i][3];
396 fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
399 private Control createSyntaxPage(Composite parent) {
401 Composite colorComposite = new Composite(parent, SWT.NULL);
402 colorComposite.setLayout(new GridLayout());
404 Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
405 backgroundComposite.setLayout(new RowLayout());
406 backgroundComposite.setText(PHPUIMessages.getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
408 SelectionListener backgroundSelectionListener = new SelectionListener() {
409 public void widgetSelected(SelectionEvent e) {
410 boolean custom = fBackgroundCustomRadioButton.getSelection();
411 fBackgroundColorButton.setEnabled(custom);
412 fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
414 public void widgetDefaultSelected(SelectionEvent e) {
418 fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
419 fBackgroundDefaultRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
420 fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
422 fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
423 fBackgroundCustomRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
424 fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
426 fBackgroundColorEditor = new ColorEditor(backgroundComposite);
427 fBackgroundColorButton = fBackgroundColorEditor.getButton();
429 // fUserDefinedPHPSyntaxFileFFE =
430 // new FileFieldEditor(
431 // IPreferenceConstants.PHP_USERDEF_XMLFILE,
432 // PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
434 // fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
435 // fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
436 // fUserDefinedPHPSyntaxFileFFE.load();
438 Label label = new Label(colorComposite, SWT.LEFT);
439 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
440 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
442 Composite editorComposite = new Composite(colorComposite, SWT.NONE);
443 GridLayout layout = new GridLayout();
444 layout.numColumns = 2;
445 layout.marginHeight = 0;
446 layout.marginWidth = 0;
447 editorComposite.setLayout(layout);
448 GridData gd = new GridData(GridData.FILL_BOTH);
449 editorComposite.setLayoutData(gd);
451 fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
452 gd = new GridData(GridData.FILL_BOTH);
453 gd.heightHint = convertHeightInCharsToPixels(5);
454 fSyntaxColorList.setLayoutData(gd);
456 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
457 layout = new GridLayout();
458 layout.marginHeight = 0;
459 layout.marginWidth = 0;
460 layout.numColumns = 2;
461 stylesComposite.setLayout(layout);
462 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
464 label = new Label(stylesComposite, SWT.LEFT);
465 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
467 gd.horizontalAlignment = GridData.BEGINNING;
468 label.setLayoutData(gd);
470 fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
471 Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
472 gd = new GridData(GridData.FILL_HORIZONTAL);
473 gd.horizontalAlignment = GridData.BEGINNING;
474 foregroundColorButton.setLayoutData(gd);
476 fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
477 fBoldCheckBox.setText(PHPUIMessages.getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
478 gd = new GridData(GridData.FILL_HORIZONTAL);
479 gd.horizontalAlignment = GridData.BEGINNING;
480 gd.horizontalSpan = 2;
481 fBoldCheckBox.setLayoutData(gd);
483 label = new Label(colorComposite, SWT.LEFT);
484 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
485 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
487 Control previewer = createPreviewer(colorComposite);
488 gd = new GridData(GridData.FILL_BOTH);
489 gd.widthHint = convertWidthInCharsToPixels(20);
490 gd.heightHint = convertHeightInCharsToPixels(5);
491 previewer.setLayoutData(gd);
493 fSyntaxColorList.addSelectionListener(new SelectionListener() {
494 public void widgetDefaultSelected(SelectionEvent e) {
497 public void widgetSelected(SelectionEvent e) {
498 handleSyntaxColorListSelection();
502 foregroundColorButton.addSelectionListener(new SelectionListener() {
503 public void widgetDefaultSelected(SelectionEvent e) {
506 public void widgetSelected(SelectionEvent e) {
507 int i = fSyntaxColorList.getSelectionIndex();
508 String key = fSyntaxColorListModel[i][1];
510 PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
514 fBackgroundColorButton.addSelectionListener(new SelectionListener() {
515 public void widgetDefaultSelected(SelectionEvent e) {
518 public void widgetSelected(SelectionEvent e) {
519 PreferenceConverter.setValue(
521 PreferenceConstants.EDITOR_BACKGROUND_COLOR,
522 fBackgroundColorEditor.getColorValue());
526 fBoldCheckBox.addSelectionListener(new SelectionListener() {
527 public void widgetDefaultSelected(SelectionEvent e) {
530 public void widgetSelected(SelectionEvent e) {
531 int i = fSyntaxColorList.getSelectionIndex();
532 String key = fSyntaxColorListModel[i][1];
533 fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
537 return colorComposite;
540 private Control createPreviewer(Composite parent) {
542 fJavaTextTools = new JavaTextTools(fOverlayStore);
544 fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
545 fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
546 fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
547 fPreviewViewer.setEditable(false);
549 initializeViewerColors(fPreviewViewer);
551 String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
552 IDocument document = new Document(content);
553 // PHPEditorEnvironment pe;
554 IDocumentPartitioner partitioner = fJavaTextTools.createDocumentPartitioner();
555 partitioner.connect(document);
556 document.setDocumentPartitioner(partitioner);
558 fPreviewViewer.setDocument(document);
560 fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
561 public void propertyChange(PropertyChangeEvent event) {
562 String p = event.getProperty();
563 if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
564 || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
565 initializeViewerColors(fPreviewViewer);
568 fPreviewViewer.invalidateTextPresentation();
572 return fPreviewViewer.getControl();
576 * Initializes the given viewer's colors.
578 * @param viewer the viewer to be initialized
580 private void initializeViewerColors(ISourceViewer viewer) {
582 IPreferenceStore store = fOverlayStore;
585 StyledText styledText = viewer.getTextWidget();
587 // ---------- background color ----------------------
589 store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
591 : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
592 styledText.setBackground(color);
594 if (fBackgroundColor != null)
595 fBackgroundColor.dispose();
597 fBackgroundColor = color;
602 * Creates a color from the information stored in the given preference store.
603 * Returns <code>null</code> if there is no such information available.
605 private Color createColor(IPreferenceStore store, String key, Display display) {
609 if (store.contains(key)) {
611 if (store.isDefault(key))
612 rgb = PreferenceConverter.getDefaultColor(store, key);
614 rgb = PreferenceConverter.getColor(store, key);
617 return new Color(display, rgb);
623 // sets enabled flag for a control and all its sub-tree
624 private static void setEnabled(Control control, boolean enable) {
625 control.setEnabled(enable);
626 if (control instanceof Composite) {
627 Composite composite = (Composite) control;
628 Control[] children = composite.getChildren();
629 for (int i = 0; i < children.length; i++)
630 setEnabled(children[i], enable);
634 private Control createAppearancePage(Composite parent) {
636 Composite appearanceComposite = new Composite(parent, SWT.NONE);
637 GridLayout layout = new GridLayout();
638 layout.numColumns = 2;
639 appearanceComposite.setLayout(layout);
641 String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
642 addTextFontEditor(appearanceComposite, label, AbstractTextEditor.PREFERENCE_FONT);
644 label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
645 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
647 label = PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
648 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
650 // label= PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor"); //$NON-NLS-1$
651 // addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
653 label = PHPUIMessages.getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
654 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
656 label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
657 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
659 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
660 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
662 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
663 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_CURRENT_LINE, 0);
665 label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
666 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
668 Label l = new Label(appearanceComposite, SWT.LEFT);
669 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
670 gd.horizontalSpan = 2;
671 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
674 l = new Label(appearanceComposite, SWT.LEFT);
675 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
676 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
677 gd.horizontalSpan = 2;
680 Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
681 layout = new GridLayout();
682 layout.numColumns = 2;
683 layout.marginHeight = 0;
684 layout.marginWidth = 0;
685 editorComposite.setLayout(layout);
686 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
687 gd.horizontalSpan = 2;
688 editorComposite.setLayoutData(gd);
690 fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
691 gd = new GridData(GridData.FILL_BOTH);
692 gd.heightHint = convertHeightInCharsToPixels(5);
693 fAppearanceColorList.setLayoutData(gd);
695 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
696 layout = new GridLayout();
697 layout.marginHeight = 0;
698 layout.marginWidth = 0;
699 layout.numColumns = 2;
700 stylesComposite.setLayout(layout);
701 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
703 l = new Label(stylesComposite, SWT.LEFT);
704 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
706 gd.horizontalAlignment = GridData.BEGINNING;
709 fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
710 Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
711 gd = new GridData(GridData.FILL_HORIZONTAL);
712 gd.horizontalAlignment = GridData.BEGINNING;
713 foregroundColorButton.setLayoutData(gd);
715 fAppearanceColorList.addSelectionListener(new SelectionListener() {
716 public void widgetDefaultSelected(SelectionEvent e) {
719 public void widgetSelected(SelectionEvent e) {
720 handleAppearanceColorListSelection();
723 foregroundColorButton.addSelectionListener(new SelectionListener() {
724 public void widgetDefaultSelected(SelectionEvent e) {
727 public void widgetSelected(SelectionEvent e) {
728 int i = fAppearanceColorList.getSelectionIndex();
729 String key = fAppearanceColorListModel[i][1];
731 PreferenceConverter.setValue(fOverlayStore, key, fAppearanceForegroundColorEditor.getColorValue());
734 return appearanceComposite;
737 private Control createProblemIndicationPage(Composite parent) {
738 Composite composite = new Composite(parent, SWT.NULL);
739 GridLayout layout = new GridLayout();
740 layout.numColumns = 2;
741 composite.setLayout(layout);
743 // String text = "Analyse &problems while typing";
744 // addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
746 // text = PHPUIMessages.getString("PHPEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
747 // addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
749 Label label = new Label(composite, SWT.LEFT);
750 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
751 gd.horizontalSpan = 2;
752 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
753 label.setLayoutData(gd);
755 label = new Label(composite, SWT.LEFT);
756 label.setText("&Marker presentation options:");
757 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
758 gd.horizontalSpan = 2;
759 label.setLayoutData(gd);
761 Composite editorComposite = new Composite(composite, SWT.NONE);
762 layout = new GridLayout();
763 layout.numColumns = 2;
764 layout.marginHeight = 0;
765 layout.marginWidth = 0;
766 editorComposite.setLayout(layout);
767 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
768 gd.horizontalSpan = 2;
769 editorComposite.setLayoutData(gd);
771 fProblemIndicationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
772 gd = new GridData(GridData.FILL_BOTH);
773 gd.heightHint = convertHeightInCharsToPixels(5);
774 fProblemIndicationList.setLayoutData(gd);
776 Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
777 layout = new GridLayout();
778 layout.marginHeight = 0;
779 layout.marginWidth = 0;
780 layout.numColumns = 2;
781 optionsComposite.setLayout(layout);
782 optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
784 fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
785 fShowInTextCheckBox.setText("Show in &text");
786 gd = new GridData(GridData.FILL_HORIZONTAL);
787 gd.horizontalAlignment = GridData.BEGINNING;
788 gd.horizontalSpan = 2;
789 fShowInTextCheckBox.setLayoutData(gd);
791 fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
792 fShowInOverviewRulerCheckBox.setText("Show in overview &ruler");
793 gd = new GridData(GridData.FILL_HORIZONTAL);
794 gd.horizontalAlignment = GridData.BEGINNING;
795 gd.horizontalSpan = 2;
796 fShowInOverviewRulerCheckBox.setLayoutData(gd);
798 label = new Label(optionsComposite, SWT.LEFT);
799 label.setText("C&olor:");
801 gd.horizontalAlignment = GridData.BEGINNING;
802 label.setLayoutData(gd);
804 fProblemIndicationForegroundColorEditor = new ColorEditor(optionsComposite);
805 Button foregroundColorButton = fProblemIndicationForegroundColorEditor.getButton();
806 gd = new GridData(GridData.FILL_HORIZONTAL);
807 gd.horizontalAlignment = GridData.BEGINNING;
808 foregroundColorButton.setLayoutData(gd);
810 fProblemIndicationList.addSelectionListener(new SelectionListener() {
811 public void widgetDefaultSelected(SelectionEvent e) {
815 public void widgetSelected(SelectionEvent e) {
816 handleProblemIndicationColorListSelection();
820 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
821 public void widgetDefaultSelected(SelectionEvent e) {
825 public void widgetSelected(SelectionEvent e) {
826 int i = fProblemIndicationList.getSelectionIndex();
827 String key = fProblemIndicationColorListModel[i][2];
828 fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
832 fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
833 public void widgetDefaultSelected(SelectionEvent e) {
837 public void widgetSelected(SelectionEvent e) {
838 int i = fProblemIndicationList.getSelectionIndex();
839 String key = fProblemIndicationColorListModel[i][3];
840 fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
844 foregroundColorButton.addSelectionListener(new SelectionListener() {
845 public void widgetDefaultSelected(SelectionEvent e) {
849 public void widgetSelected(SelectionEvent e) {
850 int i = fProblemIndicationList.getSelectionIndex();
851 String key = fProblemIndicationColorListModel[i][1];
852 PreferenceConverter.setValue(fOverlayStore, key, fProblemIndicationForegroundColorEditor.getColorValue());
859 private Control createBehaviourPage(Composite parent) {
860 Composite composite= new Composite(parent, SWT.NULL);
861 GridLayout layout= new GridLayout(); layout.numColumns= 2;
862 composite.setLayout(layout);
864 // String label= PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
865 // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
867 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
868 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
870 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste"); //$NON-NLS-1$
871 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
873 label= PHPUIMessages.getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
874 addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
876 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsPHP"); //$NON-NLS-1$
877 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP, 1);
879 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsPHP"); //$NON-NLS-1$
880 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
882 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces"); //$NON-NLS-1$
883 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
885 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs"); //$NON-NLS-1$
886 // Button button= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
888 // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags"); //$NON-NLS-1$
889 // fAddJavaDocTagsButton= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
890 // createDependency(button, fAddJavaDocTagsButton);
892 // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs"); //$NON-NLS-1$
893 // addCheckBox(composite, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
895 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsHTML"); //$NON-NLS-1$
896 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
898 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
899 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
903 private static void indent(Control control) {
904 GridData gridData = new GridData();
905 gridData.horizontalIndent = 20;
906 control.setLayoutData(gridData);
909 private static void createDependency(final Button master, final Control slave) {
911 master.addSelectionListener(new SelectionListener() {
912 public void widgetSelected(SelectionEvent e) {
913 slave.setEnabled(master.getSelection());
916 public void widgetDefaultSelected(SelectionEvent e) {
921 private Control createContentAssistPage(Composite parent) {
923 Composite contentAssistComposite = new Composite(parent, SWT.NULL);
924 GridLayout layout = new GridLayout();
925 layout.numColumns = 2;
926 contentAssistComposite.setLayout(layout);
928 // String label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
929 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
931 // label = PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
932 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
934 // label = PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
935 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
937 // label = PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
938 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
940 // label = PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion"); //$NON-NLS-1$
941 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
943 // label = PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
944 // Button button = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
946 // label = PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
947 // fGuessMethodArgumentsButton =
948 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
949 // createDependency(button, fGuessMethodArgumentsButton);
951 label = PHPUIMessages.getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
952 final Button autoactivation = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
954 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
955 fAutoInsertDelayText =
956 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
958 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
959 fAutoInsertJavaTriggerText =
960 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
962 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
963 fAutoInsertJavaDocTriggerText =
964 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
966 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
967 fAutoInsertHTMLTriggerText =
968 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
970 label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
971 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
973 label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
974 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
976 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters"); //$NON-NLS-1$
977 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
979 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters"); //$NON-NLS-1$
980 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
982 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement"); //$NON-NLS-1$
983 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
985 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement"); //$NON-NLS-1$
986 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
988 autoactivation.addSelectionListener(new SelectionAdapter() {
989 public void widgetSelected(SelectionEvent e) {
990 updateAutoactivationControls();
993 return contentAssistComposite;
997 * @see PreferencePage#createContents(Composite)
999 protected Control createContents(Composite parent) {
1001 fOverlayStore.load();
1002 fOverlayStore.start();
1004 TabFolder folder = new TabFolder(parent, SWT.NONE);
1005 folder.setLayout(new TabFolderLayout());
1006 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
1008 TabItem item = new TabItem(folder, SWT.NONE);
1009 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
1010 item.setControl(createAppearancePage(folder));
1012 item = new TabItem(folder, SWT.NONE);
1013 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
1014 item.setControl(createSyntaxPage(folder));
1016 item = new TabItem(folder, SWT.NONE);
1017 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
1018 item.setControl(createContentAssistPage(folder));
1020 item = new TabItem(folder, SWT.NONE);
1021 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.problemIndicationTab.title")); //$NON-NLS-1$
1022 item.setControl(createProblemIndicationPage(folder));
1024 item= new TabItem(folder, SWT.NONE);
1025 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
1026 item.setControl(createBehaviourPage(folder));
1028 // item= new TabItem(folder, SWT.NONE);
1029 // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
1030 // fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(fOverlayStore);
1031 // item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
1038 private void initialize() {
1040 fFontEditor.setPreferenceStore(getPreferenceStore());
1041 fFontEditor.setPreferencePage(this);
1046 for (int i = 0; i < fSyntaxColorListModel.length; i++)
1047 fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
1049 fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
1051 if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
1052 fSyntaxColorList.select(0);
1053 handleSyntaxColorListSelection();
1058 for (int i = 0; i < fAppearanceColorListModel.length; i++)
1059 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1061 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1063 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1064 fAppearanceColorList.select(0);
1065 handleAppearanceColorListSelection();
1070 for (int i = 0; i < fProblemIndicationColorListModel.length; i++)
1071 fProblemIndicationList.add(fProblemIndicationColorListModel[i][0]);
1073 fProblemIndicationList.getDisplay().asyncExec(new Runnable() {
1075 if (fProblemIndicationList != null && !fProblemIndicationList.isDisposed()) {
1076 fProblemIndicationList.select(0);
1077 handleProblemIndicationColorListSelection();
1083 private void initializeFields() {
1085 Iterator e = fColorButtons.keySet().iterator();
1086 while (e.hasNext()) {
1087 ColorEditor c = (ColorEditor) e.next();
1088 String key = (String) fColorButtons.get(c);
1089 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
1090 c.setColorValue(rgb);
1093 e = fCheckBoxes.keySet().iterator();
1094 while (e.hasNext()) {
1095 Button b = (Button) e.next();
1096 String key = (String) fCheckBoxes.get(b);
1097 b.setSelection(fOverlayStore.getBoolean(key));
1100 e = fTextFields.keySet().iterator();
1101 while (e.hasNext()) {
1102 Text t = (Text) e.next();
1103 String key = (String) fTextFields.get(t);
1104 t.setText(fOverlayStore.getString(key));
1107 RGB rgb = PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
1108 fBackgroundColorEditor.setColorValue(rgb);
1110 boolean default_ = fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
1111 fBackgroundDefaultRadioButton.setSelection(default_);
1112 fBackgroundCustomRadioButton.setSelection(!default_);
1113 fBackgroundColorButton.setEnabled(!default_);
1115 // boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
1116 // fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
1118 // boolean fillMethodArguments = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
1119 // fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
1121 updateAutoactivationControls();
1123 // fJavaEditorHoverConfigurationBlock.initializeFields();
1126 private void updateAutoactivationControls() {
1127 boolean autoactivation = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
1128 fAutoInsertDelayText.setEnabled(autoactivation);
1129 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
1130 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
1131 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
1135 * @see PreferencePage#performOk()
1137 public boolean performOk() {
1138 fFontEditor.store();
1139 // fJavaEditorHoverConfigurationBlock.performOk();
1140 fOverlayStore.propagate();
1141 // fUserDefinedPHPSyntaxFileFFE.store();
1142 PHPeclipsePlugin.getDefault().savePluginPreferences();
1147 * @see PreferencePage#performDefaults()
1149 protected void performDefaults() {
1151 fFontEditor.loadDefault();
1153 fOverlayStore.loadDefaults();
1156 // fUserDefinedPHPSyntaxFileFFE.loadDefault();
1157 handleSyntaxColorListSelection();
1158 handleAppearanceColorListSelection();
1159 handleProblemIndicationColorListSelection();
1160 super.performDefaults();
1162 fPreviewViewer.invalidateTextPresentation();
1166 * @see DialogPage#dispose()
1168 public void dispose() {
1170 if (fJavaTextTools != null) {
1171 fJavaTextTools = null;
1174 fFontEditor.setPreferencePage(null);
1175 fFontEditor.setPreferenceStore(null);
1177 if (fOverlayStore != null) {
1178 fOverlayStore.stop();
1179 fOverlayStore = null;
1185 private Control addColorButton(Composite composite, String label, String key, int indentation) {
1187 Label labelControl = new Label(composite, SWT.NONE);
1188 labelControl.setText(label);
1190 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1191 gd.horizontalIndent = indentation;
1192 labelControl.setLayoutData(gd);
1194 ColorEditor editor = new ColorEditor(composite);
1195 Button button = editor.getButton();
1196 button.setData(editor);
1198 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1199 button.setLayoutData(gd);
1200 button.addSelectionListener(fColorButtonListener);
1202 fColorButtons.put(editor, key);
1207 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
1208 Button checkBox = new Button(parent, SWT.CHECK);
1209 checkBox.setText(label);
1211 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1212 gd.horizontalIndent = indentation;
1213 gd.horizontalSpan = 2;
1214 checkBox.setLayoutData(gd);
1215 checkBox.addSelectionListener(fCheckBoxListener);
1217 fCheckBoxes.put(checkBox, key);
1222 private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
1224 Label labelControl = new Label(composite, SWT.NONE);
1225 labelControl.setText(label);
1226 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1227 gd.horizontalIndent = indentation;
1228 labelControl.setLayoutData(gd);
1230 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
1231 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1232 gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
1233 textControl.setLayoutData(gd);
1234 textControl.setTextLimit(textLimit);
1235 fTextFields.put(textControl, key);
1237 fNumberFields.add(textControl);
1238 textControl.addModifyListener(fNumberFieldListener);
1240 textControl.addModifyListener(fTextFieldListener);
1246 private void addTextFontEditor(Composite parent, String label, String key) {
1248 Composite editorComposite = new Composite(parent, SWT.NONE);
1249 GridLayout layout = new GridLayout();
1250 layout.numColumns = 3;
1251 editorComposite.setLayout(layout);
1252 fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label, editorComposite);
1253 fFontEditor.setChangeButtonText(PHPUIMessages.getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
1255 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1256 gd.horizontalSpan = 2;
1257 editorComposite.setLayoutData(gd);
1260 private String loadPreviewContentFromFile(String filename) {
1262 String separator = System.getProperty("line.separator"); //$NON-NLS-1$
1263 StringBuffer buffer = new StringBuffer(512);
1264 BufferedReader reader = null;
1266 reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
1267 while ((line = reader.readLine()) != null) {
1268 buffer.append(line);
1269 buffer.append(separator);
1271 } catch (IOException io) {
1272 PHPeclipsePlugin.log(io);
1274 if (reader != null) {
1277 } catch (IOException e) {
1281 return buffer.toString();
1284 private void numberFieldChanged(Text textControl) {
1285 String number = textControl.getText();
1286 IStatus status = validatePositiveNumber(number);
1287 if (!status.matches(IStatus.ERROR))
1288 fOverlayStore.setValue((String) fTextFields.get(textControl), number);
1289 updateStatus(status);
1292 private IStatus validatePositiveNumber(String number) {
1293 StatusInfo status = new StatusInfo();
1294 if (number.length() == 0) {
1295 status.setError(PHPUIMessages.getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
1298 int value = Integer.parseInt(number);
1300 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1301 } catch (NumberFormatException e) {
1302 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1308 private void updateStatus(IStatus status) {
1309 if (!status.matches(IStatus.ERROR)) {
1310 for (int i = 0; i < fNumberFields.size(); i++) {
1311 Text text = (Text) fNumberFields.get(i);
1312 IStatus s = validatePositiveNumber(text.getText());
1313 status = StatusUtil.getMoreSevere(s, status);
1316 setValid(!status.matches(IStatus.ERROR));
1317 StatusUtil.applyToStatusLine(this, status);
1321 * @deprecated Inline to avoid reference to preference page
1323 public static boolean indicateQuixFixableProblems() {
1324 return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
1328 * @deprecated Inline to avoid reference to preference page
1330 // static public boolean synchronizeOutlineOnCursorMove() {
1331 // return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);