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;
33 import org.eclipse.core.runtime.IStatus;
34 import org.eclipse.jface.preference.IPreferenceStore;
35 import org.eclipse.jface.preference.PreferenceConverter;
36 import org.eclipse.jface.preference.PreferencePage;
37 import org.eclipse.jface.resource.JFaceResources;
38 import org.eclipse.jface.text.Document;
39 import org.eclipse.jface.text.IDocument;
40 import org.eclipse.jface.text.IDocumentPartitioner;
41 import org.eclipse.jface.text.source.ISourceViewer;
42 import org.eclipse.jface.text.source.SourceViewer;
43 import org.eclipse.jface.util.IPropertyChangeListener;
44 import org.eclipse.jface.util.PropertyChangeEvent;
45 import org.eclipse.swt.SWT;
46 import org.eclipse.swt.custom.StyledText;
47 import org.eclipse.swt.events.ModifyEvent;
48 import org.eclipse.swt.events.ModifyListener;
49 import org.eclipse.swt.events.SelectionAdapter;
50 import org.eclipse.swt.events.SelectionEvent;
51 import org.eclipse.swt.events.SelectionListener;
52 import org.eclipse.swt.graphics.Color;
53 import org.eclipse.swt.graphics.RGB;
54 import org.eclipse.swt.layout.GridData;
55 import org.eclipse.swt.layout.GridLayout;
56 import org.eclipse.swt.layout.RowLayout;
57 import org.eclipse.swt.widgets.Button;
58 import org.eclipse.swt.widgets.Composite;
59 import org.eclipse.swt.widgets.Control;
60 import org.eclipse.swt.widgets.Display;
61 import org.eclipse.swt.widgets.Group;
62 import org.eclipse.swt.widgets.Label;
63 import org.eclipse.swt.widgets.List;
64 import org.eclipse.swt.widgets.TabFolder;
65 import org.eclipse.swt.widgets.TabItem;
66 import org.eclipse.swt.widgets.Text;
67 import org.eclipse.ui.IWorkbench;
68 import org.eclipse.ui.IWorkbenchPreferencePage;
69 import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
72 * The page for setting the editor options.
74 public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
76 private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
78 public final OverlayPreferenceStore.OverlayKey[] fKeys =
79 new OverlayPreferenceStore.OverlayKey[] {
80 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FOREGROUND_COLOR),
81 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
82 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BACKGROUND_COLOR),
83 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
84 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH),
85 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
86 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
87 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
88 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
89 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_TAG_COLOR),
90 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_TAG_BOLD),
91 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
92 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
93 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
94 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
95 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
96 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
97 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
98 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
99 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
100 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
101 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
102 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
103 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
104 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
105 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
106 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
107 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR),
108 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
109 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
110 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
111 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
112 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
113 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
114 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
115 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
116 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CURRENT_LINE),
117 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
118 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
119 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PRINT_MARGIN),
120 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
121 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
122 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR),
123 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
124 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PROBLEM_INDICATION),
125 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
126 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WARNING_INDICATION),
127 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
128 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION),
129 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
130 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
131 new OverlayPreferenceStore.OverlayKey(
132 OverlayPreferenceStore.STRING,
133 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
134 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
135 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
136 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
137 new OverlayPreferenceStore.OverlayKey(
138 OverlayPreferenceStore.BOOLEAN,
139 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
140 new OverlayPreferenceStore.OverlayKey(
141 OverlayPreferenceStore.BOOLEAN,
142 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
143 new OverlayPreferenceStore.OverlayKey(
144 OverlayPreferenceStore.BOOLEAN,
145 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
146 new OverlayPreferenceStore.OverlayKey(
147 OverlayPreferenceStore.BOOLEAN,
148 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
149 new OverlayPreferenceStore.OverlayKey(
150 OverlayPreferenceStore.BOOLEAN,
151 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
152 new OverlayPreferenceStore.OverlayKey(
153 OverlayPreferenceStore.BOOLEAN,
154 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
155 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION),
156 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
157 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
158 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_OVERVIEW_RULER),
159 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
160 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
161 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS),
162 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION),
163 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
164 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT),
165 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
166 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
167 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
168 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
169 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
170 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
171 new OverlayPreferenceStore.OverlayKey(
172 OverlayPreferenceStore.STRING,
173 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
174 new OverlayPreferenceStore.OverlayKey(
175 OverlayPreferenceStore.STRING,
176 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
177 new OverlayPreferenceStore.OverlayKey(
178 OverlayPreferenceStore.STRING,
179 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
180 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
181 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
182 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
183 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT),
184 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
185 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
186 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
187 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
188 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
189 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
190 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
191 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
192 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
193 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
194 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
195 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END),
196 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
197 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
198 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_DEFAULT_HOVER),
199 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_NONE_HOVER),
200 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_HOVER),
201 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SHIFT_HOVER),
202 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
203 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
204 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
205 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
206 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
207 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
210 private final String[][] fSyntaxColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
212 PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
214 PHPUIMessages.getString("PHPEditorPreferencePage.tags"), PreferenceConstants.EDITOR_JAVA_TAG_COLOR }, //$NON-NLS-1$
216 PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
218 PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
220 PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
222 PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
224 PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
226 PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
228 PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
230 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
232 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$
234 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
236 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
239 private final String[][] fAppearanceColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, //$NON-NLS-1$
241 PHPUIMessages.getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$
243 PHPUIMessages.getString("PHPEditorPreferencePage.currentLineHighlighColor"), PreferenceConstants.EDITOR_CURRENT_LINE_COLOR }, //$NON-NLS-1$
245 PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"), PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR }, //$NON-NLS-1$
247 PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR }, //$NON-NLS-1$
249 PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"), PreferenceConstants.EDITOR_LINKED_POSITION_COLOR }, //$NON-NLS-1$
251 PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR }, //$NON-NLS-1$
254 private final String[][] fProblemIndicationColorListModel =
258 PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
259 PreferenceConstants.EDITOR_PROBLEM_INDICATION,
260 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
263 PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
264 PreferenceConstants.EDITOR_WARNING_INDICATION,
265 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
268 PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
269 PreferenceConstants.EDITOR_TASK_INDICATION,
270 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
273 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
274 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
275 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
278 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
279 PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
280 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
283 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
284 PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
285 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
288 private OverlayPreferenceStore fOverlayStore;
289 private JavaTextTools fJavaTextTools;
290 // private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
292 private Map fColorButtons = new HashMap();
293 private SelectionListener fColorButtonListener = new SelectionListener() {
294 public void widgetDefaultSelected(SelectionEvent e) {
296 public void widgetSelected(SelectionEvent e) {
297 ColorEditor editor = (ColorEditor) e.widget.getData();
298 PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons.get(editor), editor.getColorValue());
302 private Map fCheckBoxes = new HashMap();
303 private SelectionListener fCheckBoxListener = new SelectionListener() {
304 public void widgetDefaultSelected(SelectionEvent e) {
306 public void widgetSelected(SelectionEvent e) {
307 Button button = (Button) e.widget;
308 fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
312 private Map fTextFields = new HashMap();
313 private ModifyListener fTextFieldListener = new ModifyListener() {
314 public void modifyText(ModifyEvent e) {
315 Text text = (Text) e.widget;
316 fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
320 private ArrayList fNumberFields = new ArrayList();
321 private ModifyListener fNumberFieldListener = new ModifyListener() {
322 public void modifyText(ModifyEvent e) {
323 numberFieldChanged((Text) e.widget);
327 private WorkbenchChainedTextFontFieldEditor fFontEditor;
328 private List fSyntaxColorList;
329 private List fAppearanceColorList;
330 private List fProblemIndicationList;
331 private ColorEditor fSyntaxForegroundColorEditor;
332 private ColorEditor fAppearanceForegroundColorEditor;
333 private ColorEditor fProblemIndicationForegroundColorEditor;
334 private ColorEditor fBackgroundColorEditor;
335 private Button fBackgroundDefaultRadioButton;
336 private Button fBackgroundCustomRadioButton;
337 private Button fBackgroundColorButton;
338 private Button fBoldCheckBox;
339 //private Button fAddJavaDocTagsButton;
340 // private Button fGuessMethodArgumentsButton;
341 private SourceViewer fPreviewViewer;
342 private Color fBackgroundColor;
343 private Control fAutoInsertDelayText;
344 private Control fAutoInsertJavaTriggerText;
345 private Control fAutoInsertJavaDocTriggerText;
346 private Control fAutoInsertHTMLTriggerText;
347 private Button fShowInTextCheckBox;
348 private Button fShowInOverviewRulerCheckBox;
349 // private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
351 public PHPEditorPreferencePage() {
352 setDescription(PHPUIMessages.getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
353 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
354 fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
358 * @see IWorkbenchPreferencePage#init()
360 public void init(IWorkbench workbench) {
364 * @see PreferencePage#createControl(Composite)
366 public void createControl(Composite parent) {
367 super.createControl(parent);
368 // WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
371 private void handleSyntaxColorListSelection() {
372 int i = fSyntaxColorList.getSelectionIndex();
373 String key = fSyntaxColorListModel[i][1];
374 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
375 fSyntaxForegroundColorEditor.setColorValue(rgb);
376 fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
379 private void handleAppearanceColorListSelection() {
380 int i = fAppearanceColorList.getSelectionIndex();
381 String key = fAppearanceColorListModel[i][1];
382 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
383 fAppearanceForegroundColorEditor.setColorValue(rgb);
386 private void handleProblemIndicationColorListSelection() {
387 int i = fProblemIndicationList.getSelectionIndex();
389 String key = fProblemIndicationColorListModel[i][1];
390 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
391 fProblemIndicationForegroundColorEditor.setColorValue(rgb);
393 key = fProblemIndicationColorListModel[i][2];
394 fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
396 key = fProblemIndicationColorListModel[i][3];
397 fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
400 private Control createSyntaxPage(Composite parent) {
402 Composite colorComposite = new Composite(parent, SWT.NULL);
403 colorComposite.setLayout(new GridLayout());
405 Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
406 backgroundComposite.setLayout(new RowLayout());
407 backgroundComposite.setText(PHPUIMessages.getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
409 SelectionListener backgroundSelectionListener = new SelectionListener() {
410 public void widgetSelected(SelectionEvent e) {
411 boolean custom = fBackgroundCustomRadioButton.getSelection();
412 fBackgroundColorButton.setEnabled(custom);
413 fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
415 public void widgetDefaultSelected(SelectionEvent e) {
419 fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
420 fBackgroundDefaultRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
421 fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
423 fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
424 fBackgroundCustomRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
425 fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
427 fBackgroundColorEditor = new ColorEditor(backgroundComposite);
428 fBackgroundColorButton = fBackgroundColorEditor.getButton();
430 // fUserDefinedPHPSyntaxFileFFE =
431 // new FileFieldEditor(
432 // IPreferenceConstants.PHP_USERDEF_XMLFILE,
433 // PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
435 // fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
436 // fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
437 // fUserDefinedPHPSyntaxFileFFE.load();
439 Label label = new Label(colorComposite, SWT.LEFT);
440 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
441 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
443 Composite editorComposite = new Composite(colorComposite, SWT.NONE);
444 GridLayout layout = new GridLayout();
445 layout.numColumns = 2;
446 layout.marginHeight = 0;
447 layout.marginWidth = 0;
448 editorComposite.setLayout(layout);
449 GridData gd = new GridData(GridData.FILL_BOTH);
450 editorComposite.setLayoutData(gd);
452 fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
453 gd = new GridData(GridData.FILL_BOTH);
454 gd.heightHint = convertHeightInCharsToPixels(5);
455 fSyntaxColorList.setLayoutData(gd);
457 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
458 layout = new GridLayout();
459 layout.marginHeight = 0;
460 layout.marginWidth = 0;
461 layout.numColumns = 2;
462 stylesComposite.setLayout(layout);
463 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
465 label = new Label(stylesComposite, SWT.LEFT);
466 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
468 gd.horizontalAlignment = GridData.BEGINNING;
469 label.setLayoutData(gd);
471 fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
472 Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
473 gd = new GridData(GridData.FILL_HORIZONTAL);
474 gd.horizontalAlignment = GridData.BEGINNING;
475 foregroundColorButton.setLayoutData(gd);
477 fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
478 fBoldCheckBox.setText(PHPUIMessages.getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
479 gd = new GridData(GridData.FILL_HORIZONTAL);
480 gd.horizontalAlignment = GridData.BEGINNING;
481 gd.horizontalSpan = 2;
482 fBoldCheckBox.setLayoutData(gd);
484 label = new Label(colorComposite, SWT.LEFT);
485 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
486 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
488 Control previewer = createPreviewer(colorComposite);
489 gd = new GridData(GridData.FILL_BOTH);
490 gd.widthHint = convertWidthInCharsToPixels(20);
491 gd.heightHint = convertHeightInCharsToPixels(5);
492 previewer.setLayoutData(gd);
494 fSyntaxColorList.addSelectionListener(new SelectionListener() {
495 public void widgetDefaultSelected(SelectionEvent e) {
498 public void widgetSelected(SelectionEvent e) {
499 handleSyntaxColorListSelection();
503 foregroundColorButton.addSelectionListener(new SelectionListener() {
504 public void widgetDefaultSelected(SelectionEvent e) {
507 public void widgetSelected(SelectionEvent e) {
508 int i = fSyntaxColorList.getSelectionIndex();
509 String key = fSyntaxColorListModel[i][1];
511 PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
515 fBackgroundColorButton.addSelectionListener(new SelectionListener() {
516 public void widgetDefaultSelected(SelectionEvent e) {
519 public void widgetSelected(SelectionEvent e) {
520 PreferenceConverter.setValue(
522 PreferenceConstants.EDITOR_BACKGROUND_COLOR,
523 fBackgroundColorEditor.getColorValue());
527 fBoldCheckBox.addSelectionListener(new SelectionListener() {
528 public void widgetDefaultSelected(SelectionEvent e) {
531 public void widgetSelected(SelectionEvent e) {
532 int i = fSyntaxColorList.getSelectionIndex();
533 String key = fSyntaxColorListModel[i][1];
534 fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
538 return colorComposite;
541 private Control createPreviewer(Composite parent) {
543 fJavaTextTools = new JavaTextTools(fOverlayStore);
545 fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
546 fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
547 fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
548 fPreviewViewer.setEditable(false);
550 initializeViewerColors(fPreviewViewer);
552 String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
553 IDocument document = new Document(content);
554 // PHPEditorEnvironment pe;
555 IDocumentPartitioner partitioner = fJavaTextTools.createDocumentPartitioner();
556 partitioner.connect(document);
557 document.setDocumentPartitioner(partitioner);
559 fPreviewViewer.setDocument(document);
561 fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
562 public void propertyChange(PropertyChangeEvent event) {
563 String p = event.getProperty();
564 if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
565 || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
566 initializeViewerColors(fPreviewViewer);
569 fPreviewViewer.invalidateTextPresentation();
573 return fPreviewViewer.getControl();
577 * Initializes the given viewer's colors.
579 * @param viewer the viewer to be initialized
581 private void initializeViewerColors(ISourceViewer viewer) {
583 IPreferenceStore store = fOverlayStore;
586 StyledText styledText = viewer.getTextWidget();
588 // ---------- background color ----------------------
590 store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
592 : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
593 styledText.setBackground(color);
595 if (fBackgroundColor != null)
596 fBackgroundColor.dispose();
598 fBackgroundColor = color;
603 * Creates a color from the information stored in the given preference store.
604 * Returns <code>null</code> if there is no such information available.
606 private Color createColor(IPreferenceStore store, String key, Display display) {
610 if (store.contains(key)) {
612 if (store.isDefault(key))
613 rgb = PreferenceConverter.getDefaultColor(store, key);
615 rgb = PreferenceConverter.getColor(store, key);
618 return new Color(display, rgb);
624 // sets enabled flag for a control and all its sub-tree
625 private static void setEnabled(Control control, boolean enable) {
626 control.setEnabled(enable);
627 if (control instanceof Composite) {
628 Composite composite = (Composite) control;
629 Control[] children = composite.getChildren();
630 for (int i = 0; i < children.length; i++)
631 setEnabled(children[i], enable);
635 private Control createAppearancePage(Composite parent) {
637 Composite appearanceComposite = new Composite(parent, SWT.NONE);
638 GridLayout layout = new GridLayout();
639 layout.numColumns = 2;
640 appearanceComposite.setLayout(layout);
642 String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
643 addTextFontEditor(appearanceComposite, label, JFaceResources.TEXT_FONT);
645 label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
646 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
648 label = PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
649 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
651 // label= PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor"); //$NON-NLS-1$
652 // addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
654 label = PHPUIMessages.getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
655 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
657 label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
658 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
660 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
661 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
663 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
664 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_CURRENT_LINE, 0);
666 label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
667 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
669 Label l = new Label(appearanceComposite, SWT.LEFT);
670 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
671 gd.horizontalSpan = 2;
672 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
675 l = new Label(appearanceComposite, SWT.LEFT);
676 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
677 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
678 gd.horizontalSpan = 2;
681 Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
682 layout = new GridLayout();
683 layout.numColumns = 2;
684 layout.marginHeight = 0;
685 layout.marginWidth = 0;
686 editorComposite.setLayout(layout);
687 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
688 gd.horizontalSpan = 2;
689 editorComposite.setLayoutData(gd);
691 fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
692 gd = new GridData(GridData.FILL_BOTH);
693 gd.heightHint = convertHeightInCharsToPixels(5);
694 fAppearanceColorList.setLayoutData(gd);
696 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
697 layout = new GridLayout();
698 layout.marginHeight = 0;
699 layout.marginWidth = 0;
700 layout.numColumns = 2;
701 stylesComposite.setLayout(layout);
702 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
704 l = new Label(stylesComposite, SWT.LEFT);
705 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
707 gd.horizontalAlignment = GridData.BEGINNING;
710 fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
711 Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
712 gd = new GridData(GridData.FILL_HORIZONTAL);
713 gd.horizontalAlignment = GridData.BEGINNING;
714 foregroundColorButton.setLayoutData(gd);
716 fAppearanceColorList.addSelectionListener(new SelectionListener() {
717 public void widgetDefaultSelected(SelectionEvent e) {
720 public void widgetSelected(SelectionEvent e) {
721 handleAppearanceColorListSelection();
724 foregroundColorButton.addSelectionListener(new SelectionListener() {
725 public void widgetDefaultSelected(SelectionEvent e) {
728 public void widgetSelected(SelectionEvent e) {
729 int i = fAppearanceColorList.getSelectionIndex();
730 String key = fAppearanceColorListModel[i][1];
732 PreferenceConverter.setValue(fOverlayStore, key, fAppearanceForegroundColorEditor.getColorValue());
735 return appearanceComposite;
738 private Control createProblemIndicationPage(Composite parent) {
739 Composite composite = new Composite(parent, SWT.NULL);
740 GridLayout layout = new GridLayout();
741 layout.numColumns = 2;
742 composite.setLayout(layout);
744 // String text = "Analyse &problems while typing";
745 // addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
747 // text = PHPUIMessages.getString("PHPEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
748 // addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
750 Label label = new Label(composite, SWT.LEFT);
751 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
752 gd.horizontalSpan = 2;
753 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
754 label.setLayoutData(gd);
756 label = new Label(composite, SWT.LEFT);
757 label.setText("&Marker presentation options:");
758 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
759 gd.horizontalSpan = 2;
760 label.setLayoutData(gd);
762 Composite editorComposite = new Composite(composite, SWT.NONE);
763 layout = new GridLayout();
764 layout.numColumns = 2;
765 layout.marginHeight = 0;
766 layout.marginWidth = 0;
767 editorComposite.setLayout(layout);
768 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
769 gd.horizontalSpan = 2;
770 editorComposite.setLayoutData(gd);
772 fProblemIndicationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
773 gd = new GridData(GridData.FILL_BOTH);
774 gd.heightHint = convertHeightInCharsToPixels(5);
775 fProblemIndicationList.setLayoutData(gd);
777 Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
778 layout = new GridLayout();
779 layout.marginHeight = 0;
780 layout.marginWidth = 0;
781 layout.numColumns = 2;
782 optionsComposite.setLayout(layout);
783 optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
785 fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
786 fShowInTextCheckBox.setText("Show in &text");
787 gd = new GridData(GridData.FILL_HORIZONTAL);
788 gd.horizontalAlignment = GridData.BEGINNING;
789 gd.horizontalSpan = 2;
790 fShowInTextCheckBox.setLayoutData(gd);
792 fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
793 fShowInOverviewRulerCheckBox.setText("Show in overview &ruler");
794 gd = new GridData(GridData.FILL_HORIZONTAL);
795 gd.horizontalAlignment = GridData.BEGINNING;
796 gd.horizontalSpan = 2;
797 fShowInOverviewRulerCheckBox.setLayoutData(gd);
799 label = new Label(optionsComposite, SWT.LEFT);
800 label.setText("C&olor:");
802 gd.horizontalAlignment = GridData.BEGINNING;
803 label.setLayoutData(gd);
805 fProblemIndicationForegroundColorEditor = new ColorEditor(optionsComposite);
806 Button foregroundColorButton = fProblemIndicationForegroundColorEditor.getButton();
807 gd = new GridData(GridData.FILL_HORIZONTAL);
808 gd.horizontalAlignment = GridData.BEGINNING;
809 foregroundColorButton.setLayoutData(gd);
811 fProblemIndicationList.addSelectionListener(new SelectionListener() {
812 public void widgetDefaultSelected(SelectionEvent e) {
816 public void widgetSelected(SelectionEvent e) {
817 handleProblemIndicationColorListSelection();
821 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
822 public void widgetDefaultSelected(SelectionEvent e) {
826 public void widgetSelected(SelectionEvent e) {
827 int i = fProblemIndicationList.getSelectionIndex();
828 String key = fProblemIndicationColorListModel[i][2];
829 fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
833 fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
834 public void widgetDefaultSelected(SelectionEvent e) {
838 public void widgetSelected(SelectionEvent e) {
839 int i = fProblemIndicationList.getSelectionIndex();
840 String key = fProblemIndicationColorListModel[i][3];
841 fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
845 foregroundColorButton.addSelectionListener(new SelectionListener() {
846 public void widgetDefaultSelected(SelectionEvent e) {
850 public void widgetSelected(SelectionEvent e) {
851 int i = fProblemIndicationList.getSelectionIndex();
852 String key = fProblemIndicationColorListModel[i][1];
853 PreferenceConverter.setValue(fOverlayStore, key, fProblemIndicationForegroundColorEditor.getColorValue());
860 private Control createBehaviourPage(Composite parent) {
861 Composite composite= new Composite(parent, SWT.NULL);
862 GridLayout layout= new GridLayout(); layout.numColumns= 2;
863 composite.setLayout(layout);
865 // String label= PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
866 // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
868 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
869 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
871 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste"); //$NON-NLS-1$
872 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
874 label= PHPUIMessages.getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
875 addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
877 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsPHP"); //$NON-NLS-1$
878 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP, 1);
880 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsPHP"); //$NON-NLS-1$
881 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
883 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces"); //$NON-NLS-1$
884 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
886 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs"); //$NON-NLS-1$
887 // Button button= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
889 // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags"); //$NON-NLS-1$
890 // fAddJavaDocTagsButton= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
891 // createDependency(button, fAddJavaDocTagsButton);
893 // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs"); //$NON-NLS-1$
894 // addCheckBox(composite, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
896 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsHTML"); //$NON-NLS-1$
897 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
899 label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
900 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
904 private static void indent(Control control) {
905 GridData gridData = new GridData();
906 gridData.horizontalIndent = 20;
907 control.setLayoutData(gridData);
910 private static void createDependency(final Button master, final Control slave) {
912 master.addSelectionListener(new SelectionListener() {
913 public void widgetSelected(SelectionEvent e) {
914 slave.setEnabled(master.getSelection());
917 public void widgetDefaultSelected(SelectionEvent e) {
922 private Control createContentAssistPage(Composite parent) {
924 Composite contentAssistComposite = new Composite(parent, SWT.NULL);
925 GridLayout layout = new GridLayout();
926 layout.numColumns = 2;
927 contentAssistComposite.setLayout(layout);
929 // String label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
930 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
932 // label = PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
933 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
935 // label = PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
936 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
938 // label = PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
939 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
941 // label = PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion"); //$NON-NLS-1$
942 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
944 // label = PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
945 // Button button = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
947 // label = PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
948 // fGuessMethodArgumentsButton =
949 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
950 // createDependency(button, fGuessMethodArgumentsButton);
952 label = PHPUIMessages.getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
953 final Button autoactivation = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
955 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
956 fAutoInsertDelayText =
957 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
959 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
960 fAutoInsertJavaTriggerText =
961 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
963 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
964 fAutoInsertJavaDocTriggerText =
965 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
967 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
968 fAutoInsertHTMLTriggerText =
969 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
971 label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
972 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
974 label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
975 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
977 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters"); //$NON-NLS-1$
978 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
980 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters"); //$NON-NLS-1$
981 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
983 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement"); //$NON-NLS-1$
984 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
986 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement"); //$NON-NLS-1$
987 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
989 autoactivation.addSelectionListener(new SelectionAdapter() {
990 public void widgetSelected(SelectionEvent e) {
991 updateAutoactivationControls();
994 return contentAssistComposite;
998 * @see PreferencePage#createContents(Composite)
1000 protected Control createContents(Composite parent) {
1002 fOverlayStore.load();
1003 fOverlayStore.start();
1005 TabFolder folder = new TabFolder(parent, SWT.NONE);
1006 folder.setLayout(new TabFolderLayout());
1007 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
1009 TabItem item = new TabItem(folder, SWT.NONE);
1010 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
1011 item.setControl(createAppearancePage(folder));
1013 item = new TabItem(folder, SWT.NONE);
1014 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
1015 item.setControl(createSyntaxPage(folder));
1017 item = new TabItem(folder, SWT.NONE);
1018 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
1019 item.setControl(createContentAssistPage(folder));
1021 item = new TabItem(folder, SWT.NONE);
1022 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.problemIndicationTab.title")); //$NON-NLS-1$
1023 item.setControl(createProblemIndicationPage(folder));
1025 item= new TabItem(folder, SWT.NONE);
1026 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
1027 item.setControl(createBehaviourPage(folder));
1029 // item= new TabItem(folder, SWT.NONE);
1030 // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
1031 // fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(fOverlayStore);
1032 // item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
1039 private void initialize() {
1041 fFontEditor.setPreferenceStore(getPreferenceStore());
1042 fFontEditor.setPreferencePage(this);
1047 for (int i = 0; i < fSyntaxColorListModel.length; i++)
1048 fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
1050 fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
1052 if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
1053 fSyntaxColorList.select(0);
1054 handleSyntaxColorListSelection();
1059 for (int i = 0; i < fAppearanceColorListModel.length; i++)
1060 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1062 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1064 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1065 fAppearanceColorList.select(0);
1066 handleAppearanceColorListSelection();
1071 for (int i = 0; i < fProblemIndicationColorListModel.length; i++)
1072 fProblemIndicationList.add(fProblemIndicationColorListModel[i][0]);
1074 fProblemIndicationList.getDisplay().asyncExec(new Runnable() {
1076 if (fProblemIndicationList != null && !fProblemIndicationList.isDisposed()) {
1077 fProblemIndicationList.select(0);
1078 handleProblemIndicationColorListSelection();
1084 private void initializeFields() {
1086 Iterator e = fColorButtons.keySet().iterator();
1087 while (e.hasNext()) {
1088 ColorEditor c = (ColorEditor) e.next();
1089 String key = (String) fColorButtons.get(c);
1090 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
1091 c.setColorValue(rgb);
1094 e = fCheckBoxes.keySet().iterator();
1095 while (e.hasNext()) {
1096 Button b = (Button) e.next();
1097 String key = (String) fCheckBoxes.get(b);
1098 b.setSelection(fOverlayStore.getBoolean(key));
1101 e = fTextFields.keySet().iterator();
1102 while (e.hasNext()) {
1103 Text t = (Text) e.next();
1104 String key = (String) fTextFields.get(t);
1105 t.setText(fOverlayStore.getString(key));
1108 RGB rgb = PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
1109 fBackgroundColorEditor.setColorValue(rgb);
1111 boolean default_ = fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
1112 fBackgroundDefaultRadioButton.setSelection(default_);
1113 fBackgroundCustomRadioButton.setSelection(!default_);
1114 fBackgroundColorButton.setEnabled(!default_);
1116 // boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
1117 // fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
1119 // boolean fillMethodArguments = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
1120 // fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
1122 updateAutoactivationControls();
1124 // fJavaEditorHoverConfigurationBlock.initializeFields();
1127 private void updateAutoactivationControls() {
1128 boolean autoactivation = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
1129 fAutoInsertDelayText.setEnabled(autoactivation);
1130 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
1131 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
1132 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
1136 * @see PreferencePage#performOk()
1138 public boolean performOk() {
1139 fFontEditor.store();
1140 // fJavaEditorHoverConfigurationBlock.performOk();
1141 fOverlayStore.propagate();
1142 // fUserDefinedPHPSyntaxFileFFE.store();
1143 PHPeclipsePlugin.getDefault().savePluginPreferences();
1148 * @see PreferencePage#performDefaults()
1150 protected void performDefaults() {
1152 fFontEditor.loadDefault();
1154 fOverlayStore.loadDefaults();
1157 // fUserDefinedPHPSyntaxFileFFE.loadDefault();
1158 handleSyntaxColorListSelection();
1159 handleAppearanceColorListSelection();
1160 handleProblemIndicationColorListSelection();
1161 super.performDefaults();
1163 fPreviewViewer.invalidateTextPresentation();
1167 * @see DialogPage#dispose()
1169 public void dispose() {
1171 if (fJavaTextTools != null) {
1172 fJavaTextTools = null;
1175 fFontEditor.setPreferencePage(null);
1176 fFontEditor.setPreferenceStore(null);
1178 if (fOverlayStore != null) {
1179 fOverlayStore.stop();
1180 fOverlayStore = null;
1186 private Control addColorButton(Composite composite, String label, String key, int indentation) {
1188 Label labelControl = new Label(composite, SWT.NONE);
1189 labelControl.setText(label);
1191 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1192 gd.horizontalIndent = indentation;
1193 labelControl.setLayoutData(gd);
1195 ColorEditor editor = new ColorEditor(composite);
1196 Button button = editor.getButton();
1197 button.setData(editor);
1199 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1200 button.setLayoutData(gd);
1201 button.addSelectionListener(fColorButtonListener);
1203 fColorButtons.put(editor, key);
1208 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
1209 Button checkBox = new Button(parent, SWT.CHECK);
1210 checkBox.setText(label);
1212 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1213 gd.horizontalIndent = indentation;
1214 gd.horizontalSpan = 2;
1215 checkBox.setLayoutData(gd);
1216 checkBox.addSelectionListener(fCheckBoxListener);
1218 fCheckBoxes.put(checkBox, key);
1223 private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
1225 Label labelControl = new Label(composite, SWT.NONE);
1226 labelControl.setText(label);
1227 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1228 gd.horizontalIndent = indentation;
1229 labelControl.setLayoutData(gd);
1231 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
1232 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1233 gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
1234 textControl.setLayoutData(gd);
1235 textControl.setTextLimit(textLimit);
1236 fTextFields.put(textControl, key);
1238 fNumberFields.add(textControl);
1239 textControl.addModifyListener(fNumberFieldListener);
1241 textControl.addModifyListener(fTextFieldListener);
1247 private void addTextFontEditor(Composite parent, String label, String key) {
1249 Composite editorComposite = new Composite(parent, SWT.NONE);
1250 GridLayout layout = new GridLayout();
1251 layout.numColumns = 3;
1252 editorComposite.setLayout(layout);
1253 fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label, editorComposite);
1254 fFontEditor.setChangeButtonText(PHPUIMessages.getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
1256 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1257 gd.horizontalSpan = 2;
1258 editorComposite.setLayoutData(gd);
1261 private String loadPreviewContentFromFile(String filename) {
1263 String separator = System.getProperty("line.separator"); //$NON-NLS-1$
1264 StringBuffer buffer = new StringBuffer(512);
1265 BufferedReader reader = null;
1267 reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
1268 while ((line = reader.readLine()) != null) {
1269 buffer.append(line);
1270 buffer.append(separator);
1272 } catch (IOException io) {
1273 PHPeclipsePlugin.log(io);
1275 if (reader != null) {
1278 } catch (IOException e) {
1282 return buffer.toString();
1285 private void numberFieldChanged(Text textControl) {
1286 String number = textControl.getText();
1287 IStatus status = validatePositiveNumber(number);
1288 if (!status.matches(IStatus.ERROR))
1289 fOverlayStore.setValue((String) fTextFields.get(textControl), number);
1290 updateStatus(status);
1293 private IStatus validatePositiveNumber(String number) {
1294 StatusInfo status = new StatusInfo();
1295 if (number.length() == 0) {
1296 status.setError(PHPUIMessages.getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
1299 int value = Integer.parseInt(number);
1301 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1302 } catch (NumberFormatException e) {
1303 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1309 private void updateStatus(IStatus status) {
1310 if (!status.matches(IStatus.ERROR)) {
1311 for (int i = 0; i < fNumberFields.size(); i++) {
1312 Text text = (Text) fNumberFields.get(i);
1313 IStatus s = validatePositiveNumber(text.getText());
1314 status = StatusUtil.getMoreSevere(s, status);
1317 setValid(!status.matches(IStatus.ERROR));
1318 StatusUtil.applyToStatusLine(this, status);
1322 * @deprecated Inline to avoid reference to preference page
1324 public static boolean indicateQuixFixableProblems() {
1325 return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
1329 * @deprecated Inline to avoid reference to preference page
1331 // static public boolean synchronizeOutlineOnCursorMove() {
1332 // return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);