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.PHPCore;
30 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
31 import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
32 import net.sourceforge.phpeclipse.preferences.ColorEditor;
34 import org.eclipse.core.runtime.IStatus;
35 import org.eclipse.core.runtime.Preferences;
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.WorkbenchChainedTextFontFieldEditor;
74 * The page for setting the editor options.
76 public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
78 private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
79 private static final String COMPILER_TASK_TAGS = PHPCore.COMPILER_TASK_TAGS;
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_TAG_COLOR),
93 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_TAG_BOLD),
94 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
95 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
96 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
97 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
98 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
99 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
100 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
101 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
102 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
103 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
104 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
105 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
106 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
107 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
108 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
109 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
110 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR),
111 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
112 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
113 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
114 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
115 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
116 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
117 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
118 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
119 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CURRENT_LINE),
120 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
121 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
122 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PRINT_MARGIN),
123 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
124 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
125 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR),
126 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
127 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PROBLEM_INDICATION),
128 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
129 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WARNING_INDICATION),
130 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
131 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION),
132 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
133 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
134 new OverlayPreferenceStore.OverlayKey(
135 OverlayPreferenceStore.STRING,
136 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
137 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
138 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
139 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
140 new OverlayPreferenceStore.OverlayKey(
141 OverlayPreferenceStore.BOOLEAN,
142 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
143 new OverlayPreferenceStore.OverlayKey(
144 OverlayPreferenceStore.BOOLEAN,
145 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
146 new OverlayPreferenceStore.OverlayKey(
147 OverlayPreferenceStore.BOOLEAN,
148 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
149 new OverlayPreferenceStore.OverlayKey(
150 OverlayPreferenceStore.BOOLEAN,
151 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
152 new OverlayPreferenceStore.OverlayKey(
153 OverlayPreferenceStore.BOOLEAN,
154 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
155 new OverlayPreferenceStore.OverlayKey(
156 OverlayPreferenceStore.BOOLEAN,
157 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
158 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION),
159 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
160 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
161 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_OVERVIEW_RULER),
162 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
163 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
164 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS),
165 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION),
166 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
167 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT),
168 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
169 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
170 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
171 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
172 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
173 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
174 new OverlayPreferenceStore.OverlayKey(
175 OverlayPreferenceStore.STRING,
176 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
177 new OverlayPreferenceStore.OverlayKey(
178 OverlayPreferenceStore.STRING,
179 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
180 new OverlayPreferenceStore.OverlayKey(
181 OverlayPreferenceStore.STRING,
182 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
183 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
184 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
185 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
186 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT),
187 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
188 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
189 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
190 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
191 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
192 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
193 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
194 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
195 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
196 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
197 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
198 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END),
199 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
200 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
201 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_DEFAULT_HOVER),
202 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_NONE_HOVER),
203 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_HOVER),
204 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SHIFT_HOVER),
205 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
206 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
207 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
208 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
209 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
210 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
213 private final String[][] fSyntaxColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
215 PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
217 PHPUIMessages.getString("PHPEditorPreferencePage.tags"), PreferenceConstants.EDITOR_JAVA_TAG_COLOR }, //$NON-NLS-1$
219 PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
221 PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
223 PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
225 PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
227 PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
229 PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
231 PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
233 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
235 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$
237 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
239 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
242 private final String[][] fAppearanceColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, //$NON-NLS-1$
244 PHPUIMessages.getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$
246 PHPUIMessages.getString("PHPEditorPreferencePage.currentLineHighlighColor"), PreferenceConstants.EDITOR_CURRENT_LINE_COLOR }, //$NON-NLS-1$
248 PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"), PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR }, //$NON-NLS-1$
250 PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR }, //$NON-NLS-1$
252 PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"), PreferenceConstants.EDITOR_LINKED_POSITION_COLOR }, //$NON-NLS-1$
254 PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR }, //$NON-NLS-1$
257 private final String[][] fProblemIndicationColorListModel =
261 PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
262 PreferenceConstants.EDITOR_PROBLEM_INDICATION,
263 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
266 PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
267 PreferenceConstants.EDITOR_WARNING_INDICATION,
268 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
271 PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
272 PreferenceConstants.EDITOR_TASK_INDICATION,
273 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
276 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
277 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
278 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
281 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
282 PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
283 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
286 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
287 PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
288 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
291 private OverlayPreferenceStore fOverlayStore;
292 private JavaTextTools fJavaTextTools;
293 // private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
295 private Map fColorButtons = new HashMap();
296 private SelectionListener fColorButtonListener = new SelectionListener() {
297 public void widgetDefaultSelected(SelectionEvent e) {
299 public void widgetSelected(SelectionEvent e) {
300 ColorEditor editor = (ColorEditor) e.widget.getData();
301 PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons.get(editor), editor.getColorValue());
305 private Map fCheckBoxes = new HashMap();
306 private SelectionListener fCheckBoxListener = new SelectionListener() {
307 public void widgetDefaultSelected(SelectionEvent e) {
309 public void widgetSelected(SelectionEvent e) {
310 Button button = (Button) e.widget;
311 fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
315 private Map fTextFields = new HashMap();
316 private ModifyListener fTextFieldListener = new ModifyListener() {
317 public void modifyText(ModifyEvent e) {
318 Text text = (Text) e.widget;
319 fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
323 private ArrayList fNumberFields = new ArrayList();
324 private ModifyListener fNumberFieldListener = new ModifyListener() {
325 public void modifyText(ModifyEvent e) {
326 numberFieldChanged((Text) e.widget);
330 private WorkbenchChainedTextFontFieldEditor fFontEditor;
331 private List fSyntaxColorList;
332 private List fAppearanceColorList;
333 private List fProblemIndicationList;
334 private ColorEditor fSyntaxForegroundColorEditor;
335 private ColorEditor fAppearanceForegroundColorEditor;
336 private ColorEditor fProblemIndicationForegroundColorEditor;
337 private ColorEditor fBackgroundColorEditor;
338 private Button fBackgroundDefaultRadioButton;
339 private Button fBackgroundCustomRadioButton;
340 private Button fBackgroundColorButton;
341 private Button fBoldCheckBox;
342 //private Button fAddJavaDocTagsButton;
343 // private Button fGuessMethodArgumentsButton;
344 private SourceViewer fPreviewViewer;
345 private Color fBackgroundColor;
346 private Control fAutoInsertDelayText;
347 private Control fAutoInsertJavaTriggerText;
348 private Control fAutoInsertJavaDocTriggerText;
349 private Control fAutoInsertHTMLTriggerText;
350 private Button fShowInTextCheckBox;
351 private Button fShowInOverviewRulerCheckBox;
352 // private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
354 public PHPEditorPreferencePage() {
355 setDescription(PHPUIMessages.getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
356 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
357 fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
361 * @see IWorkbenchPreferencePage#init()
363 public void init(IWorkbench workbench) {
367 * @see PreferencePage#createControl(Composite)
369 public void createControl(Composite parent) {
370 super.createControl(parent);
371 // WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
374 private void handleSyntaxColorListSelection() {
375 int i = fSyntaxColorList.getSelectionIndex();
376 String key = fSyntaxColorListModel[i][1];
377 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
378 fSyntaxForegroundColorEditor.setColorValue(rgb);
379 fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
382 private void handleAppearanceColorListSelection() {
383 int i = fAppearanceColorList.getSelectionIndex();
384 String key = fAppearanceColorListModel[i][1];
385 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
386 fAppearanceForegroundColorEditor.setColorValue(rgb);
389 private void handleProblemIndicationColorListSelection() {
390 int i = fProblemIndicationList.getSelectionIndex();
392 String key = fProblemIndicationColorListModel[i][1];
393 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
394 fProblemIndicationForegroundColorEditor.setColorValue(rgb);
396 key = fProblemIndicationColorListModel[i][2];
397 fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
399 key = fProblemIndicationColorListModel[i][3];
400 fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
403 private Control createSyntaxPage(Composite parent) {
405 Composite colorComposite = new Composite(parent, SWT.NULL);
406 colorComposite.setLayout(new GridLayout());
408 Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
409 backgroundComposite.setLayout(new RowLayout());
410 backgroundComposite.setText(PHPUIMessages.getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
412 SelectionListener backgroundSelectionListener = new SelectionListener() {
413 public void widgetSelected(SelectionEvent e) {
414 boolean custom = fBackgroundCustomRadioButton.getSelection();
415 fBackgroundColorButton.setEnabled(custom);
416 fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
418 public void widgetDefaultSelected(SelectionEvent e) {
422 fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
423 fBackgroundDefaultRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
424 fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
426 fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
427 fBackgroundCustomRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
428 fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
430 fBackgroundColorEditor = new ColorEditor(backgroundComposite);
431 fBackgroundColorButton = fBackgroundColorEditor.getButton();
433 // fUserDefinedPHPSyntaxFileFFE =
434 // new FileFieldEditor(
435 // IPreferenceConstants.PHP_USERDEF_XMLFILE,
436 // PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
438 // fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
439 // fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
440 // fUserDefinedPHPSyntaxFileFFE.load();
442 Label label = new Label(colorComposite, SWT.LEFT);
443 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
444 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
446 Composite editorComposite = new Composite(colorComposite, SWT.NONE);
447 GridLayout layout = new GridLayout();
448 layout.numColumns = 2;
449 layout.marginHeight = 0;
450 layout.marginWidth = 0;
451 editorComposite.setLayout(layout);
452 GridData gd = new GridData(GridData.FILL_BOTH);
453 editorComposite.setLayoutData(gd);
455 fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
456 gd = new GridData(GridData.FILL_BOTH);
457 gd.heightHint = convertHeightInCharsToPixels(5);
458 fSyntaxColorList.setLayoutData(gd);
460 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
461 layout = new GridLayout();
462 layout.marginHeight = 0;
463 layout.marginWidth = 0;
464 layout.numColumns = 2;
465 stylesComposite.setLayout(layout);
466 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
468 label = new Label(stylesComposite, SWT.LEFT);
469 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
471 gd.horizontalAlignment = GridData.BEGINNING;
472 label.setLayoutData(gd);
474 fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
475 Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
476 gd = new GridData(GridData.FILL_HORIZONTAL);
477 gd.horizontalAlignment = GridData.BEGINNING;
478 foregroundColorButton.setLayoutData(gd);
480 fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
481 fBoldCheckBox.setText(PHPUIMessages.getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
482 gd = new GridData(GridData.FILL_HORIZONTAL);
483 gd.horizontalAlignment = GridData.BEGINNING;
484 gd.horizontalSpan = 2;
485 fBoldCheckBox.setLayoutData(gd);
487 label = new Label(colorComposite, SWT.LEFT);
488 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
489 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
491 Control previewer = createPreviewer(colorComposite);
492 gd = new GridData(GridData.FILL_BOTH);
493 gd.widthHint = convertWidthInCharsToPixels(20);
494 gd.heightHint = convertHeightInCharsToPixels(5);
495 previewer.setLayoutData(gd);
497 fSyntaxColorList.addSelectionListener(new SelectionListener() {
498 public void widgetDefaultSelected(SelectionEvent e) {
501 public void widgetSelected(SelectionEvent e) {
502 handleSyntaxColorListSelection();
506 foregroundColorButton.addSelectionListener(new SelectionListener() {
507 public void widgetDefaultSelected(SelectionEvent e) {
510 public void widgetSelected(SelectionEvent e) {
511 int i = fSyntaxColorList.getSelectionIndex();
512 String key = fSyntaxColorListModel[i][1];
514 PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
518 fBackgroundColorButton.addSelectionListener(new SelectionListener() {
519 public void widgetDefaultSelected(SelectionEvent e) {
522 public void widgetSelected(SelectionEvent e) {
523 PreferenceConverter.setValue(
525 PreferenceConstants.EDITOR_BACKGROUND_COLOR,
526 fBackgroundColorEditor.getColorValue());
530 fBoldCheckBox.addSelectionListener(new SelectionListener() {
531 public void widgetDefaultSelected(SelectionEvent e) {
534 public void widgetSelected(SelectionEvent e) {
535 int i = fSyntaxColorList.getSelectionIndex();
536 String key = fSyntaxColorListModel[i][1];
537 fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
541 return colorComposite;
544 private Control createPreviewer(Composite parent) {
545 Preferences coreStore = createTemporaryCorePreferenceStore();
547 fJavaTextTools = new JavaTextTools(fOverlayStore, coreStore, false);
549 fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
550 fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
551 fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
552 fPreviewViewer.setEditable(false);
554 initializeViewerColors(fPreviewViewer);
556 String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
557 IDocument document = new Document(content);
558 // PHPEditorEnvironment pe;
559 IDocumentPartitioner partitioner = fJavaTextTools.createDocumentPartitioner();
560 partitioner.connect(document);
561 document.setDocumentPartitioner(partitioner);
563 fPreviewViewer.setDocument(document);
565 fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
566 public void propertyChange(PropertyChangeEvent event) {
567 String p = event.getProperty();
568 if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
569 || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
570 initializeViewerColors(fPreviewViewer);
573 fPreviewViewer.invalidateTextPresentation();
577 return fPreviewViewer.getControl();
579 private Preferences createTemporaryCorePreferenceStore() {
580 Preferences result = new Preferences();
582 result.setValue(COMPILER_TASK_TAGS, "TASK"); //$NON-NLS-1$
587 * Initializes the given viewer's colors.
589 * @param viewer the viewer to be initialized
591 private void initializeViewerColors(ISourceViewer viewer) {
593 IPreferenceStore store = fOverlayStore;
596 StyledText styledText = viewer.getTextWidget();
598 // ---------- background color ----------------------
600 store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
602 : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
603 styledText.setBackground(color);
605 if (fBackgroundColor != null)
606 fBackgroundColor.dispose();
608 fBackgroundColor = color;
613 * Creates a color from the information stored in the given preference store.
614 * Returns <code>null</code> if there is no such information available.
616 private Color createColor(IPreferenceStore store, String key, Display display) {
620 if (store.contains(key)) {
622 if (store.isDefault(key))
623 rgb = PreferenceConverter.getDefaultColor(store, key);
625 rgb = PreferenceConverter.getColor(store, key);
628 return new Color(display, rgb);
634 // sets enabled flag for a control and all its sub-tree
635 private static void setEnabled(Control control, boolean enable) {
636 control.setEnabled(enable);
637 if (control instanceof Composite) {
638 Composite composite = (Composite) control;
639 Control[] children = composite.getChildren();
640 for (int i = 0; i < children.length; i++)
641 setEnabled(children[i], enable);
645 private Control createAppearancePage(Composite parent) {
647 Composite appearanceComposite = new Composite(parent, SWT.NONE);
648 GridLayout layout = new GridLayout();
649 layout.numColumns = 2;
650 appearanceComposite.setLayout(layout);
652 String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
653 addTextFontEditor(appearanceComposite, label, JFaceResources.TEXT_FONT);
655 label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
656 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
658 label = PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
659 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
661 // label= PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor"); //$NON-NLS-1$
662 // addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
664 label = PHPUIMessages.getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
665 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
667 label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
668 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
670 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
671 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
673 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
674 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_CURRENT_LINE, 0);
676 label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
677 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
679 Label l = new Label(appearanceComposite, SWT.LEFT);
680 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
681 gd.horizontalSpan = 2;
682 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
685 l = new Label(appearanceComposite, SWT.LEFT);
686 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
687 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
688 gd.horizontalSpan = 2;
691 Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
692 layout = new GridLayout();
693 layout.numColumns = 2;
694 layout.marginHeight = 0;
695 layout.marginWidth = 0;
696 editorComposite.setLayout(layout);
697 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
698 gd.horizontalSpan = 2;
699 editorComposite.setLayoutData(gd);
701 fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
702 gd = new GridData(GridData.FILL_BOTH);
703 gd.heightHint = convertHeightInCharsToPixels(5);
704 fAppearanceColorList.setLayoutData(gd);
706 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
707 layout = new GridLayout();
708 layout.marginHeight = 0;
709 layout.marginWidth = 0;
710 layout.numColumns = 2;
711 stylesComposite.setLayout(layout);
712 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
714 l = new Label(stylesComposite, SWT.LEFT);
715 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
717 gd.horizontalAlignment = GridData.BEGINNING;
720 fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
721 Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
722 gd = new GridData(GridData.FILL_HORIZONTAL);
723 gd.horizontalAlignment = GridData.BEGINNING;
724 foregroundColorButton.setLayoutData(gd);
726 fAppearanceColorList.addSelectionListener(new SelectionListener() {
727 public void widgetDefaultSelected(SelectionEvent e) {
730 public void widgetSelected(SelectionEvent e) {
731 handleAppearanceColorListSelection();
734 foregroundColorButton.addSelectionListener(new SelectionListener() {
735 public void widgetDefaultSelected(SelectionEvent e) {
738 public void widgetSelected(SelectionEvent e) {
739 int i = fAppearanceColorList.getSelectionIndex();
740 String key = fAppearanceColorListModel[i][1];
742 PreferenceConverter.setValue(fOverlayStore, key, fAppearanceForegroundColorEditor.getColorValue());
745 return appearanceComposite;
748 private Control createProblemIndicationPage(Composite parent) {
749 Composite composite = new Composite(parent, SWT.NULL);
750 GridLayout layout = new GridLayout();
751 layout.numColumns = 2;
752 composite.setLayout(layout);
754 // String text = "Analyse &problems while typing";
755 // addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
757 // text = PHPUIMessages.getString("PHPEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
758 // addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
760 Label label = new Label(composite, SWT.LEFT);
761 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
762 gd.horizontalSpan = 2;
763 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
764 label.setLayoutData(gd);
766 label = new Label(composite, SWT.LEFT);
767 label.setText("&Marker presentation options:");
768 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
769 gd.horizontalSpan = 2;
770 label.setLayoutData(gd);
772 Composite editorComposite = new Composite(composite, SWT.NONE);
773 layout = new GridLayout();
774 layout.numColumns = 2;
775 layout.marginHeight = 0;
776 layout.marginWidth = 0;
777 editorComposite.setLayout(layout);
778 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
779 gd.horizontalSpan = 2;
780 editorComposite.setLayoutData(gd);
782 fProblemIndicationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
783 gd = new GridData(GridData.FILL_BOTH);
784 gd.heightHint = convertHeightInCharsToPixels(5);
785 fProblemIndicationList.setLayoutData(gd);
787 Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
788 layout = new GridLayout();
789 layout.marginHeight = 0;
790 layout.marginWidth = 0;
791 layout.numColumns = 2;
792 optionsComposite.setLayout(layout);
793 optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
795 fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
796 fShowInTextCheckBox.setText("Show in &text");
797 gd = new GridData(GridData.FILL_HORIZONTAL);
798 gd.horizontalAlignment = GridData.BEGINNING;
799 gd.horizontalSpan = 2;
800 fShowInTextCheckBox.setLayoutData(gd);
802 fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
803 fShowInOverviewRulerCheckBox.setText("Show in overview &ruler");
804 gd = new GridData(GridData.FILL_HORIZONTAL);
805 gd.horizontalAlignment = GridData.BEGINNING;
806 gd.horizontalSpan = 2;
807 fShowInOverviewRulerCheckBox.setLayoutData(gd);
809 label = new Label(optionsComposite, SWT.LEFT);
810 label.setText("C&olor:");
812 gd.horizontalAlignment = GridData.BEGINNING;
813 label.setLayoutData(gd);
815 fProblemIndicationForegroundColorEditor = new ColorEditor(optionsComposite);
816 Button foregroundColorButton = fProblemIndicationForegroundColorEditor.getButton();
817 gd = new GridData(GridData.FILL_HORIZONTAL);
818 gd.horizontalAlignment = GridData.BEGINNING;
819 foregroundColorButton.setLayoutData(gd);
821 fProblemIndicationList.addSelectionListener(new SelectionListener() {
822 public void widgetDefaultSelected(SelectionEvent e) {
826 public void widgetSelected(SelectionEvent e) {
827 handleProblemIndicationColorListSelection();
831 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
832 public void widgetDefaultSelected(SelectionEvent e) {
836 public void widgetSelected(SelectionEvent e) {
837 int i = fProblemIndicationList.getSelectionIndex();
838 String key = fProblemIndicationColorListModel[i][2];
839 fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
843 fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
844 public void widgetDefaultSelected(SelectionEvent e) {
848 public void widgetSelected(SelectionEvent e) {
849 int i = fProblemIndicationList.getSelectionIndex();
850 String key = fProblemIndicationColorListModel[i][3];
851 fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
855 foregroundColorButton.addSelectionListener(new SelectionListener() {
856 public void widgetDefaultSelected(SelectionEvent e) {
860 public void widgetSelected(SelectionEvent e) {
861 int i = fProblemIndicationList.getSelectionIndex();
862 String key = fProblemIndicationColorListModel[i][1];
863 PreferenceConverter.setValue(fOverlayStore, key, fProblemIndicationForegroundColorEditor.getColorValue());
870 private Control createBehaviourPage(Composite parent) {
871 Composite composite = new Composite(parent, SWT.NULL);
872 GridLayout layout = new GridLayout();
873 layout.numColumns = 2;
874 composite.setLayout(layout);
876 // String label= PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
877 // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
879 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
880 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
882 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste"); //$NON-NLS-1$
883 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
885 label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
886 addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
888 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsPHP"); //$NON-NLS-1$
889 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP, 1);
891 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsPHP"); //$NON-NLS-1$
892 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
894 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces"); //$NON-NLS-1$
895 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
897 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs"); //$NON-NLS-1$
898 // Button button= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
900 // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags"); //$NON-NLS-1$
901 // fAddJavaDocTagsButton= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
902 // createDependency(button, fAddJavaDocTagsButton);
904 // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs"); //$NON-NLS-1$
905 // addCheckBox(composite, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
907 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsHTML"); //$NON-NLS-1$
908 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
910 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
911 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
915 private static void indent(Control control) {
916 GridData gridData = new GridData();
917 gridData.horizontalIndent = 20;
918 control.setLayoutData(gridData);
921 private static void createDependency(final Button master, final Control slave) {
923 master.addSelectionListener(new SelectionListener() {
924 public void widgetSelected(SelectionEvent e) {
925 slave.setEnabled(master.getSelection());
928 public void widgetDefaultSelected(SelectionEvent e) {
933 private Control createContentAssistPage(Composite parent) {
935 Composite contentAssistComposite = new Composite(parent, SWT.NULL);
936 GridLayout layout = new GridLayout();
937 layout.numColumns = 2;
938 contentAssistComposite.setLayout(layout);
940 // String label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
941 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
943 // label = PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
944 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
946 // label = PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
947 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
949 // label = PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
950 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
952 // label = PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion"); //$NON-NLS-1$
953 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
955 // label = PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
956 // Button button = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
958 // label = PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
959 // fGuessMethodArgumentsButton =
960 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
961 // createDependency(button, fGuessMethodArgumentsButton);
963 label = PHPUIMessages.getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
964 final Button autoactivation = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
966 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
967 fAutoInsertDelayText =
968 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
970 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
971 fAutoInsertJavaTriggerText =
972 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
974 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
975 fAutoInsertJavaDocTriggerText =
976 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
978 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
979 fAutoInsertHTMLTriggerText =
980 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
982 label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
983 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
985 label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
986 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
988 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters"); //$NON-NLS-1$
989 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
991 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters"); //$NON-NLS-1$
992 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
994 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement"); //$NON-NLS-1$
995 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
997 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement"); //$NON-NLS-1$
998 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
1000 autoactivation.addSelectionListener(new SelectionAdapter() {
1001 public void widgetSelected(SelectionEvent e) {
1002 updateAutoactivationControls();
1005 return contentAssistComposite;
1009 * @see PreferencePage#createContents(Composite)
1011 protected Control createContents(Composite parent) {
1013 fOverlayStore.load();
1014 fOverlayStore.start();
1016 TabFolder folder = new TabFolder(parent, SWT.NONE);
1017 folder.setLayout(new TabFolderLayout());
1018 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
1020 TabItem item = new TabItem(folder, SWT.NONE);
1021 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
1022 item.setControl(createAppearancePage(folder));
1024 item = new TabItem(folder, SWT.NONE);
1025 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
1026 item.setControl(createSyntaxPage(folder));
1028 item = new TabItem(folder, SWT.NONE);
1029 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
1030 item.setControl(createContentAssistPage(folder));
1032 item = new TabItem(folder, SWT.NONE);
1033 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.problemIndicationTab.title")); //$NON-NLS-1$
1034 item.setControl(createProblemIndicationPage(folder));
1036 item = new TabItem(folder, SWT.NONE);
1037 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
1038 item.setControl(createBehaviourPage(folder));
1040 // item= new TabItem(folder, SWT.NONE);
1041 // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
1042 // fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(fOverlayStore);
1043 // item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
1050 private void initialize() {
1052 fFontEditor.setPreferenceStore(getPreferenceStore());
1053 fFontEditor.setPreferencePage(this);
1058 for (int i = 0; i < fSyntaxColorListModel.length; i++)
1059 fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
1061 fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
1063 if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
1064 fSyntaxColorList.select(0);
1065 handleSyntaxColorListSelection();
1070 for (int i = 0; i < fAppearanceColorListModel.length; i++)
1071 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1073 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1075 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1076 fAppearanceColorList.select(0);
1077 handleAppearanceColorListSelection();
1082 for (int i = 0; i < fProblemIndicationColorListModel.length; i++)
1083 fProblemIndicationList.add(fProblemIndicationColorListModel[i][0]);
1085 fProblemIndicationList.getDisplay().asyncExec(new Runnable() {
1087 if (fProblemIndicationList != null && !fProblemIndicationList.isDisposed()) {
1088 fProblemIndicationList.select(0);
1089 handleProblemIndicationColorListSelection();
1095 private void initializeFields() {
1097 Iterator e = fColorButtons.keySet().iterator();
1098 while (e.hasNext()) {
1099 ColorEditor c = (ColorEditor) e.next();
1100 String key = (String) fColorButtons.get(c);
1101 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
1102 c.setColorValue(rgb);
1105 e = fCheckBoxes.keySet().iterator();
1106 while (e.hasNext()) {
1107 Button b = (Button) e.next();
1108 String key = (String) fCheckBoxes.get(b);
1109 b.setSelection(fOverlayStore.getBoolean(key));
1112 e = fTextFields.keySet().iterator();
1113 while (e.hasNext()) {
1114 Text t = (Text) e.next();
1115 String key = (String) fTextFields.get(t);
1116 t.setText(fOverlayStore.getString(key));
1119 RGB rgb = PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
1120 fBackgroundColorEditor.setColorValue(rgb);
1122 boolean default_ = fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
1123 fBackgroundDefaultRadioButton.setSelection(default_);
1124 fBackgroundCustomRadioButton.setSelection(!default_);
1125 fBackgroundColorButton.setEnabled(!default_);
1127 // boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
1128 // fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
1130 // boolean fillMethodArguments = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
1131 // fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
1133 updateAutoactivationControls();
1135 // fJavaEditorHoverConfigurationBlock.initializeFields();
1138 private void updateAutoactivationControls() {
1139 boolean autoactivation = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
1140 fAutoInsertDelayText.setEnabled(autoactivation);
1141 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
1142 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
1143 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
1147 * @see PreferencePage#performOk()
1149 public boolean performOk() {
1150 fFontEditor.store();
1151 // fJavaEditorHoverConfigurationBlock.performOk();
1152 fOverlayStore.propagate();
1153 // fUserDefinedPHPSyntaxFileFFE.store();
1154 PHPeclipsePlugin.getDefault().savePluginPreferences();
1159 * @see PreferencePage#performDefaults()
1161 protected void performDefaults() {
1163 fFontEditor.loadDefault();
1165 fOverlayStore.loadDefaults();
1168 // fUserDefinedPHPSyntaxFileFFE.loadDefault();
1169 handleSyntaxColorListSelection();
1170 handleAppearanceColorListSelection();
1171 handleProblemIndicationColorListSelection();
1172 super.performDefaults();
1174 fPreviewViewer.invalidateTextPresentation();
1178 * @see DialogPage#dispose()
1180 public void dispose() {
1182 if (fJavaTextTools != null) {
1183 fJavaTextTools = null;
1186 fFontEditor.setPreferencePage(null);
1187 fFontEditor.setPreferenceStore(null);
1189 if (fOverlayStore != null) {
1190 fOverlayStore.stop();
1191 fOverlayStore = null;
1197 private Control addColorButton(Composite composite, String label, String key, int indentation) {
1199 Label labelControl = new Label(composite, SWT.NONE);
1200 labelControl.setText(label);
1202 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1203 gd.horizontalIndent = indentation;
1204 labelControl.setLayoutData(gd);
1206 ColorEditor editor = new ColorEditor(composite);
1207 Button button = editor.getButton();
1208 button.setData(editor);
1210 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1211 button.setLayoutData(gd);
1212 button.addSelectionListener(fColorButtonListener);
1214 fColorButtons.put(editor, key);
1219 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
1220 Button checkBox = new Button(parent, SWT.CHECK);
1221 checkBox.setText(label);
1223 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1224 gd.horizontalIndent = indentation;
1225 gd.horizontalSpan = 2;
1226 checkBox.setLayoutData(gd);
1227 checkBox.addSelectionListener(fCheckBoxListener);
1229 fCheckBoxes.put(checkBox, key);
1234 private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
1236 Label labelControl = new Label(composite, SWT.NONE);
1237 labelControl.setText(label);
1238 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1239 gd.horizontalIndent = indentation;
1240 labelControl.setLayoutData(gd);
1242 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
1243 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1244 gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
1245 textControl.setLayoutData(gd);
1246 textControl.setTextLimit(textLimit);
1247 fTextFields.put(textControl, key);
1249 fNumberFields.add(textControl);
1250 textControl.addModifyListener(fNumberFieldListener);
1252 textControl.addModifyListener(fTextFieldListener);
1258 private void addTextFontEditor(Composite parent, String label, String key) {
1260 Composite editorComposite = new Composite(parent, SWT.NONE);
1261 GridLayout layout = new GridLayout();
1262 layout.numColumns = 3;
1263 editorComposite.setLayout(layout);
1264 fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label, editorComposite);
1265 fFontEditor.setChangeButtonText(PHPUIMessages.getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
1267 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1268 gd.horizontalSpan = 2;
1269 editorComposite.setLayoutData(gd);
1272 private String loadPreviewContentFromFile(String filename) {
1274 String separator = System.getProperty("line.separator"); //$NON-NLS-1$
1275 StringBuffer buffer = new StringBuffer(512);
1276 BufferedReader reader = null;
1278 reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
1279 while ((line = reader.readLine()) != null) {
1280 buffer.append(line);
1281 buffer.append(separator);
1283 } catch (IOException io) {
1284 PHPeclipsePlugin.log(io);
1286 if (reader != null) {
1289 } catch (IOException e) {
1293 return buffer.toString();
1296 private void numberFieldChanged(Text textControl) {
1297 String number = textControl.getText();
1298 IStatus status = validatePositiveNumber(number);
1299 if (!status.matches(IStatus.ERROR))
1300 fOverlayStore.setValue((String) fTextFields.get(textControl), number);
1301 updateStatus(status);
1304 private IStatus validatePositiveNumber(String number) {
1305 StatusInfo status = new StatusInfo();
1306 if (number.length() == 0) {
1307 status.setError(PHPUIMessages.getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
1310 int value = Integer.parseInt(number);
1312 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1313 } catch (NumberFormatException e) {
1314 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1320 private void updateStatus(IStatus status) {
1321 if (!status.matches(IStatus.ERROR)) {
1322 for (int i = 0; i < fNumberFields.size(); i++) {
1323 Text text = (Text) fNumberFields.get(i);
1324 IStatus s = validatePositiveNumber(text.getText());
1325 status = StatusUtil.getMoreSevere(s, status);
1328 setValid(!status.matches(IStatus.ERROR));
1329 StatusUtil.applyToStatusLine(this, status);
1333 * @deprecated Inline to avoid reference to preference page
1335 public static boolean indicateQuixFixableProblems() {
1336 return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
1340 * @deprecated Inline to avoid reference to preference page
1342 // static public boolean synchronizeOutlineOnCursorMove() {
1343 // return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);