1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
10 **********************************************************************/
12 package net.sourceforge.phpdt.internal.ui.preferences;
14 import java.io.BufferedReader;
15 import java.io.IOException;
16 import java.io.InputStreamReader;
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.Iterator;
22 import net.sourceforge.phpdt.internal.ui.PHPUIMessages;
23 import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
24 import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil;
25 import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout;
26 import net.sourceforge.phpdt.ui.PreferenceConstants;
27 import net.sourceforge.phpdt.ui.text.JavaTextTools;
28 import net.sourceforge.phpeclipse.IPreferenceConstants;
29 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
30 import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
31 import net.sourceforge.phpeclipse.preferences.ColorEditor;
32 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
34 import org.eclipse.core.runtime.IStatus;
35 import org.eclipse.jface.preference.FileFieldEditor;
36 import org.eclipse.jface.preference.IPreferenceStore;
37 import org.eclipse.jface.preference.PreferenceConverter;
38 import org.eclipse.jface.preference.PreferencePage;
39 import org.eclipse.jface.resource.JFaceResources;
40 import org.eclipse.jface.text.Document;
41 import org.eclipse.jface.text.IDocument;
42 import org.eclipse.jface.text.IDocumentPartitioner;
43 import org.eclipse.jface.text.source.ISourceViewer;
44 import org.eclipse.jface.text.source.SourceViewer;
45 import org.eclipse.jface.util.IPropertyChangeListener;
46 import org.eclipse.jface.util.PropertyChangeEvent;
47 import org.eclipse.swt.SWT;
48 import org.eclipse.swt.custom.StyledText;
49 import org.eclipse.swt.events.ModifyEvent;
50 import org.eclipse.swt.events.ModifyListener;
51 import org.eclipse.swt.events.SelectionAdapter;
52 import org.eclipse.swt.events.SelectionEvent;
53 import org.eclipse.swt.events.SelectionListener;
54 import org.eclipse.swt.graphics.Color;
55 import org.eclipse.swt.graphics.RGB;
56 import org.eclipse.swt.layout.GridData;
57 import org.eclipse.swt.layout.GridLayout;
58 import org.eclipse.swt.layout.RowLayout;
59 import org.eclipse.swt.widgets.Button;
60 import org.eclipse.swt.widgets.Composite;
61 import org.eclipse.swt.widgets.Control;
62 import org.eclipse.swt.widgets.Display;
63 import org.eclipse.swt.widgets.Group;
64 import org.eclipse.swt.widgets.Label;
65 import org.eclipse.swt.widgets.List;
66 import org.eclipse.swt.widgets.TabFolder;
67 import org.eclipse.swt.widgets.TabItem;
68 import org.eclipse.swt.widgets.Text;
69 import org.eclipse.ui.IWorkbench;
70 import org.eclipse.ui.IWorkbenchPreferencePage;
71 import org.eclipse.ui.texteditor.AbstractTextEditor;
72 import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
75 * The page for setting the editor options.
77 public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
79 private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX;
81 public final OverlayPreferenceStore.OverlayKey[] fKeys =
82 new OverlayPreferenceStore.OverlayKey[] {
83 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FOREGROUND_COLOR),
84 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOREGROUND_DEFAULT_COLOR),
85 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BACKGROUND_COLOR),
86 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR),
87 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_TAB_WIDTH),
88 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR),
89 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_BOLD),
90 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR),
91 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_BOLD),
92 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR),
93 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_KEYWORD_BOLD),
94 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR),
95 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_BOLD),
96 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR),
97 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_VARIABLE_BOLD),
98 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR),
99 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_CONSTANT_BOLD),
100 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PHP_TYPE_COLOR),
101 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PHP_TYPE_BOLD),
102 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_STRING_COLOR),
103 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_STRING_BOLD),
104 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR),
105 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVA_DEFAULT_BOLD),
106 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR),
107 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_KEYWORD_BOLD),
108 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
109 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD),
110 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR),
111 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_LINKS_BOLD),
112 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR),
113 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_JAVADOC_DEFAULT_BOLD),
114 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR),
115 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_MATCHING_BRACKETS),
116 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CURRENT_LINE_COLOR),
117 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CURRENT_LINE),
118 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR),
119 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN),
120 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PRINT_MARGIN),
121 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_FIND_SCOPE_COLOR),
122 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINKED_POSITION_COLOR),
123 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINK_COLOR),
124 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR),
125 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_PROBLEM_INDICATION),
126 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR),
127 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WARNING_INDICATION),
128 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR),
129 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION),
130 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR),
131 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_BOOKMARK_INDICATION),
132 new OverlayPreferenceStore.OverlayKey(
133 OverlayPreferenceStore.STRING,
134 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR),
135 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION),
136 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR),
137 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_UNKNOWN_INDICATION),
138 new OverlayPreferenceStore.OverlayKey(
139 OverlayPreferenceStore.BOOLEAN,
140 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER),
141 new OverlayPreferenceStore.OverlayKey(
142 OverlayPreferenceStore.BOOLEAN,
143 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER),
144 new OverlayPreferenceStore.OverlayKey(
145 OverlayPreferenceStore.BOOLEAN,
146 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER),
147 new OverlayPreferenceStore.OverlayKey(
148 OverlayPreferenceStore.BOOLEAN,
149 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER),
150 new OverlayPreferenceStore.OverlayKey(
151 OverlayPreferenceStore.BOOLEAN,
152 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER),
153 new OverlayPreferenceStore.OverlayKey(
154 OverlayPreferenceStore.BOOLEAN,
155 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER),
156 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CORRECTION_INDICATION),
157 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE),
158 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS),
159 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_OVERVIEW_RULER),
160 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR),
161 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_LINE_NUMBER_RULER),
162 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SPACES_FOR_TABS),
163 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION),
164 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY),
165 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT),
166 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND),
167 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND),
168 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND),
169 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND),
170 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND),
171 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND),
172 new OverlayPreferenceStore.OverlayKey(
173 OverlayPreferenceStore.STRING,
174 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA),
175 new OverlayPreferenceStore.OverlayKey(
176 OverlayPreferenceStore.STRING,
177 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC),
178 new OverlayPreferenceStore.OverlayKey(
179 OverlayPreferenceStore.STRING,
180 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML),
181 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS),
182 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS),
183 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY),
184 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT),
185 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION),
186 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES),
187 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS),
188 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
189 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS),
190 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS),
191 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
192 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_JAVADOCS),
193 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
194 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS),
195 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FORMAT_JAVADOCS),
196 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_HOME_END),
197 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_DEFAULT_HOVER),
198 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_NONE_HOVER),
199 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_HOVER),
200 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SHIFT_HOVER),
201 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
202 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_HOVER),
203 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_ALT_SHIFT_HOVER),
204 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_CTRL_SHIFT_HOVER),
205 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_ALT_SHIFT_HOVER),
206 new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, IPreferenceConstants.PHP_USERDEF_XMLFILE),
209 private final String[][] fSyntaxColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$
211 PHPUIMessages.getString("PHPEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$
213 PHPUIMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$
215 PHPUIMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$
217 PHPUIMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$
219 PHPUIMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$
221 PHPUIMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$
223 PHPUIMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$
225 PHPUIMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$
227 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$
229 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_BOLD }, //$NON-NLS-1$
231 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$
233 PHPUIMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$
236 private final String[][] fAppearanceColorListModel = new String[][] { { PHPUIMessages.getString("PHPEditorPreferencePage.lineNumberForegroundColor"), PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR }, //$NON-NLS-1$
238 PHPUIMessages.getString("PHPEditorPreferencePage.matchingBracketsHighlightColor2"), PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR }, //$NON-NLS-1$
240 PHPUIMessages.getString("PHPEditorPreferencePage.currentLineHighlighColor"), PreferenceConstants.EDITOR_CURRENT_LINE_COLOR }, //$NON-NLS-1$
242 PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColor2"), PreferenceConstants.EDITOR_PRINT_MARGIN_COLOR }, //$NON-NLS-1$
244 PHPUIMessages.getString("PHPEditorPreferencePage.findScopeColor2"), PreferenceConstants.EDITOR_FIND_SCOPE_COLOR }, //$NON-NLS-1$
246 PHPUIMessages.getString("PHPEditorPreferencePage.linkedPositionColor2"), PreferenceConstants.EDITOR_LINKED_POSITION_COLOR }, //$NON-NLS-1$
248 PHPUIMessages.getString("PHPEditorPreferencePage.linkColor2"), PreferenceConstants.EDITOR_LINK_COLOR }, //$NON-NLS-1$
251 private final String[][] fProblemIndicationColorListModel =
255 PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR,
256 PreferenceConstants.EDITOR_PROBLEM_INDICATION,
257 PreferenceConstants.EDITOR_ERROR_INDICATION_IN_OVERVIEW_RULER },
260 PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR,
261 PreferenceConstants.EDITOR_WARNING_INDICATION,
262 PreferenceConstants.EDITOR_WARNING_INDICATION_IN_OVERVIEW_RULER },
265 PreferenceConstants.EDITOR_TASK_INDICATION_COLOR,
266 PreferenceConstants.EDITOR_TASK_INDICATION,
267 PreferenceConstants.EDITOR_TASK_INDICATION_IN_OVERVIEW_RULER },
270 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_COLOR,
271 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION,
272 PreferenceConstants.EDITOR_SEARCH_RESULT_INDICATION_IN_OVERVIEW_RULER },
275 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_COLOR,
276 PreferenceConstants.EDITOR_BOOKMARK_INDICATION,
277 PreferenceConstants.EDITOR_BOOKMARK_INDICATION_IN_OVERVIEW_RULER },
280 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_COLOR,
281 PreferenceConstants.EDITOR_UNKNOWN_INDICATION,
282 PreferenceConstants.EDITOR_UNKNOWN_INDICATION_IN_OVERVIEW_RULER }
285 private OverlayPreferenceStore fOverlayStore;
286 private JavaTextTools fJavaTextTools;
287 // private JavaEditorHoverConfigurationBlock fJavaEditorHoverConfigurationBlock;
289 private Map fColorButtons = new HashMap();
290 private SelectionListener fColorButtonListener = new SelectionListener() {
291 public void widgetDefaultSelected(SelectionEvent e) {
293 public void widgetSelected(SelectionEvent e) {
294 ColorEditor editor = (ColorEditor) e.widget.getData();
295 PreferenceConverter.setValue(fOverlayStore, (String) fColorButtons.get(editor), editor.getColorValue());
299 private Map fCheckBoxes = new HashMap();
300 private SelectionListener fCheckBoxListener = new SelectionListener() {
301 public void widgetDefaultSelected(SelectionEvent e) {
303 public void widgetSelected(SelectionEvent e) {
304 Button button = (Button) e.widget;
305 fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
309 private Map fTextFields = new HashMap();
310 private ModifyListener fTextFieldListener = new ModifyListener() {
311 public void modifyText(ModifyEvent e) {
312 Text text = (Text) e.widget;
313 fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
317 private ArrayList fNumberFields = new ArrayList();
318 private ModifyListener fNumberFieldListener = new ModifyListener() {
319 public void modifyText(ModifyEvent e) {
320 numberFieldChanged((Text) e.widget);
324 private WorkbenchChainedTextFontFieldEditor fFontEditor;
325 private List fSyntaxColorList;
326 private List fAppearanceColorList;
327 private List fProblemIndicationList;
328 private ColorEditor fSyntaxForegroundColorEditor;
329 private ColorEditor fAppearanceForegroundColorEditor;
330 private ColorEditor fProblemIndicationForegroundColorEditor;
331 private ColorEditor fBackgroundColorEditor;
332 private Button fBackgroundDefaultRadioButton;
333 private Button fBackgroundCustomRadioButton;
334 private Button fBackgroundColorButton;
335 private Button fBoldCheckBox;
336 // private Button fAddJavaDocTagsButton;
337 // private Button fGuessMethodArgumentsButton;
338 private SourceViewer fPreviewViewer;
339 private Color fBackgroundColor;
340 private Control fAutoInsertDelayText;
341 private Control fAutoInsertJavaTriggerText;
342 private Control fAutoInsertJavaDocTriggerText;
343 private Control fAutoInsertHTMLTriggerText;
344 private Button fShowInTextCheckBox;
345 private Button fShowInOverviewRulerCheckBox;
346 // private FileFieldEditor fUserDefinedPHPSyntaxFileFFE;
348 public PHPEditorPreferencePage() {
349 setDescription(PHPUIMessages.getString("PHPEditorPreferencePage.description")); //$NON-NLS-1$
350 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
351 fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), fKeys);
355 * @see IWorkbenchPreferencePage#init()
357 public void init(IWorkbench workbench) {
361 * @see PreferencePage#createControl(Composite)
363 public void createControl(Composite parent) {
364 super.createControl(parent);
365 // WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
368 private void handleSyntaxColorListSelection() {
369 int i = fSyntaxColorList.getSelectionIndex();
370 String key = fSyntaxColorListModel[i][1];
371 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
372 fSyntaxForegroundColorEditor.setColorValue(rgb);
373 fBoldCheckBox.setSelection(fOverlayStore.getBoolean(key + BOLD));
376 private void handleAppearanceColorListSelection() {
377 int i = fAppearanceColorList.getSelectionIndex();
378 String key = fAppearanceColorListModel[i][1];
379 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
380 fAppearanceForegroundColorEditor.setColorValue(rgb);
383 private void handleProblemIndicationColorListSelection() {
384 int i = fProblemIndicationList.getSelectionIndex();
386 String key = fProblemIndicationColorListModel[i][1];
387 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
388 fProblemIndicationForegroundColorEditor.setColorValue(rgb);
390 key = fProblemIndicationColorListModel[i][2];
391 fShowInTextCheckBox.setSelection(fOverlayStore.getBoolean(key));
393 key = fProblemIndicationColorListModel[i][3];
394 fShowInOverviewRulerCheckBox.setSelection(fOverlayStore.getBoolean(key));
397 private Control createSyntaxPage(Composite parent) {
399 Composite colorComposite = new Composite(parent, SWT.NULL);
400 colorComposite.setLayout(new GridLayout());
402 Group backgroundComposite = new Group(colorComposite, SWT.SHADOW_ETCHED_IN);
403 backgroundComposite.setLayout(new RowLayout());
404 backgroundComposite.setText(PHPUIMessages.getString("PHPEditorPreferencePage.backgroundColor")); //$NON-NLS-1$
406 SelectionListener backgroundSelectionListener = new SelectionListener() {
407 public void widgetSelected(SelectionEvent e) {
408 boolean custom = fBackgroundCustomRadioButton.getSelection();
409 fBackgroundColorButton.setEnabled(custom);
410 fOverlayStore.setValue(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR, !custom);
412 public void widgetDefaultSelected(SelectionEvent e) {
416 fBackgroundDefaultRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
417 fBackgroundDefaultRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.systemDefault")); //$NON-NLS-1$
418 fBackgroundDefaultRadioButton.addSelectionListener(backgroundSelectionListener);
420 fBackgroundCustomRadioButton = new Button(backgroundComposite, SWT.RADIO | SWT.LEFT);
421 fBackgroundCustomRadioButton.setText(PHPUIMessages.getString("PHPEditorPreferencePage.custom")); //$NON-NLS-1$
422 fBackgroundCustomRadioButton.addSelectionListener(backgroundSelectionListener);
424 fBackgroundColorEditor = new ColorEditor(backgroundComposite);
425 fBackgroundColorButton = fBackgroundColorEditor.getButton();
427 // fUserDefinedPHPSyntaxFileFFE =
428 // new FileFieldEditor(
429 // IPreferenceConstants.PHP_USERDEF_XMLFILE,
430 // PHPPreferencesMessages.getString("PHPEditorSyntaxPreferencePage.syntaxdialog"),
432 // fUserDefinedPHPSyntaxFileFFE.setPreferencePage(this);
433 // fUserDefinedPHPSyntaxFileFFE.setPreferenceStore(getPreferenceStore());
434 // fUserDefinedPHPSyntaxFileFFE.load();
436 Label label = new Label(colorComposite, SWT.LEFT);
437 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.foreground")); //$NON-NLS-1$
438 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
440 Composite editorComposite = new Composite(colorComposite, SWT.NONE);
441 GridLayout layout = new GridLayout();
442 layout.numColumns = 2;
443 layout.marginHeight = 0;
444 layout.marginWidth = 0;
445 editorComposite.setLayout(layout);
446 GridData gd = new GridData(GridData.FILL_BOTH);
447 editorComposite.setLayoutData(gd);
449 fSyntaxColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
450 gd = new GridData(GridData.FILL_BOTH);
451 gd.heightHint = convertHeightInCharsToPixels(5);
452 fSyntaxColorList.setLayoutData(gd);
454 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
455 layout = new GridLayout();
456 layout.marginHeight = 0;
457 layout.marginWidth = 0;
458 layout.numColumns = 2;
459 stylesComposite.setLayout(layout);
460 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
462 label = new Label(stylesComposite, SWT.LEFT);
463 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
465 gd.horizontalAlignment = GridData.BEGINNING;
466 label.setLayoutData(gd);
468 fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
469 Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
470 gd = new GridData(GridData.FILL_HORIZONTAL);
471 gd.horizontalAlignment = GridData.BEGINNING;
472 foregroundColorButton.setLayoutData(gd);
474 fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
475 fBoldCheckBox.setText(PHPUIMessages.getString("PHPEditorPreferencePage.bold")); //$NON-NLS-1$
476 gd = new GridData(GridData.FILL_HORIZONTAL);
477 gd.horizontalAlignment = GridData.BEGINNING;
478 gd.horizontalSpan = 2;
479 fBoldCheckBox.setLayoutData(gd);
481 label = new Label(colorComposite, SWT.LEFT);
482 label.setText(PHPUIMessages.getString("PHPEditorPreferencePage.preview")); //$NON-NLS-1$
483 label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
485 Control previewer = createPreviewer(colorComposite);
486 gd = new GridData(GridData.FILL_BOTH);
487 gd.widthHint = convertWidthInCharsToPixels(20);
488 gd.heightHint = convertHeightInCharsToPixels(5);
489 previewer.setLayoutData(gd);
491 fSyntaxColorList.addSelectionListener(new SelectionListener() {
492 public void widgetDefaultSelected(SelectionEvent e) {
495 public void widgetSelected(SelectionEvent e) {
496 handleSyntaxColorListSelection();
500 foregroundColorButton.addSelectionListener(new SelectionListener() {
501 public void widgetDefaultSelected(SelectionEvent e) {
504 public void widgetSelected(SelectionEvent e) {
505 int i = fSyntaxColorList.getSelectionIndex();
506 String key = fSyntaxColorListModel[i][1];
508 PreferenceConverter.setValue(fOverlayStore, key, fSyntaxForegroundColorEditor.getColorValue());
512 fBackgroundColorButton.addSelectionListener(new SelectionListener() {
513 public void widgetDefaultSelected(SelectionEvent e) {
516 public void widgetSelected(SelectionEvent e) {
517 PreferenceConverter.setValue(
519 PreferenceConstants.EDITOR_BACKGROUND_COLOR,
520 fBackgroundColorEditor.getColorValue());
524 fBoldCheckBox.addSelectionListener(new SelectionListener() {
525 public void widgetDefaultSelected(SelectionEvent e) {
528 public void widgetSelected(SelectionEvent e) {
529 int i = fSyntaxColorList.getSelectionIndex();
530 String key = fSyntaxColorListModel[i][1];
531 fOverlayStore.setValue(key + BOLD, fBoldCheckBox.getSelection());
535 return colorComposite;
538 private Control createPreviewer(Composite parent) {
540 fJavaTextTools = new JavaTextTools(fOverlayStore);
542 fPreviewViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
543 fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null));
544 fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
545 fPreviewViewer.setEditable(false);
547 initializeViewerColors(fPreviewViewer);
549 String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$
550 IDocument document = new Document(content);
551 // PHPEditorEnvironment pe;
552 IDocumentPartitioner partitioner = fJavaTextTools.createDocumentPartitioner();
553 partitioner.connect(document);
554 document.setDocumentPartitioner(partitioner);
556 fPreviewViewer.setDocument(document);
558 fOverlayStore.addPropertyChangeListener(new IPropertyChangeListener() {
559 public void propertyChange(PropertyChangeEvent event) {
560 String p = event.getProperty();
561 if (p.equals(PreferenceConstants.EDITOR_BACKGROUND_COLOR)
562 || p.equals(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)) {
563 initializeViewerColors(fPreviewViewer);
566 fPreviewViewer.invalidateTextPresentation();
570 return fPreviewViewer.getControl();
574 * Initializes the given viewer's colors.
576 * @param viewer the viewer to be initialized
578 private void initializeViewerColors(ISourceViewer viewer) {
580 IPreferenceStore store = fOverlayStore;
583 StyledText styledText = viewer.getTextWidget();
585 // ---------- background color ----------------------
587 store.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR)
589 : createColor(store, PreferenceConstants.EDITOR_BACKGROUND_COLOR, styledText.getDisplay());
590 styledText.setBackground(color);
592 if (fBackgroundColor != null)
593 fBackgroundColor.dispose();
595 fBackgroundColor = color;
600 * Creates a color from the information stored in the given preference store.
601 * Returns <code>null</code> if there is no such information available.
603 private Color createColor(IPreferenceStore store, String key, Display display) {
607 if (store.contains(key)) {
609 if (store.isDefault(key))
610 rgb = PreferenceConverter.getDefaultColor(store, key);
612 rgb = PreferenceConverter.getColor(store, key);
615 return new Color(display, rgb);
621 // sets enabled flag for a control and all its sub-tree
622 private static void setEnabled(Control control, boolean enable) {
623 control.setEnabled(enable);
624 if (control instanceof Composite) {
625 Composite composite = (Composite) control;
626 Control[] children = composite.getChildren();
627 for (int i = 0; i < children.length; i++)
628 setEnabled(children[i], enable);
632 private Control createAppearancePage(Composite parent) {
634 Composite appearanceComposite = new Composite(parent, SWT.NONE);
635 GridLayout layout = new GridLayout();
636 layout.numColumns = 2;
637 appearanceComposite.setLayout(layout);
639 String label = PHPUIMessages.getString("PHPEditorPreferencePage.textFont"); //$NON-NLS-1$
640 addTextFontEditor(appearanceComposite, label, AbstractTextEditor.PREFERENCE_FONT);
642 label = PHPUIMessages.getString("PHPEditorPreferencePage.displayedTabWidth"); //$NON-NLS-1$
643 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_TAB_WIDTH, 3, 0, true);
645 label = PHPUIMessages.getString("PHPEditorPreferencePage.printMarginColumn"); //$NON-NLS-1$
646 addTextField(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 3, 0, true);
648 // label= PHPUIMessages.getString("PHPEditorPreferencePage.synchronizeOnCursor"); //$NON-NLS-1$
649 // addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, 0);
651 label = PHPUIMessages.getString("PHPEditorPreferencePage.showOverviewRuler"); //$NON-NLS-1$
652 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_OVERVIEW_RULER, 0);
654 label = PHPUIMessages.getString("PHPEditorPreferencePage.showLineNumbers"); //$NON-NLS-1$
655 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_LINE_NUMBER_RULER, 0);
657 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightMatchingBrackets"); //$NON-NLS-1$
658 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_MATCHING_BRACKETS, 0);
660 label = PHPUIMessages.getString("PHPEditorPreferencePage.highlightCurrentLine"); //$NON-NLS-1$
661 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_CURRENT_LINE, 0);
663 label = PHPUIMessages.getString("PHPEditorPreferencePage.showPrintMargin"); //$NON-NLS-1$
664 addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_PRINT_MARGIN, 0);
666 Label l = new Label(appearanceComposite, SWT.LEFT);
667 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
668 gd.horizontalSpan = 2;
669 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
672 l = new Label(appearanceComposite, SWT.LEFT);
673 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.appearanceOptions")); //$NON-NLS-1$
674 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
675 gd.horizontalSpan = 2;
678 Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
679 layout = new GridLayout();
680 layout.numColumns = 2;
681 layout.marginHeight = 0;
682 layout.marginWidth = 0;
683 editorComposite.setLayout(layout);
684 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
685 gd.horizontalSpan = 2;
686 editorComposite.setLayoutData(gd);
688 fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
689 gd = new GridData(GridData.FILL_BOTH);
690 gd.heightHint = convertHeightInCharsToPixels(5);
691 fAppearanceColorList.setLayoutData(gd);
693 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
694 layout = new GridLayout();
695 layout.marginHeight = 0;
696 layout.marginWidth = 0;
697 layout.numColumns = 2;
698 stylesComposite.setLayout(layout);
699 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
701 l = new Label(stylesComposite, SWT.LEFT);
702 l.setText(PHPUIMessages.getString("PHPEditorPreferencePage.color")); //$NON-NLS-1$
704 gd.horizontalAlignment = GridData.BEGINNING;
707 fAppearanceForegroundColorEditor = new ColorEditor(stylesComposite);
708 Button foregroundColorButton = fAppearanceForegroundColorEditor.getButton();
709 gd = new GridData(GridData.FILL_HORIZONTAL);
710 gd.horizontalAlignment = GridData.BEGINNING;
711 foregroundColorButton.setLayoutData(gd);
713 fAppearanceColorList.addSelectionListener(new SelectionListener() {
714 public void widgetDefaultSelected(SelectionEvent e) {
717 public void widgetSelected(SelectionEvent e) {
718 handleAppearanceColorListSelection();
721 foregroundColorButton.addSelectionListener(new SelectionListener() {
722 public void widgetDefaultSelected(SelectionEvent e) {
725 public void widgetSelected(SelectionEvent e) {
726 int i = fAppearanceColorList.getSelectionIndex();
727 String key = fAppearanceColorListModel[i][1];
729 PreferenceConverter.setValue(fOverlayStore, key, fAppearanceForegroundColorEditor.getColorValue());
732 return appearanceComposite;
735 private Control createProblemIndicationPage(Composite parent) {
736 Composite composite = new Composite(parent, SWT.NULL);
737 GridLayout layout = new GridLayout();
738 layout.numColumns = 2;
739 composite.setLayout(layout);
741 // String text = "Analyse &problems while typing";
742 // addCheckBox(composite, text, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS, 0);
744 // text = PHPUIMessages.getString("PHPEditorPreferencePage.showQuickFixables"); //$NON-NLS-1$
745 // addCheckBox(composite, text, PreferenceConstants.EDITOR_CORRECTION_INDICATION, 0);
747 Label label = new Label(composite, SWT.LEFT);
748 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
749 gd.horizontalSpan = 2;
750 gd.heightHint = convertHeightInCharsToPixels(1) / 2;
751 label.setLayoutData(gd);
753 label = new Label(composite, SWT.LEFT);
754 label.setText("&Marker presentation options:");
755 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
756 gd.horizontalSpan = 2;
757 label.setLayoutData(gd);
759 Composite editorComposite = new Composite(composite, SWT.NONE);
760 layout = new GridLayout();
761 layout.numColumns = 2;
762 layout.marginHeight = 0;
763 layout.marginWidth = 0;
764 editorComposite.setLayout(layout);
765 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
766 gd.horizontalSpan = 2;
767 editorComposite.setLayoutData(gd);
769 fProblemIndicationList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
770 gd = new GridData(GridData.FILL_BOTH);
771 gd.heightHint = convertHeightInCharsToPixels(5);
772 fProblemIndicationList.setLayoutData(gd);
774 Composite optionsComposite = new Composite(editorComposite, SWT.NONE);
775 layout = new GridLayout();
776 layout.marginHeight = 0;
777 layout.marginWidth = 0;
778 layout.numColumns = 2;
779 optionsComposite.setLayout(layout);
780 optionsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
782 fShowInTextCheckBox = new Button(optionsComposite, SWT.CHECK);
783 fShowInTextCheckBox.setText("Show in &text");
784 gd = new GridData(GridData.FILL_HORIZONTAL);
785 gd.horizontalAlignment = GridData.BEGINNING;
786 gd.horizontalSpan = 2;
787 fShowInTextCheckBox.setLayoutData(gd);
789 fShowInOverviewRulerCheckBox = new Button(optionsComposite, SWT.CHECK);
790 fShowInOverviewRulerCheckBox.setText("Show in overview &ruler");
791 gd = new GridData(GridData.FILL_HORIZONTAL);
792 gd.horizontalAlignment = GridData.BEGINNING;
793 gd.horizontalSpan = 2;
794 fShowInOverviewRulerCheckBox.setLayoutData(gd);
796 label = new Label(optionsComposite, SWT.LEFT);
797 label.setText("C&olor:");
799 gd.horizontalAlignment = GridData.BEGINNING;
800 label.setLayoutData(gd);
802 fProblemIndicationForegroundColorEditor = new ColorEditor(optionsComposite);
803 Button foregroundColorButton = fProblemIndicationForegroundColorEditor.getButton();
804 gd = new GridData(GridData.FILL_HORIZONTAL);
805 gd.horizontalAlignment = GridData.BEGINNING;
806 foregroundColorButton.setLayoutData(gd);
808 fProblemIndicationList.addSelectionListener(new SelectionListener() {
809 public void widgetDefaultSelected(SelectionEvent e) {
813 public void widgetSelected(SelectionEvent e) {
814 handleProblemIndicationColorListSelection();
818 fShowInTextCheckBox.addSelectionListener(new SelectionListener() {
819 public void widgetDefaultSelected(SelectionEvent e) {
823 public void widgetSelected(SelectionEvent e) {
824 int i = fProblemIndicationList.getSelectionIndex();
825 String key = fProblemIndicationColorListModel[i][2];
826 fOverlayStore.setValue(key, fShowInTextCheckBox.getSelection());
830 fShowInOverviewRulerCheckBox.addSelectionListener(new SelectionListener() {
831 public void widgetDefaultSelected(SelectionEvent e) {
835 public void widgetSelected(SelectionEvent e) {
836 int i = fProblemIndicationList.getSelectionIndex();
837 String key = fProblemIndicationColorListModel[i][3];
838 fOverlayStore.setValue(key, fShowInOverviewRulerCheckBox.getSelection());
842 foregroundColorButton.addSelectionListener(new SelectionListener() {
843 public void widgetDefaultSelected(SelectionEvent e) {
847 public void widgetSelected(SelectionEvent e) {
848 int i = fProblemIndicationList.getSelectionIndex();
849 String key = fProblemIndicationColorListModel[i][1];
850 PreferenceConverter.setValue(fOverlayStore, key, fProblemIndicationForegroundColorEditor.getColorValue());
857 // private Control createBehaviourPage(Composite parent) {
858 // Composite composite= new Composite(parent, SWT.NULL);
859 // GridLayout layout= new GridLayout(); layout.numColumns= 2;
860 // composite.setLayout(layout);
862 // String label= PHPUIMessages.getString("PHPEditorPreferencePage.wrapStrings"); //$NON-NLS-1$
863 // addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 1);
865 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartHomeEnd"); //$NON-NLS-1$
866 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_HOME_END, 1);
868 // label= PHPUIMessages.getString("PHPEditorPreferencePage.smartPaste"); //$NON-NLS-1$
869 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 1);
871 // label= PHPUIMessages.getString("PHPEditorPreferencePage.insertSpaceForTabs"); //$NON-NLS-1$
872 // addCheckBox(composite, label, PreferenceConstants.EDITOR_SPACES_FOR_TABS, 1);
874 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeStrings"); //$NON-NLS-1$
875 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS, 1);
877 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBrackets"); //$NON-NLS-1$
878 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS, 1);
880 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closeBraces"); //$NON-NLS-1$
881 // addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 1);
883 // label= PHPUIMessages.getString("PHPEditorPreferencePage.closePHPDocs"); //$NON-NLS-1$
884 // Button button= addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_JAVADOCS, 1);
886 // label= PHPUIMessages.getString("PHPEditorPreferencePage.addPHPDocTags"); //$NON-NLS-1$
887 // fAddJavaDocTagsButton= addCheckBox(composite, label, PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS, 1);
888 // createDependency(button, fAddJavaDocTagsButton);
890 // label= PHPUIMessages.getString("PHPEditorPreferencePage.formatPHPDocs"); //$NON-NLS-1$
891 // addCheckBox(composite, label, PreferenceConstants.EDITOR_FORMAT_JAVADOCS, 1);
896 private static void indent(Control control) {
897 GridData gridData = new GridData();
898 gridData.horizontalIndent = 20;
899 control.setLayoutData(gridData);
902 private static void createDependency(final Button master, final Control slave) {
904 master.addSelectionListener(new SelectionListener() {
905 public void widgetSelected(SelectionEvent e) {
906 slave.setEnabled(master.getSelection());
909 public void widgetDefaultSelected(SelectionEvent e) {
914 private Control createContentAssistPage(Composite parent) {
916 Composite contentAssistComposite = new Composite(parent, SWT.NULL);
917 GridLayout layout = new GridLayout();
918 layout.numColumns = 2;
919 contentAssistComposite.setLayout(layout);
921 // String label = PHPUIMessages.getString("PHPEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
922 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
924 // label = PHPUIMessages.getString("PHPEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
925 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
927 // label = PHPUIMessages.getString("PHPEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
928 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
930 // label = PHPUIMessages.getString("PHPEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
931 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
933 // label = PHPUIMessages.getString("PHPEditorPreferencePage.insertCompletion"); //$NON-NLS-1$
934 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_INSERT_COMPLETION, 0);
936 // label = PHPUIMessages.getString("PHPEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
937 // Button button = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
939 // label = PHPUIMessages.getString("PHPEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
940 // fGuessMethodArgumentsButton =
941 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
942 // createDependency(button, fGuessMethodArgumentsButton);
944 label = PHPUIMessages.getString("PHPEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
945 final Button autoactivation = addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
947 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
948 fAutoInsertDelayText =
949 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
951 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHP"); //$NON-NLS-1$
952 fAutoInsertJavaTriggerText =
953 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
955 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForPHPDoc"); //$NON-NLS-1$
956 fAutoInsertJavaDocTriggerText =
957 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
959 label = PHPUIMessages.getString("PHPEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
960 fAutoInsertHTMLTriggerText =
961 addTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
963 label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionProposals"); //$NON-NLS-1$
964 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, 0);
966 label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionProposals"); //$NON-NLS-1$
967 addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, 0);
969 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForMethodParameters"); //$NON-NLS-1$
970 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, 0);
972 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForMethodParameters"); //$NON-NLS-1$
973 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, 0);
975 // label = PHPUIMessages.getString("PHPEditorPreferencePage.backgroundForCompletionReplacement"); //$NON-NLS-1$
976 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, 0);
978 // label = PHPUIMessages.getString("PHPEditorPreferencePage.foregroundForCompletionReplacement"); //$NON-NLS-1$
979 // addColorButton(contentAssistComposite, label, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, 0);
981 autoactivation.addSelectionListener(new SelectionAdapter() {
982 public void widgetSelected(SelectionEvent e) {
983 updateAutoactivationControls();
986 return contentAssistComposite;
990 * @see PreferencePage#createContents(Composite)
992 protected Control createContents(Composite parent) {
994 fOverlayStore.load();
995 fOverlayStore.start();
997 TabFolder folder = new TabFolder(parent, SWT.NONE);
998 folder.setLayout(new TabFolderLayout());
999 folder.setLayoutData(new GridData(GridData.FILL_BOTH));
1001 TabItem item = new TabItem(folder, SWT.NONE);
1002 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.general")); //$NON-NLS-1$
1003 item.setControl(createAppearancePage(folder));
1005 item = new TabItem(folder, SWT.NONE);
1006 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.colors")); //$NON-NLS-1$
1007 item.setControl(createSyntaxPage(folder));
1009 item = new TabItem(folder, SWT.NONE);
1010 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.codeAssist")); //$NON-NLS-1$
1011 item.setControl(createContentAssistPage(folder));
1013 item = new TabItem(folder, SWT.NONE);
1014 item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.problemIndicationTab.title")); //$NON-NLS-1$
1015 item.setControl(createProblemIndicationPage(folder));
1017 // item= new TabItem(folder, SWT.NONE);
1018 // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.behaviourTab.title")); //$NON-NLS-1$
1019 // item.setControl(createBehaviourPage(folder));
1021 // item= new TabItem(folder, SWT.NONE);
1022 // item.setText(PHPUIMessages.getString("PHPEditorPreferencePage.hoverTab.title")); //$NON-NLS-1$
1023 // fJavaEditorHoverConfigurationBlock= new JavaEditorHoverConfigurationBlock(fOverlayStore);
1024 // item.setControl(fJavaEditorHoverConfigurationBlock.createControl(folder));
1031 private void initialize() {
1033 fFontEditor.setPreferenceStore(getPreferenceStore());
1034 fFontEditor.setPreferencePage(this);
1039 for (int i = 0; i < fSyntaxColorListModel.length; i++)
1040 fSyntaxColorList.add(fSyntaxColorListModel[i][0]);
1042 fSyntaxColorList.getDisplay().asyncExec(new Runnable() {
1044 if (fSyntaxColorList != null && !fSyntaxColorList.isDisposed()) {
1045 fSyntaxColorList.select(0);
1046 handleSyntaxColorListSelection();
1051 for (int i = 0; i < fAppearanceColorListModel.length; i++)
1052 fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
1054 fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
1056 if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
1057 fAppearanceColorList.select(0);
1058 handleAppearanceColorListSelection();
1063 for (int i = 0; i < fProblemIndicationColorListModel.length; i++)
1064 fProblemIndicationList.add(fProblemIndicationColorListModel[i][0]);
1066 fProblemIndicationList.getDisplay().asyncExec(new Runnable() {
1068 if (fProblemIndicationList != null && !fProblemIndicationList.isDisposed()) {
1069 fProblemIndicationList.select(0);
1070 handleProblemIndicationColorListSelection();
1076 private void initializeFields() {
1078 Iterator e = fColorButtons.keySet().iterator();
1079 while (e.hasNext()) {
1080 ColorEditor c = (ColorEditor) e.next();
1081 String key = (String) fColorButtons.get(c);
1082 RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
1083 c.setColorValue(rgb);
1086 e = fCheckBoxes.keySet().iterator();
1087 while (e.hasNext()) {
1088 Button b = (Button) e.next();
1089 String key = (String) fCheckBoxes.get(b);
1090 b.setSelection(fOverlayStore.getBoolean(key));
1093 e = fTextFields.keySet().iterator();
1094 while (e.hasNext()) {
1095 Text t = (Text) e.next();
1096 String key = (String) fTextFields.get(t);
1097 t.setText(fOverlayStore.getString(key));
1100 RGB rgb = PreferenceConverter.getColor(fOverlayStore, PreferenceConstants.EDITOR_BACKGROUND_COLOR);
1101 fBackgroundColorEditor.setColorValue(rgb);
1103 boolean default_ = fOverlayStore.getBoolean(PreferenceConstants.EDITOR_BACKGROUND_DEFAULT_COLOR);
1104 fBackgroundDefaultRadioButton.setSelection(default_);
1105 fBackgroundCustomRadioButton.setSelection(!default_);
1106 fBackgroundColorButton.setEnabled(!default_);
1108 // boolean closeJavaDocs= fOverlayStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_JAVADOCS);
1109 // fAddJavaDocTagsButton.setEnabled(closeJavaDocs);
1111 // boolean fillMethodArguments = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
1112 // fGuessMethodArgumentsButton.setEnabled(fillMethodArguments);
1114 updateAutoactivationControls();
1116 // fJavaEditorHoverConfigurationBlock.initializeFields();
1119 private void updateAutoactivationControls() {
1120 boolean autoactivation = fOverlayStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
1121 fAutoInsertDelayText.setEnabled(autoactivation);
1122 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
1123 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
1124 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
1128 * @see PreferencePage#performOk()
1130 public boolean performOk() {
1131 fFontEditor.store();
1132 // fJavaEditorHoverConfigurationBlock.performOk();
1133 fOverlayStore.propagate();
1134 // fUserDefinedPHPSyntaxFileFFE.store();
1135 PHPeclipsePlugin.getDefault().savePluginPreferences();
1140 * @see PreferencePage#performDefaults()
1142 protected void performDefaults() {
1144 fFontEditor.loadDefault();
1146 fOverlayStore.loadDefaults();
1149 // fUserDefinedPHPSyntaxFileFFE.loadDefault();
1150 handleSyntaxColorListSelection();
1151 handleAppearanceColorListSelection();
1152 handleProblemIndicationColorListSelection();
1153 super.performDefaults();
1155 fPreviewViewer.invalidateTextPresentation();
1159 * @see DialogPage#dispose()
1161 public void dispose() {
1163 if (fJavaTextTools != null) {
1164 fJavaTextTools = null;
1167 fFontEditor.setPreferencePage(null);
1168 fFontEditor.setPreferenceStore(null);
1170 if (fOverlayStore != null) {
1171 fOverlayStore.stop();
1172 fOverlayStore = null;
1178 private Control addColorButton(Composite composite, String label, String key, int indentation) {
1180 Label labelControl = new Label(composite, SWT.NONE);
1181 labelControl.setText(label);
1183 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1184 gd.horizontalIndent = indentation;
1185 labelControl.setLayoutData(gd);
1187 ColorEditor editor = new ColorEditor(composite);
1188 Button button = editor.getButton();
1189 button.setData(editor);
1191 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1192 button.setLayoutData(gd);
1193 button.addSelectionListener(fColorButtonListener);
1195 fColorButtons.put(editor, key);
1200 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
1201 Button checkBox = new Button(parent, SWT.CHECK);
1202 checkBox.setText(label);
1204 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1205 gd.horizontalIndent = indentation;
1206 gd.horizontalSpan = 2;
1207 checkBox.setLayoutData(gd);
1208 checkBox.addSelectionListener(fCheckBoxListener);
1210 fCheckBoxes.put(checkBox, key);
1215 private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
1217 Label labelControl = new Label(composite, SWT.NONE);
1218 labelControl.setText(label);
1219 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1220 gd.horizontalIndent = indentation;
1221 labelControl.setLayoutData(gd);
1223 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
1224 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
1225 gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
1226 textControl.setLayoutData(gd);
1227 textControl.setTextLimit(textLimit);
1228 fTextFields.put(textControl, key);
1230 fNumberFields.add(textControl);
1231 textControl.addModifyListener(fNumberFieldListener);
1233 textControl.addModifyListener(fTextFieldListener);
1239 private void addTextFontEditor(Composite parent, String label, String key) {
1241 Composite editorComposite = new Composite(parent, SWT.NONE);
1242 GridLayout layout = new GridLayout();
1243 layout.numColumns = 3;
1244 editorComposite.setLayout(layout);
1245 fFontEditor = new WorkbenchChainedTextFontFieldEditor(key, label, editorComposite);
1246 fFontEditor.setChangeButtonText(PHPUIMessages.getString("PHPEditorPreferencePage.change")); //$NON-NLS-1$
1248 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
1249 gd.horizontalSpan = 2;
1250 editorComposite.setLayoutData(gd);
1253 private String loadPreviewContentFromFile(String filename) {
1255 String separator = System.getProperty("line.separator"); //$NON-NLS-1$
1256 StringBuffer buffer = new StringBuffer(512);
1257 BufferedReader reader = null;
1259 reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
1260 while ((line = reader.readLine()) != null) {
1261 buffer.append(line);
1262 buffer.append(separator);
1264 } catch (IOException io) {
1265 PHPeclipsePlugin.log(io);
1267 if (reader != null) {
1270 } catch (IOException e) {
1274 return buffer.toString();
1277 private void numberFieldChanged(Text textControl) {
1278 String number = textControl.getText();
1279 IStatus status = validatePositiveNumber(number);
1280 if (!status.matches(IStatus.ERROR))
1281 fOverlayStore.setValue((String) fTextFields.get(textControl), number);
1282 updateStatus(status);
1285 private IStatus validatePositiveNumber(String number) {
1286 StatusInfo status = new StatusInfo();
1287 if (number.length() == 0) {
1288 status.setError(PHPUIMessages.getString("PHPEditorPreferencePage.empty_input")); //$NON-NLS-1$
1291 int value = Integer.parseInt(number);
1293 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1294 } catch (NumberFormatException e) {
1295 status.setError(PHPUIMessages.getFormattedString("PHPEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
1301 private void updateStatus(IStatus status) {
1302 if (!status.matches(IStatus.ERROR)) {
1303 for (int i = 0; i < fNumberFields.size(); i++) {
1304 Text text = (Text) fNumberFields.get(i);
1305 IStatus s = validatePositiveNumber(text.getText());
1306 status = StatusUtil.getMoreSevere(s, status);
1309 setValid(!status.matches(IStatus.ERROR));
1310 StatusUtil.applyToStatusLine(this, status);
1314 * @deprecated Inline to avoid reference to preference page
1316 public static boolean indicateQuixFixableProblems() {
1317 return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
1321 * @deprecated Inline to avoid reference to preference page
1323 // static public boolean synchronizeOutlineOnCursorMove() {
1324 // return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE);