1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation 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 API and implementation
10 *******************************************************************************/
12 package net.sourceforge.phpdt.internal.ui.preferences;
14 import java.util.ArrayList;
15 import java.util.HashMap;
16 import java.util.Iterator;
19 import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
20 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
21 import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
22 import net.sourceforge.phpdt.ui.PreferenceConstants;
24 import org.eclipse.core.runtime.IStatus;
25 import org.eclipse.jface.preference.PreferenceConverter;
26 import org.eclipse.jface.preference.PreferencePage;
27 import org.eclipse.jface.text.Assert;
28 import org.eclipse.swt.SWT;
29 import org.eclipse.swt.events.ModifyEvent;
30 import org.eclipse.swt.events.ModifyListener;
31 import org.eclipse.swt.events.SelectionAdapter;
32 import org.eclipse.swt.events.SelectionEvent;
33 import org.eclipse.swt.events.SelectionListener;
34 import org.eclipse.swt.graphics.RGB;
35 import org.eclipse.swt.layout.GridData;
36 import org.eclipse.swt.layout.GridLayout;
37 import org.eclipse.swt.widgets.Button;
38 import org.eclipse.swt.widgets.Composite;
39 import org.eclipse.swt.widgets.Control;
40 import org.eclipse.swt.widgets.Label;
41 import org.eclipse.swt.widgets.List;
42 import org.eclipse.swt.widgets.Text;
45 * Configures the code assist preferences.
49 class CodeAssistConfigurationBlock implements IPreferenceConfigurationBlock {
51 private OverlayPreferenceStore fStore;
53 private PreferencePage fMainPreferencePage;
55 private List fContentAssistColorList;
57 private ColorEditor fContentAssistColorEditor;
59 private Control fAutoInsertDelayText;
61 private Control fAutoInsertJavaTriggerText;
63 private Control fAutoInsertJavaDocTriggerText;
65 private Control fAutoInsertHTMLTriggerText;
67 private Label fAutoInsertDelayLabel;
69 private Label fAutoInsertJavaTriggerLabel;
71 private Label fAutoInsertJavaDocTriggerLabel;
73 private Label fAutoInsertHTMLTriggerLabel;
75 // private Button fCompletionInsertsRadioButton;
76 // private Button fCompletionOverwritesRadioButton;
78 * List of master/slave listeners when there's a dependency.
80 * @see #createDependency(Button, String, Control)
83 private ArrayList fMasterSlaveListeners = new ArrayList();
85 private final String[][] fContentAssistColorListModel = new String[][] {
88 .getString("JavaEditorPreferencePage.backgroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND }, //$NON-NLS-1$
91 .getString("JavaEditorPreferencePage.foregroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND }, //$NON-NLS-1$
92 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForMethodParameters"),
93 // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND },
95 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForMethodParameters"),
96 // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND },
98 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionReplacement"),
99 // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND },
101 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionReplacement"),
102 // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND }
106 private Map fCheckBoxes = new HashMap();
108 private SelectionListener fCheckBoxListener = new SelectionListener() {
109 public void widgetDefaultSelected(SelectionEvent e) {
112 public void widgetSelected(SelectionEvent e) {
113 Button button = (Button) e.widget;
114 fStore.setValue((String) fCheckBoxes.get(button), button
119 private Map fTextFields = new HashMap();
121 private ModifyListener fTextFieldListener = new ModifyListener() {
122 public void modifyText(ModifyEvent e) {
123 Text text = (Text) e.widget;
124 fStore.setValue((String) fTextFields.get(text), text.getText());
128 private ArrayList fNumberFields = new ArrayList();
130 private ModifyListener fNumberFieldListener = new ModifyListener() {
131 public void modifyText(ModifyEvent e) {
132 numberFieldChanged((Text) e.widget);
136 public CodeAssistConfigurationBlock(PreferencePage mainPreferencePage,
137 OverlayPreferenceStore store) {
138 Assert.isNotNull(mainPreferencePage);
139 Assert.isNotNull(store);
141 fStore.addKeys(createOverlayStoreKeys());
142 fMainPreferencePage = mainPreferencePage;
145 private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
147 ArrayList overlayKeys = new ArrayList();
149 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
150 OverlayPreferenceStore.BOOLEAN,
151 PreferenceConstants.CODEASSIST_AUTOACTIVATION));
152 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
153 OverlayPreferenceStore.INT,
154 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
155 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
156 OverlayPreferenceStore.BOOLEAN,
157 PreferenceConstants.CODEASSIST_AUTOINSERT));
158 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
159 OverlayPreferenceStore.STRING,
160 PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
161 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
162 OverlayPreferenceStore.STRING,
163 PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
164 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
165 OverlayPreferenceStore.STRING,
166 PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
167 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
168 OverlayPreferenceStore.STRING,
169 PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
170 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
171 OverlayPreferenceStore.STRING,
172 PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
173 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
174 OverlayPreferenceStore.STRING,
175 PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
176 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
177 OverlayPreferenceStore.STRING,
178 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
180 .add(new OverlayPreferenceStore.OverlayKey(
181 OverlayPreferenceStore.STRING,
182 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
183 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
184 OverlayPreferenceStore.STRING,
185 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML));
186 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
187 OverlayPreferenceStore.BOOLEAN,
188 PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
189 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
190 OverlayPreferenceStore.BOOLEAN,
191 PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
192 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
193 OverlayPreferenceStore.BOOLEAN,
194 PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
195 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
196 OverlayPreferenceStore.BOOLEAN,
197 PreferenceConstants.CODEASSIST_ADDIMPORT));
198 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
199 OverlayPreferenceStore.BOOLEAN,
200 PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
201 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
202 OverlayPreferenceStore.BOOLEAN,
203 PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
204 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
205 OverlayPreferenceStore.BOOLEAN,
206 PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
207 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
208 OverlayPreferenceStore.BOOLEAN,
209 PreferenceConstants.CODEASSIST_PREFIX_COMPLETION));
211 OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
213 overlayKeys.toArray(keys);
218 * Creates page for hover preferences.
221 * the parent composite
222 * @return the control for the preference page
224 public Control createControl(Composite parent) {
226 PixelConverter pixelConverter = new PixelConverter(parent);
228 Composite contentAssistComposite = new Composite(parent, SWT.NONE);
229 contentAssistComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
230 GridLayout layout = new GridLayout();
231 layout.numColumns = 2;
232 contentAssistComposite.setLayout(layout);
234 // addCompletionRadioButtons(contentAssistComposite);
238 // PreferencesMessages.getString("JavaEditorPreferencePage.insertSingleProposalsAutomatically");
240 // addCheckBox(contentAssistComposite, label,
241 // PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
244 // PreferencesMessages.getString("JavaEditorPreferencePage.completePrefixes");
246 // addCheckBox(contentAssistComposite, label,
247 // PreferenceConstants.CODEASSIST_PREFIX_COMPLETION, 0);
250 // PreferencesMessages.getString("JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext");
252 // addCheckBox(contentAssistComposite, label,
253 // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
256 // PreferencesMessages.getString("JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder");
258 // addCheckBox(contentAssistComposite, label,
259 // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
262 // PreferencesMessages.getString("JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName");
264 // addCheckBox(contentAssistComposite, label,
265 // PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
268 // PreferencesMessages.getString("JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion");
270 // Button master= addCheckBox(contentAssistComposite, label,
271 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
274 // PreferencesMessages.getString("JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion");
276 // Button slave= addCheckBox(contentAssistComposite, label,
277 // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
278 // createDependency(master,
279 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, slave);
281 label = PreferencesMessages
282 .getString("JavaEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
283 final Button autoactivation = addCheckBox(contentAssistComposite,
284 label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
285 autoactivation.addSelectionListener(new SelectionAdapter() {
286 public void widgetSelected(SelectionEvent e) {
287 updateAutoactivationControls();
291 Control[] labelledTextField;
292 label = PreferencesMessages
293 .getString("JavaEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
294 labelledTextField = addLabelledTextField(contentAssistComposite, label,
295 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
296 fAutoInsertDelayLabel = getLabelControl(labelledTextField);
297 fAutoInsertDelayText = getTextControl(labelledTextField);
299 label = PreferencesMessages
300 .getString("JavaEditorPreferencePage.autoActivationTriggersForJava"); //$NON-NLS-1$
301 labelledTextField = addLabelledTextField(contentAssistComposite, label,
302 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4,
304 fAutoInsertJavaTriggerLabel = getLabelControl(labelledTextField);
305 fAutoInsertJavaTriggerText = getTextControl(labelledTextField);
307 label = PreferencesMessages
308 .getString("JavaEditorPreferencePage.autoActivationTriggersForJavaDoc"); //$NON-NLS-1$
309 labelledTextField = addLabelledTextField(contentAssistComposite, label,
310 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC,
312 fAutoInsertJavaDocTriggerLabel = getLabelControl(labelledTextField);
313 fAutoInsertJavaDocTriggerText = getTextControl(labelledTextField);
315 label = PreferencesMessages
316 .getString("JavaEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
317 labelledTextField = addLabelledTextField(contentAssistComposite, label,
318 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4,
320 fAutoInsertHTMLTriggerLabel = getLabelControl(labelledTextField);
321 fAutoInsertHTMLTriggerText = getTextControl(labelledTextField);
323 Label l = new Label(contentAssistComposite, SWT.LEFT);
324 l.setText(PreferencesMessages
325 .getString("JavaEditorPreferencePage.codeAssist.colorOptions")); //$NON-NLS-1$
326 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
327 gd.horizontalSpan = 2;
330 Composite editorComposite = new Composite(contentAssistComposite,
332 layout = new GridLayout();
333 layout.numColumns = 2;
334 layout.marginHeight = 0;
335 layout.marginWidth = 0;
336 editorComposite.setLayout(layout);
337 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
338 | GridData.FILL_VERTICAL);
339 gd.horizontalSpan = 2;
340 editorComposite.setLayoutData(gd);
342 fContentAssistColorList = new List(editorComposite, SWT.SINGLE
343 | SWT.V_SCROLL | SWT.BORDER);
344 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
345 | GridData.FILL_HORIZONTAL);
346 gd.heightHint = pixelConverter.convertHeightInCharsToPixels(8);
347 fContentAssistColorList.setLayoutData(gd);
349 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
350 layout = new GridLayout();
351 layout.marginHeight = 0;
352 layout.marginWidth = 0;
353 layout.numColumns = 2;
354 stylesComposite.setLayout(layout);
355 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
357 l = new Label(stylesComposite, SWT.LEFT);
358 l.setText(PreferencesMessages
359 .getString("JavaEditorPreferencePage.codeAssist.color")); //$NON-NLS-1$
361 gd.horizontalAlignment = GridData.BEGINNING;
364 fContentAssistColorEditor = new ColorEditor(stylesComposite);
365 Button colorButton = fContentAssistColorEditor.getButton();
366 gd = new GridData(GridData.FILL_HORIZONTAL);
367 gd.horizontalAlignment = GridData.BEGINNING;
368 colorButton.setLayoutData(gd);
370 fContentAssistColorList.addSelectionListener(new SelectionListener() {
371 public void widgetDefaultSelected(SelectionEvent e) {
375 public void widgetSelected(SelectionEvent e) {
376 handleContentAssistColorListSelection();
379 colorButton.addSelectionListener(new SelectionListener() {
380 public void widgetDefaultSelected(SelectionEvent e) {
384 public void widgetSelected(SelectionEvent e) {
385 int i = fContentAssistColorList.getSelectionIndex();
386 String key = fContentAssistColorListModel[i][1];
388 PreferenceConverter.setValue(fStore, key,
389 fContentAssistColorEditor.getColorValue());
393 return contentAssistComposite;
396 private void createDependency(final Button master, String masterKey,
397 final Control slave) {
399 boolean masterState = fStore.getBoolean(masterKey);
400 slave.setEnabled(masterState);
401 SelectionListener listener = new SelectionListener() {
402 public void widgetSelected(SelectionEvent e) {
403 slave.setEnabled(master.getSelection());
406 public void widgetDefaultSelected(SelectionEvent e) {
409 master.addSelectionListener(listener);
410 fMasterSlaveListeners.add(listener);
413 private static void indent(Control control) {
414 GridData gridData = new GridData();
415 gridData.horizontalIndent = 20;
416 control.setLayoutData(gridData);
419 private static Text getTextControl(Control[] labelledTextField) {
420 return (Text) labelledTextField[1];
423 private static Label getLabelControl(Control[] labelledTextField) {
424 return (Label) labelledTextField[0];
428 * Returns an array of size 2: - first element is of type <code>Label</code> -
429 * second element is of type <code>Text</code> Use
430 * <code>getLabelControl</code> and <code>getTextControl</code> to get
434 * the parent composite
436 * the text field's label
442 * the field's indentation
444 * <code>true</code> iff this text field is used to e4dit a
448 private Control[] addLabelledTextField(Composite composite, String label,
449 String key, int textLimit, int indentation, boolean isNumber) {
451 PixelConverter pixelConverter = new PixelConverter(composite);
453 Label labelControl = new Label(composite, SWT.NONE);
454 labelControl.setText(label);
455 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
456 gd.horizontalIndent = indentation;
457 labelControl.setLayoutData(gd);
459 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
460 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
461 gd.widthHint = pixelConverter
462 .convertWidthInCharsToPixels(textLimit + 1);
463 textControl.setLayoutData(gd);
464 textControl.setTextLimit(textLimit);
465 fTextFields.put(textControl, key);
467 fNumberFields.add(textControl);
468 textControl.addModifyListener(fNumberFieldListener);
470 textControl.addModifyListener(fTextFieldListener);
473 return new Control[] { labelControl, textControl };
476 private void addCompletionRadioButtons(Composite contentAssistComposite) {
477 Composite completionComposite = new Composite(contentAssistComposite,
479 GridData ccgd = new GridData();
480 ccgd.horizontalSpan = 2;
481 completionComposite.setLayoutData(ccgd);
482 GridLayout ccgl = new GridLayout();
483 ccgl.marginWidth = 0;
485 completionComposite.setLayout(ccgl);
487 // SelectionListener completionSelectionListener= new SelectionAdapter()
489 // public void widgetSelected(SelectionEvent e) {
490 // boolean insert= fCompletionInsertsRadioButton.getSelection();
491 // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
496 // fCompletionInsertsRadioButton= new Button(completionComposite,
497 // SWT.RADIO | SWT.LEFT);
498 // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
500 // fCompletionInsertsRadioButton.setLayoutData(new GridData());
501 // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
503 // fCompletionOverwritesRadioButton= new Button(completionComposite,
504 // SWT.RADIO | SWT.LEFT);
505 // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
507 // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
508 // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
511 public void initialize() {
514 for (int i = 0; i < fContentAssistColorListModel.length; i++)
515 fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
516 fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
518 if (fContentAssistColorList != null
519 && !fContentAssistColorList.isDisposed()) {
520 fContentAssistColorList.select(0);
521 handleContentAssistColorListSelection();
528 void initializeFields() {
529 Iterator e = fCheckBoxes.keySet().iterator();
530 while (e.hasNext()) {
531 Button b = (Button) e.next();
532 String key = (String) fCheckBoxes.get(b);
533 b.setSelection(fStore.getBoolean(key));
536 e = fTextFields.keySet().iterator();
537 while (e.hasNext()) {
538 Text t = (Text) e.next();
539 String key = (String) fTextFields.get(t);
540 t.setText(fStore.getString(key));
543 // boolean completionInserts=
544 // fStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
545 // fCompletionInsertsRadioButton.setSelection(completionInserts);
546 // fCompletionOverwritesRadioButton.setSelection(! completionInserts);
548 updateAutoactivationControls();
550 updateStatus(validatePositiveNumber("0")); //$NON-NLS-1$
553 Iterator iter = fMasterSlaveListeners.iterator();
554 while (iter.hasNext()) {
555 SelectionListener listener = (SelectionListener) iter.next();
556 listener.widgetSelected(null);
560 private void updateAutoactivationControls() {
561 boolean autoactivation = fStore
562 .getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
563 fAutoInsertDelayText.setEnabled(autoactivation);
564 fAutoInsertDelayLabel.setEnabled(autoactivation);
566 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
567 fAutoInsertJavaTriggerLabel.setEnabled(autoactivation);
569 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
570 fAutoInsertJavaDocTriggerLabel.setEnabled(autoactivation);
572 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
573 fAutoInsertHTMLTriggerLabel.setEnabled(autoactivation);
576 public void performOk() {
579 public void performDefaults() {
580 handleContentAssistColorListSelection();
584 private void handleContentAssistColorListSelection() {
585 int i = fContentAssistColorList.getSelectionIndex();
586 String key = fContentAssistColorListModel[i][1];
587 RGB rgb = PreferenceConverter.getColor(fStore, key);
588 fContentAssistColorEditor.setColorValue(rgb);
591 private void numberFieldChanged(Text textControl) {
592 String number = textControl.getText();
593 IStatus status = validatePositiveNumber(number);
594 if (!status.matches(IStatus.ERROR))
595 fStore.setValue((String) fTextFields.get(textControl), number);
596 updateStatus(status);
599 private IStatus validatePositiveNumber(String number) {
600 StatusInfo status = new StatusInfo();
601 if (number.length() == 0) {
602 status.setError(PreferencesMessages
603 .getString("JavaEditorPreferencePage.empty_input")); //$NON-NLS-1$
606 int value = Integer.parseInt(number);
608 status.setError(PreferencesMessages.getFormattedString(
609 "JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
610 } catch (NumberFormatException e) {
611 status.setError(PreferencesMessages.getFormattedString(
612 "JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
618 private void updateStatus(IStatus status) {
619 fMainPreferencePage.setValid(status.isOK());
620 StatusUtil.applyToStatusLine(fMainPreferencePage, status);
623 private Button addCheckBox(Composite parent, String label, String key,
625 Button checkBox = new Button(parent, SWT.CHECK);
626 checkBox.setText(label);
628 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
629 gd.horizontalIndent = indentation;
630 gd.horizontalSpan = 2;
631 checkBox.setLayoutData(gd);
632 checkBox.addSelectionListener(fCheckBoxListener);
634 fCheckBoxes.put(checkBox, key);
640 * @see DialogPage#dispose()
642 public void dispose() {
643 // nothing to dispose