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 **********************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
12 import java.io.BufferedReader;
13 import java.io.IOException;
14 import java.io.InputStreamReader;
15 import java.text.Collator;
16 import java.util.ArrayList;
17 import java.util.Comparator;
18 import java.util.HashMap;
19 import java.util.Iterator;
21 import java.util.SortedSet;
22 import java.util.TreeSet;
24 import net.sourceforge.phpdt.core.JavaCore;
25 import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
26 import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
27 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
28 import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
29 import net.sourceforge.phpdt.ui.PreferenceConstants;
30 import net.sourceforge.phpdt.ui.text.JavaTextTools;
31 import net.sourceforge.phpeclipse.IPreferenceConstants;
32 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
33 import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
34 import net.sourceforge.phpeclipse.preferences.ColorEditor;
36 import org.eclipse.core.runtime.IStatus;
37 import org.eclipse.core.runtime.Preferences;
38 import org.eclipse.jface.preference.IPreferenceStore;
39 import org.eclipse.jface.preference.PreferenceConverter;
40 import org.eclipse.jface.preference.PreferencePage;
41 import org.eclipse.jface.resource.JFaceResources;
42 import org.eclipse.jface.text.Document;
43 import org.eclipse.jface.text.IDocument;
44 import org.eclipse.jface.text.IDocumentPartitioner;
45 import org.eclipse.jface.text.source.ISourceViewer;
46 import org.eclipse.jface.text.source.SourceViewer;
47 import org.eclipse.jface.util.IPropertyChangeListener;
48 import org.eclipse.jface.util.PropertyChangeEvent;
49 import org.eclipse.swt.SWT;
50 import org.eclipse.swt.custom.StyledText;
51 import org.eclipse.swt.events.ModifyEvent;
52 import org.eclipse.swt.events.ModifyListener;
53 import org.eclipse.swt.events.SelectionAdapter;
54 import org.eclipse.swt.events.SelectionEvent;
55 import org.eclipse.swt.events.SelectionListener;
56 import org.eclipse.swt.graphics.Color;
57 import org.eclipse.swt.graphics.RGB;
58 import org.eclipse.swt.layout.GridData;
59 import org.eclipse.swt.layout.GridLayout;
60 import org.eclipse.swt.layout.RowLayout;
61 import org.eclipse.swt.widgets.Button;
62 import org.eclipse.swt.widgets.Combo;
63 import org.eclipse.swt.widgets.Composite;
64 import org.eclipse.swt.widgets.Control;
65 import org.eclipse.swt.widgets.Display;
66 import org.eclipse.swt.widgets.Group;
67 import org.eclipse.swt.widgets.Label;
68 import org.eclipse.swt.widgets.List;
69 import org.eclipse.swt.widgets.TabFolder;
70 import org.eclipse.swt.widgets.TabItem;
71 import org.eclipse.swt.widgets.Text;
72 import org.eclipse.ui.IWorkbench;
73 import org.eclipse.ui.IWorkbenchPreferencePage;
74 import org.eclipse.ui.texteditor.AnnotationPreference;
75 import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
76 import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
78 * The page for setting the editor options.
80 public class PHPEditorPreferencePage extends PreferencePage
82 IWorkbenchPreferencePage {
83 private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
84 private static final String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS;
85 // public final OverlayPreferenceStore.OverlayKey[] fKeys =
86 // new OverlayPreferenceStore.OverlayKey[] {
87 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
88 // PreferenceConstants.EDITOR_FOREGROUND_COLOR),
89 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
90 // PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
91 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
92 // PreferenceConstants.EDITOR_BACKGROUND_COLOR),
93 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
94 // PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
95 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
96 // PreferenceConstants.EDITOR_TAB_WIDTH),
97 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
98 // PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
99 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
100 // PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
101 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
102 // PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
103 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
104 // PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
105 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
106 // PreferenceConstants.EDITOR_JAVA_TAG_COLOR),
107 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
108 // PreferenceConstants.EDITOR_JAVA_TAG_BOLD),
109 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
110 // PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
111 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
112 // PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
113 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
114 // PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
115 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
116 // PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
117 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
118 // PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
119 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
120 // PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
121 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
122 // PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
123 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
124 // PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
125 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
126 // PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
127 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
128 // PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
129 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
130 // PreferenceConstants.EDITOR_STRING_COLOR),
131 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
132 // PreferenceConstants.EDITOR_STRING_BOLD),
133 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
134 // PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
135 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
136 // PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
137 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
138 // PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
139 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
140 // PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
141 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
142 // PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR),
143 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
144 // PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
145 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
146 // PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
147 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
148 // PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
149 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
150 // PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
151 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
152 // PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
153 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
154 // PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
155 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
156 // PreferenceConstants.EDITOR_MATCHING_BRACKETS),
157 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
158 // PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
159 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
160 // PreferenceConstants.EDITOR_CURRENT_LINE),
161 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
162 // PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
163 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
164 // PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
165 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
166 // PreferenceConstants.EDITOR_PRINT_MARGIN),
167 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
168 // PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
169 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
170 // PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
171 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
172 // PreferenceConstants.EDITOR_LINK_COLOR),
173 //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
174 // PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
175 //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
176 // PreferenceConstants.EDITOR_PROBLEM_INDICATION),
177 //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
178 // PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
179 //// new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
180 // PreferenceConstants.EDITOR_WARNING_INDICATION),
181 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
182 // PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
183 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
184 // PreferenceConstants.EDITOR_TASK_INDICATION),
185 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
186 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
187 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
188 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
189 // new OverlayPreferenceStore.OverlayKey(
190 // OverlayPreferenceStore.STRING,
191 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
192 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
193 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
194 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
195 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
196 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
197 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
198 // new OverlayPreferenceStore.OverlayKey(
199 // OverlayPreferenceStore.BOOLEAN,
200 // PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
201 // new OverlayPreferenceStore.OverlayKey(
202 // OverlayPreferenceStore.BOOLEAN,
203 // PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
204 // new OverlayPreferenceStore.OverlayKey(
205 // OverlayPreferenceStore.BOOLEAN,
206 // PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
207 // new OverlayPreferenceStore.OverlayKey(
208 // OverlayPreferenceStore.BOOLEAN,
209 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
210 // new OverlayPreferenceStore.OverlayKey(
211 // OverlayPreferenceStore.BOOLEAN,
212 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
213 // new OverlayPreferenceStore.OverlayKey(
214 // OverlayPreferenceStore.BOOLEAN,
215 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
216 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
217 // PreferenceConstants.EDITOR_CORRECTION_INDICATION),
218 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
219 // PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
220 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
221 // PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
222 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
223 // PreferenceConstants.EDITOR_OVERVIEW_RULER),
224 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
225 // PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
226 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
227 // PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
228 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
229 // PreferenceConstants.EDITOR_SPACES_FOR_TABS),
230 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
231 // PreferenceConstants.CODEASSIST_AUTOACTIVATION),
232 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
233 // PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
234 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
235 // PreferenceConstants.CODEASSIST_AUTOINSERT),
236 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
237 // PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
238 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
239 // PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
240 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
241 // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
242 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
243 // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
244 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
245 // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
246 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
247 // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
248 // new OverlayPreferenceStore.OverlayKey(
249 // OverlayPreferenceStore.STRING,
250 // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
251 // new OverlayPreferenceStore.OverlayKey(
252 // OverlayPreferenceStore.STRING,
253 // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
254 // new OverlayPreferenceStore.OverlayKey(
255 // OverlayPreferenceStore.STRING,
256 // PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
257 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
258 // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
259 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
260 // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
261 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
262 // PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
263 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
264 // PreferenceConstants.CODEASSIST_ADDIMPORT),
265 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
266 // PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
267 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
268 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
269 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
270 // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
271 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
272 // PreferenceConstants.EDITOR_SMART_PASTE),
273 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
274 // IPreferenceConstants.PHP_USERDEF_XMLFILE),
275 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
276 // PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP),
277 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
278 // PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP),
279 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
280 // PreferenceConstants.EDITOR_CLOSE_BRACES),
281 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
282 // PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
283 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
284 // PreferenceConstants.EDITOR_WRAP_STRINGS),
285 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
286 // PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
287 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
288 // PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
289 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
290 // PreferenceConstants.EDITOR_SMART_HOME_END),
291 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
292 // PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML),
293 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
294 // PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML),
295 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
296 // PreferenceConstants.EDITOR_DEFAULT_HOVER),
297 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
298 // PreferenceConstants.EDITOR_NONE_HOVER),
299 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
300 // PreferenceConstants.EDITOR_CTRL_HOVER),
301 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
302 // PreferenceConstants.EDITOR_SHIFT_HOVER),
303 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
304 // PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
305 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
306 // PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
307 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
308 // PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
309 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
310 // PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
311 // new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
312 // PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
314 /** The keys of the overlay store. */
315 public final OverlayPreferenceStore.OverlayKey[] fKeys;
316 private final String[][] fSyntaxColorListModel = new String[][]{
317 {PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"),
318 PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR},
320 {PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"),
321 PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR},
323 {PHPUIMessages.getString("PHPEditorPreferencePage.tags"),
324 PreferenceConstants.EDITOR_JAVA_TAG_COLOR},
326 {PHPUIMessages.getString("PHPEditorPreferencePage.keywords"),
327 PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR},
329 {PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"),
330 PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR},
332 {PHPUIMessages.getString("PHPEditorPreferencePage.variables"),
333 PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR},
335 {PHPUIMessages.getString("PHPEditorPreferencePage.constants"),
336 PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR},
338 {PHPUIMessages.getString("PHPEditorPreferencePage.types"),
339 PreferenceConstants.EDITOR_PHP_TYPE_COLOR},
341 {PHPUIMessages.getString("PHPEditorPreferencePage.strings"),
342 PreferenceConstants.EDITOR_STRING_COLOR},
344 {PHPUIMessages.getString("PHPEditorPreferencePage.others"),
345 PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR},
347 {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"),
348 PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR},
350 {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"),
351 PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR},
353 {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"),
354 PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR},
356 {PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"),
357 PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR} //$NON-NLS-1$
359 private final String[][] fAppearanceColorListModel = new String[][]{
362 .getString("PHPEditorPreferencePage.lineNumberForegroundColor"),
363 PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR},
367 .getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"),
368 PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR},
372 .getString("PHPEditorPreferencePage.currentLineHighlighColor"),
373 PreferenceConstants.EDITOR_CURRENT_LINE_COLOR},
375 {PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"),
376 PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR},
378 {PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"),
379 PreferenceConstants.EDITOR_FIND_SCOPE_COLOR},
381 {PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"),
382 PreferenceConstants.EDITOR_LINKED_POSITION_COLOR},
384 {PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"),
385 PreferenceConstants.EDITOR_LINK_COLOR}, //$NON-NLS-1$
387 // private final String[][] fProblemIndicationColorListModel =
391 // PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
392 // PreferenceConstants.EDITOR_PROBLEM_INDICATION,
393 // PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
396 // PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
397 // PreferenceConstants.EDITOR_WARNING_INDICATION,
398 // PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
401 // PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
402 // PreferenceConstants.EDITOR_TASK_INDICATION,
403 // PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
406 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
407 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
408 // PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
411 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
412 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
413 // PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
416 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
417 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
418 // PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
420 private final String[][] fAnnotationColorListModel;
421 private final String[][] fAnnotationDecorationListModel = new String[][]{
424 .getString("JavaEditorPreferencePage.AnnotationDecoration.NONE"),
425 AnnotationPreference.STYLE_NONE},
428 // PreferencesMessages
429 // .getString("JavaEditorPreferencePage.AnnotationDecoration.SQUIGGLIES"),
430 // AnnotationPreference.STYLE_SQUIGGLIES},
434 .getString("JavaEditorPreferencePage.AnnotationDecoration.UNDERLINE"),
435 AnnotationPreference.STYLE_UNDERLINE},
439 .getString("JavaEditorPreferencePage.AnnotationDecoration.BOX"),
440 AnnotationPreference.STYLE_BOX},
444 .getString("JavaEditorPreferencePage.AnnotationDecoration.IBEAM"),
445 AnnotationPreference.STYLE_IBEAM} //$NON-NLS-1$
447 private OverlayPreferenceStore fOverlayStore;
448 private JavaTextTools fJavaTextTools;
449 // private JavaEditorHoverConfigurationBlock
450 // fJavaEditorHoverConfigurationBlock;
451 private Map fColorButtons = new HashMap();
452 private SelectionListener fColorButtonListener = new SelectionListener() {
453 public void widgetDefaultSelected(SelectionEvent e) {
455 public void widgetSelected(SelectionEvent e) {
456 ColorEditor editor = (ColorEditor) e.widget.getData();
457 PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons
458 .get(editor), editor.getColorValue());
461 private Map fCheckBoxes = new HashMap();
462 private SelectionListener fCheckBoxListener = new SelectionListener() {
463 public void widgetDefaultSelected(SelectionEvent e) {
465 public void widgetSelected(SelectionEvent e) {
466 Button button = (Button) e.widget;
467 fOverlayStore.setValue((String) fCheckBoxes.get(button), button
471 private Map fTextFields = new HashMap();
472 private ModifyListener fTextFieldListener = new ModifyListener() {
473 public void modifyText(ModifyEvent e) {
474 Text text = (Text) e.widget;
475 fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
478 private ArrayList fNumberFields = new ArrayList();
479 private ModifyListener fNumberFieldListener = new ModifyListener() {
480 public void modifyText(ModifyEvent e) {
481 numberFieldChanged((Text) e.widget);
484 private WorkbenchChainedTextFontFieldEditor fFontEditor;
485 private List fSyntaxColorList;
486 private List fAppearanceColorList;
487 private List fAnnotationList;
488 private ColorEditor fSyntaxForegroundColorEditor;
489 private ColorEditor fAppearanceForegroundColorEditor;
490 private ColorEditor fAnnotationForegroundColorEditor;
491 private ColorEditor fBackgroundColorEditor;
492 private Button fBackgroundDefaultRadioButton;
493 private Button fBackgroundCustomRadioButton;
494 private Button fBackgroundColorButton;
495 private Button fBoldCheckBox;
496 //private Button fAddJavaDocTagsButton;
497 // private Button fGuessMethodArgumentsButton;
498 private SourceViewer fPreviewViewer;
499 private Color fBackgroundColor;
500 private Control fAutoInsertDelayText;
501 private Control fAutoInsertJavaTriggerText;
502 private Control fAutoInsertJavaDocTriggerText;
503 private Control fAutoInsertHTMLTriggerText;
504 private Button fShowInTextCheckBox;
505 private Button fShowInOverviewRulerCheckBox;
506 private Combo fDecorationStyleCombo;
507 private Button fHighlightInTextCheckBox;
508 private Button fShowInVerticalRulerCheckBox;
509 // private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
510 public PHPEditorPreferencePage() {
511 setDescription(PHPUIMessages
512 .getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
513 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
514 MarkerAnnotationPreferences markerAnnotationPreferences = new MarkerAnnotationPreferences();
515 fKeys = createOverlayStoreKeys(markerAnnotationPreferences);
516 fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
517 fAnnotationColorListModel = createAnnotationTypeListModel(markerAnnotationPreferences);
519 private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys(
520 MarkerAnnotationPreferences preferences) {
521 ArrayList overlayKeys = new ArrayList();
522 Iterator e = preferences.getAnnotationPreferences().iterator();
523 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
524 OverlayPreferenceStore.STRING,
525 PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR));
526 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
527 OverlayPreferenceStore.BOOLEAN,
528 PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD));
529 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
530 OverlayPreferenceStore.STRING,
531 PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR));
532 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
533 OverlayPreferenceStore.BOOLEAN,
534 PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD));
535 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
536 OverlayPreferenceStore.STRING,
537 PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR));
538 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
539 OverlayPreferenceStore.BOOLEAN,
540 PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD));
541 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
542 OverlayPreferenceStore.STRING,
543 PreferenceConstants.EDITOR_PHP_TYPE_COLOR));
544 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
545 OverlayPreferenceStore.BOOLEAN,
546 PreferenceConstants.EDITOR_PHP_TYPE_BOLD));
548 .add(new OverlayPreferenceStore.OverlayKey(
549 OverlayPreferenceStore.STRING,
550 IPreferenceConstants.PHP_USERDEF_XMLFILE));
551 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
552 OverlayPreferenceStore.BOOLEAN,
553 PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP));
554 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
555 OverlayPreferenceStore.BOOLEAN,
556 PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP));
557 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
558 OverlayPreferenceStore.BOOLEAN,
559 PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML));
560 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
561 OverlayPreferenceStore.BOOLEAN,
562 PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML));
563 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
564 OverlayPreferenceStore.STRING,
565 PreferenceConstants.EDITOR_FOREGROUND_COLOR));
566 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
567 OverlayPreferenceStore.BOOLEAN,
568 PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR));
569 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
570 OverlayPreferenceStore.STRING,
571 PreferenceConstants.EDITOR_BACKGROUND_COLOR));
572 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
573 OverlayPreferenceStore.BOOLEAN,
574 PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR));
575 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
576 OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH));
577 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
578 OverlayPreferenceStore.STRING,
579 PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR));
580 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
581 OverlayPreferenceStore.BOOLEAN,
582 PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD));
583 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
584 OverlayPreferenceStore.STRING,
585 PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR));
586 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
587 OverlayPreferenceStore.BOOLEAN,
588 PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD));
589 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
590 OverlayPreferenceStore.STRING,
591 PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR));
592 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
593 OverlayPreferenceStore.BOOLEAN,
594 PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD));
596 .add(new OverlayPreferenceStore.OverlayKey(
597 OverlayPreferenceStore.STRING,
598 PreferenceConstants.EDITOR_STRING_COLOR));
600 .add(new OverlayPreferenceStore.OverlayKey(
601 OverlayPreferenceStore.BOOLEAN,
602 PreferenceConstants.EDITOR_STRING_BOLD));
603 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
604 OverlayPreferenceStore.STRING,
605 PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR));
606 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
607 OverlayPreferenceStore.BOOLEAN,
608 PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD));
609 // overlayKeys.add(new
610 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
611 // PreferenceConstants.EDITOR_TASK_TAG_COLOR));
612 // overlayKeys.add(new
613 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
614 // PreferenceConstants.EDITOR_TASK_TAG_BOLD));
616 // overlayKeys.add(new
617 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
618 // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR));
619 // overlayKeys.add(new
620 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
621 // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_BOLD));
623 // overlayKeys.add(new
624 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
625 // PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR));
626 // overlayKeys.add(new
627 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
628 // PreferenceConstants.EDITOR_JAVA_OPERATOR_BOLD));
629 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
630 OverlayPreferenceStore.STRING,
631 PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR));
632 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
633 OverlayPreferenceStore.BOOLEAN,
634 PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD));
635 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
636 OverlayPreferenceStore.STRING,
637 PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR));
638 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
639 OverlayPreferenceStore.BOOLEAN,
640 PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD));
641 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
642 OverlayPreferenceStore.STRING,
643 PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR));
644 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
645 OverlayPreferenceStore.BOOLEAN,
646 PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD));
647 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
648 OverlayPreferenceStore.STRING,
649 PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR));
650 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
651 OverlayPreferenceStore.BOOLEAN,
652 PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD));
653 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
654 OverlayPreferenceStore.STRING,
655 PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
656 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
657 OverlayPreferenceStore.BOOLEAN,
658 PreferenceConstants.EDITOR_MATCHING_BRACKETS));
659 // overlayKeys.add(new
660 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
661 // ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR));
662 // overlayKeys.add(new
663 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
664 // ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE));
666 // overlayKeys.add(new
667 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
668 // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR));
669 // overlayKeys.add(new
670 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT,
671 // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN));
672 // overlayKeys.add(new
673 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
674 // ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN));
676 // overlayKeys.add(new
677 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
678 // PreferenceConstants.EDITOR_MARK_OCCURRENCES));
679 // overlayKeys.add(new
680 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
681 // PreferenceConstants.EDITOR_STICKY_OCCURRENCES));
682 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
683 OverlayPreferenceStore.STRING,
684 PreferenceConstants.EDITOR_FIND_SCOPE_COLOR));
685 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
686 OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR));
687 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
688 OverlayPreferenceStore.BOOLEAN,
689 PreferenceConstants.EDITOR_CORRECTION_INDICATION));
690 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
691 OverlayPreferenceStore.BOOLEAN,
692 PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS));
693 // overlayKeys.add(new
694 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
695 // ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
696 // overlayKeys.add(new
697 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
698 // ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
699 // overlayKeys.add(new
700 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
701 // ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
702 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
703 OverlayPreferenceStore.BOOLEAN,
704 PreferenceConstants.EDITOR_SPACES_FOR_TABS));
705 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
706 OverlayPreferenceStore.BOOLEAN,
707 PreferenceConstants.CODEASSIST_AUTOACTIVATION));
708 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
709 OverlayPreferenceStore.INT,
710 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
711 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
712 OverlayPreferenceStore.BOOLEAN,
713 PreferenceConstants.CODEASSIST_AUTOINSERT));
714 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
715 OverlayPreferenceStore.STRING,
716 PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
717 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
718 OverlayPreferenceStore.STRING,
719 PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
720 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
721 OverlayPreferenceStore.STRING,
722 PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
723 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
724 OverlayPreferenceStore.STRING,
725 PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
726 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
727 OverlayPreferenceStore.STRING,
728 PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
729 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
730 OverlayPreferenceStore.STRING,
731 PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
732 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
733 OverlayPreferenceStore.STRING,
734 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
735 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
736 OverlayPreferenceStore.STRING,
737 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
738 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
739 OverlayPreferenceStore.BOOLEAN,
740 PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
741 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
742 OverlayPreferenceStore.BOOLEAN,
743 PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
744 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
745 OverlayPreferenceStore.BOOLEAN,
746 PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
747 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
748 OverlayPreferenceStore.BOOLEAN,
749 PreferenceConstants.CODEASSIST_ADDIMPORT));
750 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
751 OverlayPreferenceStore.BOOLEAN,
752 PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
753 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
754 OverlayPreferenceStore.BOOLEAN,
755 PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
756 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
757 OverlayPreferenceStore.BOOLEAN,
758 PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
760 .add(new OverlayPreferenceStore.OverlayKey(
761 OverlayPreferenceStore.BOOLEAN,
762 PreferenceConstants.EDITOR_SMART_PASTE));
763 // overlayKeys.add(new
764 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
765 // PreferenceConstants.EDITOR_CLOSE_STRINGS));
766 // overlayKeys.add(new
767 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
768 // PreferenceConstants.EDITOR_CLOSE_BRACKETS));
770 .add(new OverlayPreferenceStore.OverlayKey(
771 OverlayPreferenceStore.BOOLEAN,
772 PreferenceConstants.EDITOR_CLOSE_BRACES));
773 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
774 OverlayPreferenceStore.BOOLEAN,
775 PreferenceConstants.EDITOR_CLOSE_JAVADOCS));
777 .add(new OverlayPreferenceStore.OverlayKey(
778 OverlayPreferenceStore.BOOLEAN,
779 PreferenceConstants.EDITOR_WRAP_STRINGS));
780 // overlayKeys.add(new
781 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
782 // PreferenceConstants.EDITOR_ESCAPE_STRINGS));
783 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
784 OverlayPreferenceStore.BOOLEAN,
785 PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS));
786 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
787 OverlayPreferenceStore.BOOLEAN,
788 PreferenceConstants.EDITOR_SMART_HOME_END));
789 // overlayKeys.add(new
790 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
791 // PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION));
792 // overlayKeys.add(new
793 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
794 // PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE));
795 // overlayKeys.add(new
796 // OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
797 // PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
798 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
799 OverlayPreferenceStore.STRING,
800 PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS));
801 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
802 OverlayPreferenceStore.STRING,
803 PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS));
804 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
805 OverlayPreferenceStore.BOOLEAN,
806 PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS));
807 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
808 OverlayPreferenceStore.STRING,
809 PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER));
810 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
811 OverlayPreferenceStore.STRING,
812 PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK));
813 while (e.hasNext()) {
814 AnnotationPreference info = (AnnotationPreference) e.next();
815 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
816 OverlayPreferenceStore.STRING, info.getColorPreferenceKey()));
817 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
818 OverlayPreferenceStore.BOOLEAN, info.getTextPreferenceKey()));
819 if (info.getHighlightPreferenceKey() != null)
820 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
821 OverlayPreferenceStore.BOOLEAN, info.getHighlightPreferenceKey()));
823 .add(new OverlayPreferenceStore.OverlayKey(
824 OverlayPreferenceStore.BOOLEAN, info
825 .getOverviewRulerPreferenceKey()));
826 if (info.getVerticalRulerPreferenceKey() != null)
827 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
828 OverlayPreferenceStore.BOOLEAN, info
829 .getVerticalRulerPreferenceKey()));
830 if (info.getTextStylePreferenceKey() != null)
831 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
832 OverlayPreferenceStore.STRING, info.getTextStylePreferenceKey()));
834 OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
836 overlayKeys.toArray(keys);
840 * @see IWorkbenchPreferencePage#init()
842 public void init(IWorkbench workbench) {
845 * @see PreferencePage#createControl(Composite)
847 public void createControl(Composite parent) {
848 super.createControl(parent);
849 // WorkbenchHelp.setHelp(getControl(),
850 // IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
852 private void handleSyntaxColorListSelection() {
853 int i = fSyntaxColorList.getSelectionIndex();
854 String key = fSyntaxColorListModel[i][1];
855 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
856 fSyntaxForegroundColorEditor.setColorValue(rgb);
857 fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
859 private void handleAppearanceColorListSelection() {
860 int i = fAppearanceColorList.getSelectionIndex();
861 String key = fAppearanceColorListModel[i][1];
862 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
863 fAppearanceForegroundColorEditor.setColorValue(rgb);
865 // private void handleProblemIndicationColorListSelection() {
866 // int i = fProblemIndicationList.getSelectionIndex();
868 // String key = fProblemIndicationColorListModel[i][1];
869 // RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
870 // fProblemIndicationForegroundColorEditor.setColorValue(rgb);
872 // key = fProblemIndicationColorListModel[i][2];
873 // fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
875 // key = fProblemIndicationColorListModel[i][3];
876 // fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
878 private void handleAnnotationListSelection() {
879 int i = fAnnotationList.getSelectionIndex();
880 String key = fAnnotationColorListModel[i][1];
881 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
882 fAnnotationForegroundColorEditor.setColorValue(rgb);
883 key = fAnnotationColorListModel[i][2];
884 boolean showInText = fOverlayStore.getBoolean(key);
885 fShowInTextCheckBox.setSelection(showInText);
886 key = fAnnotationColorListModel[i][6];
888 fDecorationStyleCombo.setEnabled(showInText);
889 for (int j = 0; j < fAnnotationDecorationListModel.length; j++) {
890 String value = fOverlayStore.getString(key);
891 if (fAnnotationDecorationListModel[j][1].equals(value)) {
892 fDecorationStyleCombo.setText(fAnnotationDecorationListModel[j][0]);
897 fDecorationStyleCombo.setEnabled(false);
898 fDecorationStyleCombo.setText(fAnnotationDecorationListModel[1][0]); // set
911 key = fAnnotationColorListModel[i][3];
912 fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
913 key = fAnnotationColorListModel[i][4];
915 fHighlightInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
916 fHighlightInTextCheckBox.setEnabled(true);
918 fHighlightInTextCheckBox.setEnabled(false);
919 key = fAnnotationColorListModel[i][5];
921 fShowInVerticalRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
922 fShowInVerticalRulerCheckBox.setEnabled(true);
924 fShowInVerticalRulerCheckBox.setSelection(true);
925 fShowInVerticalRulerCheckBox.setEnabled(false);
928 private Control createSyntaxPage(Composite parent) {
929 Composite colorComposite = new Composite(parent, SWT.NULL);
930 colorComposite.setLayout(new GridLayout());
931 Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
932 backgroundComposite.setLayout(new RowLayout());
933 backgroundComposite.setText(PHPUIMessages
934 .getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
935 SelectionListener backgroundSelectionListener = new SelectionListener() {
936 public void widgetSelected(SelectionEvent e) {
937 boolean custom = fBackgroundCustomRadioButton.getSelection();
938 fBackgroundColorButton.setEnabled(custom);
939 fOverlayStore.setValue(
940 PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
942 public void widgetDefaultSelected(SelectionEvent e) {
945 fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO
947 fBackgroundDefaultRadioButton.setText(PHPUIMessages
948 .getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
949 fBackgroundDefaultRadioButton
950 .addSelectionListener(backgroundSelectionListener);
951 fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO
953 fBackgroundCustomRadioButton.setText(PHPUIMessages
954 .getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
955 fBackgroundCustomRadioButton
956 .addSelectionListener(backgroundSelectionListener);
957 fBackgroundColorEditor = new ColorEditor(backgroundComposite);
958 fBackgroundColorButton = fBackgroundColorEditor.getButton();
959 // fUserDefinedPHPSyntaxFileFFE =
960 // new FileFieldEditor(
961 // IPreferenceConstants.PHP_USERDEF_XMLFILE,
962 // PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
964 // fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
965 // fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
966 // fUserDefinedPHPSyntaxFileFFE.load();
967 Label label = new Label(colorComposite, SWT.LEFT);
969 .setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
970 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
971 Composite editorComposite = new Composite(colorComposite, SWT.NONE);
972 GridLayout layout = new GridLayout();
973 layout.numColumns = 2;
974 layout.marginHeight = 0;
975 layout.marginWidth = 0;
976 editorComposite.setLayout(layout);
977 GridData gd = new GridData(GridData.FILL_BOTH);
978 editorComposite.setLayoutData(gd);
979 fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
981 gd = new GridData(GridData.FILL_BOTH);
982 gd.heightHint = convertHeightInCharsToPixels(5);
983 fSyntaxColorList.setLayoutData(gd);
984 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
985 layout = new GridLayout();
986 layout.marginHeight = 0;
987 layout.marginWidth = 0;
988 layout.numColumns = 2;
989 stylesComposite.setLayout(layout);
990 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
991 label = new Label(stylesComposite, SWT.LEFT);
992 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
994 gd.horizontalAlignment = GridData.BEGINNING;
995 label.setLayoutData(gd);
996 fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
997 Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
998 gd = new GridData(GridData.FILL_HORIZONTAL);
999 gd.horizontalAlignment = GridData.BEGINNING;
1000 foregroundColorButton.setLayoutData(gd);
1001 fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
1002 fBoldCheckBox.setText(PHPUIMessages
1003 .getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
1004 gd = new GridData(GridData.FILL_HORIZONTAL);
1005 gd.horizontalAlignment = GridData.BEGINNING;
1006 gd.horizontalSpan = 2;
1007 fBoldCheckBox.setLayoutData(gd);
1008 label = new Label(colorComposite, SWT.LEFT);
1009 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
1010 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
1011 Control previewer = createPreviewer(colorComposite);
1012 gd = new GridData(GridData.FILL_BOTH);
1013 gd.widthHint = convertWidthInCharsToPixels(20);
1014 gd.heightHint = convertHeightInCharsToPixels(5);
1015 previewer.setLayoutData(gd);
1016 fSyntaxColorList.addSelectionListener(new SelectionListener() {
1017 public void widgetDefaultSelected(SelectionEvent e) {
1020 public void widgetSelected(SelectionEvent e) {
1021 handleSyntaxColorListSelection();
1024 foregroundColorButton.addSelectionListener(new SelectionListener() {
1025 public void widgetDefaultSelected(SelectionEvent e) {
1028 public void widgetSelected(SelectionEvent e) {
1029 int i = fSyntaxColorList.getSelectionIndex();
1030 String key = fSyntaxColorListModel[i][1];
1031 PreferenceConverter.setValue(fOverlayStore, key,
1032 fSyntaxForegroundColorEditor.getColorValue());
1035 fBackgroundColorButton.addSelectionListener(new SelectionListener() {
1036 public void widgetDefaultSelected(SelectionEvent e) {
1039 public void widgetSelected(SelectionEvent e) {
1040 PreferenceConverter.setValue(fOverlayStore,
1041 PreferenceConstants.EDITOR_BACKGROUND_COLOR, fBackgroundColorEditor
1045 fBoldCheckBox.addSelectionListener(new SelectionListener() {
1046 public void widgetDefaultSelected(SelectionEvent e) {
1049 public void widgetSelected(SelectionEvent e) {
1050 int i = fSyntaxColorList.getSelectionIndex();
1051 String key = fSyntaxColorListModel[i][1];
1052 fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
1055 return colorComposite;
1057 private Control createPreviewer(Composite parent) {
1058 Preferences coreStore = createTemporaryCorePreferenceStore();
1059 fJavaTextTools = new JavaTextTools(fOverlayStore, coreStore, false);
1060 fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL
1062 fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools,
1064 fPreviewViewer.getTextWidget().setFont(
1065 JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
1066 fPreviewViewer.setEditable(false);
1067 initializeViewerColors(fPreviewViewer);
1068 String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
1069 IDocument document = new Document(content);
1070 // PHPEditorEnvironment pe;
1071 IDocumentPartitioner partitioner = fJavaTextTools
1072 .createDocumentPartitioner();
1073 partitioner.connect(document);
1074 document.setDocumentPartitioner(partitioner);
1075 fPreviewViewer.setDocument(document);
1076 fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
1077 public void propertyChange(PropertyChangeEvent event) {
1078 String p = event.getProperty();
1079 if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
1080 || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
1081 initializeViewerColors(fPreviewViewer);
1083 fPreviewViewer.invalidateTextPresentation();
1086 return fPreviewViewer.getControl();
1088 private Preferences createTemporaryCorePreferenceStore() {
1089 Preferences result = new Preferences();
1090 result.setValue(COMPILER_TASK_TAGS, "TASK"); //$NON-NLS-1$
1094 * Initializes the given viewer's colors.
1097 * the viewer to be initialized
1099 private void initializeViewerColors(ISourceViewer viewer) {
1100 IPreferenceStore store = fOverlayStore;
1101 if (store != null) {
1102 StyledText styledText = viewer.getTextWidget();
1103 // ---------- background color ----------------------
1105 .getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
1107 : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR,
1108 styledText.getDisplay());
1109 styledText.setBackground(color);
1110 if (fBackgroundColor != null)
1111 fBackgroundColor.dispose();
1112 fBackgroundColor = color;
1116 * Creates a color from the information stored in the given preference store.
1117 * Returns <code>null</code> if there is no such information available.
1119 private Color createColor(IPreferenceStore store, String key, Display display) {
1121 if (store.contains(key)) {
1122 if (store.isDefault(key))
1123 rgb = PreferenceConverter.getDefaultColor(store, key);
1125 rgb = PreferenceConverter.getColor(store, key);
1127 return new Color(display, rgb);
1131 // sets enabled flag for a control and all its sub-tree
1132 private static void setEnabled(Control control, boolean enable) {
1133 control.setEnabled(enable);
1134 if (control instanceof Composite) {
1135 Composite composite = (Composite) control;
1136 Control[] children = composite.getChildren();
1137 for (int i = 0; i < children.length; i++)
1138 setEnabled(children[i], enable);
1141 private Control createAppearancePage(Composite parent) {
1142 Composite appearanceComposite = new Composite(parent, SWT.NONE);
1143 GridLayout layout = new GridLayout();
1144 layout.numColumns = 2;
1145 appearanceComposite.setLayout(layout);
1146 String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
1147 addTextFontEditor(appearanceComposite, label, JFaceResources.TEXT_FONT);
1148 label = PHPUIMessages
1149 .getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
1150 addTextField(appearanceComposite, label,
1151 PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
1152 label = PHPUIMessages
1153 .getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
1154 addTextField(appearanceComposite, label,
1155 PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
1157 // PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor");
1159 // addCheckBox(appearanceComposite, label,
1160 // PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
1161 label = PHPUIMessages
1162 .getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
1163 addCheckBox(appearanceComposite, label,
1164 PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
1165 label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
1166 addCheckBox(appearanceComposite, label,
1167 PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
1168 label = PHPUIMessages
1169 .getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
1170 addCheckBox(appearanceComposite, label,
1171 PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
1172 label = PHPUIMessages
1173 .getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
1174 addCheckBox(appearanceComposite, label,
1175 PreferenceConstants.EDITOR_CURRENT_LINE, 0);
1176 label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
1177 addCheckBox(appearanceComposite, label,
1178 PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
1179 Label l = new Label(appearanceComposite, SWT.LEFT);
1180 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1181 gd.horizontalSpan = 2;
1182 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
1183 l.setLayoutData(gd);
1184 l = new Label(appearanceComposite, SWT.LEFT);
1185 l.setText(PHPUIMessages
1186 .getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
1187 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1188 gd.horizontalSpan = 2;
1189 l.setLayoutData(gd);
1190 Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
1191 layout = new GridLayout();
1192 layout.numColumns = 2;
1193 layout.marginHeight = 0;
1194 layout.marginWidth = 0;
1195 editorComposite.setLayout(layout);
1196 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
1197 gd.horizontalSpan = 2;
1198 editorComposite.setLayoutData(gd);
1199 fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
1201 gd = new GridData(GridData.FILL_BOTH);
1202 gd.heightHint = convertHeightInCharsToPixels(5);
1203 fAppearanceColorList.setLayoutData(gd);
1204 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
1205 layout = new GridLayout();
1206 layout.marginHeight = 0;
1207 layout.marginWidth = 0;
1208 layout.numColumns = 2;
1209 stylesComposite.setLayout(layout);
1210 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
1211 l = new Label(stylesComposite, SWT.LEFT);
1212 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
1213 gd = new GridData();
1214 gd.horizontalAlignment = GridData.BEGINNING;
1215 l.setLayoutData(gd);
1216 fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
1217 Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
1218 gd = new GridData(GridData.FILL_HORIZONTAL);
1219 gd.horizontalAlignment = GridData.BEGINNING;
1220 foregroundColorButton.setLayoutData(gd);
1221 fAppearanceColorList.addSelectionListener(new SelectionListener() {
1222 public void widgetDefaultSelected(SelectionEvent e) {
1225 public void widgetSelected(SelectionEvent e) {
1226 handleAppearanceColorListSelection();
1229 foregroundColorButton.addSelectionListener(new SelectionListener() {
1230 public void widgetDefaultSelected(SelectionEvent e) {
1233 public void widgetSelected(SelectionEvent e) {
1234 int i = fAppearanceColorList.getSelectionIndex();
1235 String key = fAppearanceColorListModel[i][1];
1236 PreferenceConverter.setValue(fOverlayStore, key,
1237 fAppearanceForegroundColorEditor.getColorValue());
1240 return appearanceComposite;
1242 private Control createAnnotationsPage(Composite parent) {
1243 Composite composite = new Composite(parent, SWT.NULL);
1244 GridLayout layout = new GridLayout();
1245 layout.numColumns = 2;
1246 composite.setLayout(layout);
1247 String text = PreferencesMessages
1248 .getString("JavaEditorPreferencePage.analyseAnnotationsWhileTyping"); //$NON-NLS-1$
1249 addCheckBox(composite, text,
1250 PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
1251 text = PreferencesMessages
1252 .getString("JavaEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
1253 addCheckBox(composite, text,
1254 PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
1255 addFiller(composite);
1256 Label label = new Label(composite, SWT.LEFT);
1257 label.setText(PreferencesMessages
1258 .getString("JavaEditorPreferencePage.annotationPresentationOptions")); //$NON-NLS-1$
1259 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1260 gd.horizontalSpan = 2;
1261 label.setLayoutData(gd);
1262 Composite editorComposite = new Composite(composite, SWT.NONE);
1263 layout = new GridLayout();
1264 layout.numColumns = 2;
1265 layout.marginHeight = 0;
1266 layout.marginWidth = 0;
1267 editorComposite.setLayout(layout);
1268 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
1269 gd.horizontalSpan = 2;
1270 editorComposite.setLayoutData(gd);
1271 fAnnotationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL
1273 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
1274 | GridData.FILL_HORIZONTAL);
1275 gd.heightHint = convertHeightInCharsToPixels(10);
1276 fAnnotationList.setLayoutData(gd);
1277 Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
1278 layout = new GridLayout();
1279 layout.marginHeight = 0;
1280 layout.marginWidth = 0;
1281 layout.numColumns = 2;
1282 optionsComposite.setLayout(layout);
1283 optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
1284 fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
1285 fShowInTextCheckBox.setText(PreferencesMessages
1286 .getString("JavaEditorPreferencePage.annotations.showInText")); //$NON-NLS-1$
1287 gd = new GridData(GridData.FILL_HORIZONTAL);
1288 gd.horizontalAlignment = GridData.BEGINNING;
1289 gd.horizontalSpan = 2;
1290 fShowInTextCheckBox.setLayoutData(gd);
1291 fDecorationStyleCombo = new Combo(optionsComposite, SWT.READ_ONLY);
1292 for (int i = 0; i < fAnnotationDecorationListModel.length; i++)
1293 fDecorationStyleCombo.add(fAnnotationDecorationListModel[i][0]);
1294 gd = new GridData(GridData.FILL_HORIZONTAL);
1295 gd.horizontalAlignment = GridData.BEGINNING;
1296 gd.horizontalSpan = 2;
1297 gd.horizontalIndent = 20;
1298 fDecorationStyleCombo.setLayoutData(gd);
1299 fHighlightInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
1300 fHighlightInTextCheckBox.setText(PreferencesMessages
1301 .getString("TextEditorPreferencePage.annotations.highlightInText")); //$NON-NLS-1$
1302 gd = new GridData(GridData.FILL_HORIZONTAL);
1303 gd.horizontalAlignment = GridData.BEGINNING;
1304 gd.horizontalSpan = 2;
1305 fHighlightInTextCheckBox.setLayoutData(gd);
1306 fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
1307 fShowInOverviewRulerCheckBox.setText(PreferencesMessages
1308 .getString("JavaEditorPreferencePage.annotations.showInOverviewRuler")); //$NON-NLS-1$
1309 gd = new GridData(GridData.FILL_HORIZONTAL);
1310 gd.horizontalAlignment = GridData.BEGINNING;
1311 gd.horizontalSpan = 2;
1312 fShowInOverviewRulerCheckBox.setLayoutData(gd);
1313 fShowInVerticalRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
1314 fShowInVerticalRulerCheckBox.setText(PreferencesMessages
1315 .getString("JavaEditorPreferencePage.annotations.showInVerticalRuler")); //$NON-NLS-1$
1316 gd = new GridData(GridData.FILL_HORIZONTAL);
1317 gd.horizontalAlignment = GridData.BEGINNING;
1318 gd.horizontalSpan = 2;
1319 fShowInVerticalRulerCheckBox.setLayoutData(gd);
1320 label = new Label(optionsComposite, SWT.LEFT);
1321 label.setText(PreferencesMessages
1322 .getString("JavaEditorPreferencePage.annotations.color")); //$NON-NLS-1$
1323 gd = new GridData();
1324 gd.horizontalAlignment = GridData.BEGINNING;
1325 label.setLayoutData(gd);
1326 fAnnotationForegroundColorEditor = new ColorEditor(optionsComposite);
1327 Button foregroundColorButton = fAnnotationForegroundColorEditor.getButton();
1328 gd = new GridData(GridData.FILL_HORIZONTAL);
1329 gd.horizontalAlignment = GridData.BEGINNING;
1330 foregroundColorButton.setLayoutData(gd);
1331 fAnnotationList.addSelectionListener(new SelectionListener() {
1332 public void widgetDefaultSelected(SelectionEvent e) {
1335 public void widgetSelected(SelectionEvent e) {
1336 handleAnnotationListSelection();
1339 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
1340 public void widgetDefaultSelected(SelectionEvent e) {
1343 public void widgetSelected(SelectionEvent e) {
1344 int i = fAnnotationList.getSelectionIndex();
1345 String key = fAnnotationColorListModel[i][2];
1346 fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
1347 String decorationKey = fAnnotationColorListModel[i][6];
1348 fDecorationStyleCombo.setEnabled(decorationKey != null
1349 && fShowInTextCheckBox.getSelection());
1352 fHighlightInTextCheckBox.addSelectionListener(new SelectionListener() {
1353 public void widgetDefaultSelected(SelectionEvent e) {
1356 public void widgetSelected(SelectionEvent e) {
1357 int i = fAnnotationList.getSelectionIndex();
1358 String key = fAnnotationColorListModel[i][4];
1359 fOverlayStore.setValue(key, fHighlightInTextCheckBox.getSelection());
1362 fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
1363 public void widgetDefaultSelected(SelectionEvent e) {
1366 public void widgetSelected(SelectionEvent e) {
1367 int i = fAnnotationList.getSelectionIndex();
1368 String key = fAnnotationColorListModel[i][3];
1370 .setValue(key, fShowInOverviewRulerCheckBox.getSelection());
1373 fShowInVerticalRulerCheckBox.addSelectionListener(new SelectionListener() {
1374 public void widgetDefaultSelected(SelectionEvent e) {
1377 public void widgetSelected(SelectionEvent e) {
1378 int i = fAnnotationList.getSelectionIndex();
1379 String key = fAnnotationColorListModel[i][5];
1381 .setValue(key, fShowInVerticalRulerCheckBox.getSelection());
1384 foregroundColorButton.addSelectionListener(new SelectionListener() {
1385 public void widgetDefaultSelected(SelectionEvent e) {
1388 public void widgetSelected(SelectionEvent e) {
1389 int i = fAnnotationList.getSelectionIndex();
1390 String key = fAnnotationColorListModel[i][1];
1391 PreferenceConverter.setValue(fOverlayStore, key,
1392 fAnnotationForegroundColorEditor.getColorValue());
1395 fDecorationStyleCombo.addSelectionListener(new SelectionListener() {
1399 public void widgetDefaultSelected(SelectionEvent e) {
1405 public void widgetSelected(SelectionEvent e) {
1406 int i = fAnnotationList.getSelectionIndex();
1407 String key = fAnnotationColorListModel[i][6];
1409 for (int j = 0; j < fAnnotationDecorationListModel.length; j++) {
1410 if (fAnnotationDecorationListModel[j][0]
1411 .equals(fDecorationStyleCombo.getText())) {
1412 fOverlayStore.setValue(key, fAnnotationDecorationListModel[j][1]);
1421 private String[][] createAnnotationTypeListModel(
1422 MarkerAnnotationPreferences preferences) {
1423 ArrayList listModelItems = new ArrayList();
1424 SortedSet sortedPreferences = new TreeSet(new Comparator() {
1426 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
1428 public int compare(Object o1, Object o2) {
1429 if (!(o2 instanceof AnnotationPreference))
1431 if (!(o1 instanceof AnnotationPreference))
1433 AnnotationPreference a1 = (AnnotationPreference) o1;
1434 AnnotationPreference a2 = (AnnotationPreference) o2;
1435 return Collator.getInstance().compare(a1.getPreferenceLabel(),
1436 a2.getPreferenceLabel());
1439 sortedPreferences.addAll(preferences.getAnnotationPreferences());
1440 Iterator e = sortedPreferences.iterator();
1441 while (e.hasNext()) {
1442 AnnotationPreference info = (AnnotationPreference) e.next();
1443 listModelItems.add(new String[]{info.getPreferenceLabel(),
1444 info.getColorPreferenceKey(), info.getTextPreferenceKey(),
1445 info.getOverviewRulerPreferenceKey(),
1446 info.getHighlightPreferenceKey(),
1447 info.getVerticalRulerPreferenceKey(),
1448 info.getTextStylePreferenceKey()});
1450 String[][] items = new String[listModelItems.size()][];
1451 listModelItems.toArray(items);
1454 private Control createBehaviourPage(Composite parent) {
1455 Composite composite = new Composite(parent, SWT.NULL);
1456 GridLayout layout = new GridLayout();
1457 layout.numColumns = 2;
1458 composite.setLayout(layout);
1461 // PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings");
1463 // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS,
1465 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd");
1467 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END,
1470 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste");
1472 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE,
1474 label = PHPUIMessages
1475 .getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
1476 addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
1477 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsPHP"); //$NON-NLS-1$
1478 addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS_PHP,
1480 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeBracketsPHP"); //$NON-NLS-1$
1481 addCheckBox(composite, label,
1482 PreferenceConstants.EDITOR_CLOSE_BRACKETS_PHP, 1);
1483 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces");
1485 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES,
1488 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs");
1490 // Button button= addCheckBox(composite, label,
1491 // PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
1493 // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags");
1495 // fAddJavaDocTagsButton= addCheckBox(composite, label,
1496 // PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
1497 // createDependency(button, fAddJavaDocTagsButton);
1498 // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs");
1500 // addCheckBox(composite, label,
1501 // PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
1503 label = PHPUIMessages.getString("PHPEditorPreferencePage.closeStringsHTML"); //$NON-NLS-1$
1504 addCheckBox(composite, label,
1505 PreferenceConstants.EDITOR_CLOSE_STRINGS_HTML, 1);
1506 label = PHPUIMessages
1507 .getString("PHPEditorPreferencePage.closeBracketsHTML"); //$NON-NLS-1$
1508 addCheckBox(composite, label,
1509 PreferenceConstants.EDITOR_CLOSE_BRACKETS_HTML, 1);
1513 private static void indent(Control control) {
1514 GridData gridData = new GridData();
1515 gridData.horizontalIndent = 20;
1516 control.setLayoutData(gridData);
1518 private static void createDependency(final Button master, final Control slave) {
1520 master.addSelectionListener(new SelectionListener() {
1521 public void widgetSelected(SelectionEvent e) {
1522 slave.setEnabled(master.getSelection());
1524 public void widgetDefaultSelected(SelectionEvent e) {
1528 private Control createContentAssistPage(Composite parent) {
1529 Composite contentAssistComposite = new Composite(parent, SWT.NULL);
1530 GridLayout layout = new GridLayout();
1531 layout.numColumns = 2;
1532 contentAssistComposite.setLayout(layout);
1535 // PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically");
1537 // addCheckBox(contentAssistComposite, label,
1538 // PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
1541 // PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext");
1543 // addCheckBox(contentAssistComposite, label,
1544 // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
1547 // PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder");
1549 // addCheckBox(contentAssistComposite, label,
1550 // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
1553 // PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName");
1555 // addCheckBox(contentAssistComposite, label,
1556 // PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
1559 // PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion");
1561 // addCheckBox(contentAssistComposite, label,
1562 // PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
1565 // PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion");
1567 // Button button = addCheckBox(contentAssistComposite, label,
1568 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
1571 // PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion");
1573 // fGuessMethodArgumentsButton =
1574 // addCheckBox(contentAssistComposite, label,
1575 // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
1576 // createDependency(button, fGuessMethodArgumentsButton);
1577 label = PHPUIMessages
1578 .getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
1579 final Button autoactivation = addCheckBox(contentAssistComposite, label,
1580 PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
1581 label = PHPUIMessages
1582 .getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
1583 fAutoInsertDelayText = addTextField(contentAssistComposite, label,
1584 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
1585 label = PHPUIMessages
1586 .getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
1587 fAutoInsertJavaTriggerText = addTextField(contentAssistComposite, label,
1588 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0,
1590 label = PHPUIMessages
1591 .getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
1592 fAutoInsertJavaDocTriggerText = addTextField(contentAssistComposite, label,
1593 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0,
1595 label = PHPUIMessages
1596 .getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
1597 fAutoInsertHTMLTriggerText = addTextField(contentAssistComposite, label,
1598 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0,
1600 label = PHPUIMessages
1601 .getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
1602 addColorButton(contentAssistComposite, label,
1603 PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
1604 label = PHPUIMessages
1605 .getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
1606 addColorButton(contentAssistComposite, label,
1607 PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
1609 // PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters");
1611 // addColorButton(contentAssistComposite, label,
1612 // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
1615 // PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters");
1617 // addColorButton(contentAssistComposite, label,
1618 // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
1620 // PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement");
1622 // addColorButton(contentAssistComposite, label,
1623 // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
1626 // PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement");
1628 // addColorButton(contentAssistComposite, label,
1629 // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
1630 autoactivation.addSelectionListener(new SelectionAdapter() {
1631 public void widgetSelected(SelectionEvent e) {
1632 updateAutoactivationControls();
1635 return contentAssistComposite;
1638 * @see PreferencePage#createContents(Composite)
1640 protected Control createContents(Composite parent) {
1641 initializeDefaultColors();
1642 fOverlayStore.load();
1643 fOverlayStore.start();
1644 TabFolder folder = new TabFolder(parent, SWT.NONE);
1645 folder.setLayout(new TabFolderLayout());
1646 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
1647 TabItem item = new TabItem(folder, SWT.NONE);
1648 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
1649 item.setControl(createAppearancePage(folder));
1650 item = new TabItem(folder, SWT.NONE);
1651 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
1652 item.setControl(createSyntaxPage(folder));
1653 item = new TabItem(folder, SWT.NONE);
1654 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
1655 item.setControl(createContentAssistPage(folder));
1656 item = new TabItem(folder, SWT.NONE);
1657 item.setText(PHPUIMessages
1658 .getString("PHPEditorPreferencePage.annotationsTab.title")); //$NON-NLS-1$
1659 item.setControl(createAnnotationsPage(folder));
1660 item = new TabItem(folder, SWT.NONE);
1661 item.setText(PHPUIMessages
1662 .getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
1663 item.setControl(createBehaviourPage(folder));
1664 item= new TabItem(folder, SWT.NONE);
1665 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title"));
1667 // fJavaEditorHoverConfigurationBlock= new
1668 // JavaEditorHoverConfigurationBlock(fOverlayStore);
1669 // item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
1673 private void initialize() {
1674 fFontEditor.setPreferenceStore(getPreferenceStore());
1675 fFontEditor.setPreferencePage(this);
1678 for (int i = 0; i < fSyntaxColorListModel.length; i++)
1679 fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
1680 fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
1682 if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
1683 fSyntaxColorList.select(0);
1684 handleSyntaxColorListSelection();
1688 for (int i = 0; i < fAppearanceColorListModel.length; i++)
1689 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1690 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1692 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1693 fAppearanceColorList.select(0);
1694 handleAppearanceColorListSelection();
1698 for (int i = 0; i < fAnnotationColorListModel.length; i++)
1699 fAnnotationList.add(fAnnotationColorListModel[i][0]);
1700 fAnnotationList.getDisplay().asyncExec(new Runnable() {
1702 if (fAnnotationList != null && !fAnnotationList.isDisposed()) {
1703 fAnnotationList.select(0);
1704 handleAnnotationListSelection();
1708 // for (int i= 0; i < fContentAssistColorListModel.length; i++)
1709 // fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
1710 // fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
1711 // public void run() {
1712 // if (fContentAssistColorList != null &&
1713 // !fContentAssistColorList.isDisposed()) {
1714 // fContentAssistColorList.select(0);
1715 // handleContentAssistColorListSelection();
1720 private void initializeFields() {
1721 Iterator e = fColorButtons.keySet().iterator();
1722 while (e.hasNext()) {
1723 ColorEditor c = (ColorEditor) e.next();
1724 String key = (String) fColorButtons.get(c);
1725 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
1726 c.setColorValue(rgb);
1728 e = fCheckBoxes.keySet().iterator();
1729 while (e.hasNext()) {
1730 Button b = (Button) e.next();
1731 String key = (String) fCheckBoxes.get(b);
1732 b.setSelection(fOverlayStore.getBoolean(key));
1734 e = fTextFields.keySet().iterator();
1735 while (e.hasNext()) {
1736 Text t = (Text) e.next();
1737 String key = (String) fTextFields.get(t);
1738 t.setText(fOverlayStore.getString(key));
1740 RGB rgb = PreferenceConverter.getColor(fOverlayStore,
1741 PreferenceConstants.EDITOR_BACKGROUND_COLOR);
1742 fBackgroundColorEditor.setColorValue(rgb);
1743 boolean default_ = fOverlayStore
1744 .getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
1745 fBackgroundDefaultRadioButton.setSelection(default_);
1746 fBackgroundCustomRadioButton.setSelection(!default_);
1747 fBackgroundColorButton.setEnabled(!default_);
1748 // boolean closeJavaDocs=
1749 // fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
1750 // fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
1751 // boolean fillMethodArguments =
1752 // fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
1753 // fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
1754 updateAutoactivationControls();
1755 // fJavaEditorHoverConfigurationBlock.initializeFields();
1758 private void initializeDefaultColors() {
1759 if (!getPreferenceStore().contains(PreferenceConstants.EDITOR_BACKGROUND_COLOR)) {
1760 RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
1761 PreferenceConverter.setDefault(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR, rgb);
1762 PreferenceConverter.setDefault(getPreferenceStore(), PreferenceConstants.EDITOR_BACKGROUND_COLOR, rgb);
1764 if (!getPreferenceStore().contains(PreferenceConstants.EDITOR_FOREGROUND_COLOR)) {
1765 RGB rgb= getControl().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB();
1766 PreferenceConverter.setDefault(fOverlayStore, PreferenceConstants.EDITOR_FOREGROUND_COLOR, rgb);
1767 PreferenceConverter.setDefault(getPreferenceStore(), PreferenceConstants.EDITOR_FOREGROUND_COLOR, rgb);
1771 private void updateAutoactivationControls() {
1772 boolean autoactivation = fOverlayStore
1773 .getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
1774 fAutoInsertDelayText.setEnabled(autoactivation);
1775 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
1776 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
1777 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
1780 * @see PreferencePage#performOk()
1782 public boolean performOk() {
1783 fFontEditor.store();
1784 // fJavaEditorHoverConfigurationBlock.performOk();
1785 fOverlayStore.propagate();
1786 // fUserDefinedPHPSyntaxFileFFE.store();
1787 PHPeclipsePlugin.getDefault().savePluginPreferences();
1791 * @see PreferencePage#performDefaults()
1793 protected void performDefaults() {
1794 fFontEditor.loadDefault();
1795 fOverlayStore.loadDefaults();
1797 // fUserDefinedPHPSyntaxFileFFE.loadDefault();
1798 handleSyntaxColorListSelection();
1799 handleAppearanceColorListSelection();
1800 handleAnnotationListSelection();
1801 // handleContentAssistColorListSelection();
1802 super.performDefaults();
1803 fPreviewViewer.invalidateTextPresentation();
1806 * @see DialogPage#dispose()
1808 public void dispose() {
1809 if (fJavaTextTools != null) {
1810 fJavaTextTools = null;
1812 fFontEditor.setPreferencePage(null);
1813 fFontEditor.setPreferenceStore(null);
1814 if (fOverlayStore != null) {
1815 fOverlayStore.stop();
1816 fOverlayStore = null;
1820 private Control addColorButton(Composite composite, String label, String key,
1822 Label labelControl = new Label(composite, SWT.NONE);
1823 labelControl.setText(label);
1824 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1825 gd.horizontalIndent = indentation;
1826 labelControl.setLayoutData(gd);
1827 ColorEditor editor = new ColorEditor(composite);
1828 Button button = editor.getButton();
1829 button.setData(editor);
1830 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1831 button.setLayoutData(gd);
1832 button.addSelectionListener(fColorButtonListener);
1833 fColorButtons.put(editor, key);
1836 private void addFiller(Composite composite) {
1837 Label filler = new Label(composite, SWT.LEFT);
1838 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1839 gd.horizontalSpan = 2;
1840 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
1841 filler.setLayoutData(gd);
1843 private Button addCheckBox(Composite parent, String label, String key,
1845 Button checkBox = new Button(parent, SWT.CHECK);
1846 checkBox.setText(label);
1847 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1848 gd.horizontalIndent = indentation;
1849 gd.horizontalSpan = 2;
1850 checkBox.setLayoutData(gd);
1851 checkBox.addSelectionListener(fCheckBoxListener);
1852 fCheckBoxes.put(checkBox, key);
1855 private Control addTextField(Composite composite, String label, String key,
1856 int textLimit, int indentation, boolean isNumber) {
1857 Label labelControl = new Label(composite, SWT.NONE);
1858 labelControl.setText(label);
1859 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1860 gd.horizontalIndent = indentation;
1861 labelControl.setLayoutData(gd);
1862 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
1863 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1864 gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
1865 textControl.setLayoutData(gd);
1866 textControl.setTextLimit(textLimit);
1867 fTextFields.put(textControl, key);
1869 fNumberFields.add(textControl);
1870 textControl.addModifyListener(fNumberFieldListener);
1872 textControl.addModifyListener(fTextFieldListener);
1876 private void addTextFontEditor(Composite parent, String label, String key) {
1877 Composite editorComposite = new Composite(parent, SWT.NONE);
1878 GridLayout layout = new GridLayout();
1879 layout.numColumns = 3;
1880 editorComposite.setLayout(layout);
1881 fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label,
1883 fFontEditor.setChangeButtonText(PHPUIMessages
1884 .getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
1885 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1886 gd.horizontalSpan = 2;
1887 editorComposite.setLayoutData(gd);
1889 private String loadPreviewContentFromFile(String filename) {
1891 String separator = System.getProperty("line.separator"); //$NON-NLS-1$
1892 StringBuffer buffer = new StringBuffer(512);
1893 BufferedReader reader = null;
1895 reader = new BufferedReader(new InputStreamReader(getClass()
1896 .getResourceAsStream(filename)));
1897 while ((line = reader.readLine()) != null) {
1898 buffer.append(line);
1899 buffer.append(separator);
1901 } catch (IOException io) {
1902 PHPeclipsePlugin.log(io);
1904 if (reader != null) {
1907 } catch (IOException e) {
1911 return buffer.toString();
1913 private void numberFieldChanged(Text textControl) {
1914 String number = textControl.getText();
1915 IStatus status = validatePositiveNumber(number);
1916 if (!status.matches(IStatus.ERROR))
1917 fOverlayStore.setValue((String) fTextFields.get(textControl), number);
1918 updateStatus(status);
1920 private IStatus validatePositiveNumber(String number) {
1921 StatusInfo status = new StatusInfo();
1922 if (number.length() == 0) {
1923 status.setError(PHPUIMessages
1924 .getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
1927 int value = Integer.parseInt(number);
1929 status.setError(PHPUIMessages.getFormattedString(
1930 "PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1931 } catch (NumberFormatException e) {
1932 status.setError(PHPUIMessages.getFormattedString(
1933 "PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1938 private void updateStatus(IStatus status) {
1939 if (!status.matches(IStatus.ERROR)) {
1940 for (int i = 0; i < fNumberFields.size(); i++) {
1941 Text text = (Text) fNumberFields.get(i);
1942 IStatus s = validatePositiveNumber(text.getText());
1943 status = StatusUtil.getMoreSevere(s, status);
1946 setValid(!status.matches(IStatus.ERROR));
1947 StatusUtil.applyToStatusLine(this, status);
1950 * @deprecated Inline to avoid reference to preference page
1952 public static boolean indicateQuixFixableProblems() {
1953 return PreferenceConstants.getPreferenceStore().getBoolean(
1954 PreferenceConstants.EDITOR_CORRECTION_INDICATION);
1957 * @deprecated Inline to avoid reference to preference page
1959 // static public boolean synchronizeOutlineOnCursorMove() {
1961 // PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);