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;
28 //import org.eclipse.jface.text.Assert;
29 import org.eclipse.core.runtime.Assert;
30 import org.eclipse.swt.SWT;
31 import org.eclipse.swt.events.ModifyEvent;
32 import org.eclipse.swt.events.ModifyListener;
33 import org.eclipse.swt.events.SelectionAdapter;
34 import org.eclipse.swt.events.SelectionEvent;
35 import org.eclipse.swt.events.SelectionListener;
36 import org.eclipse.swt.graphics.RGB;
37 import org.eclipse.swt.layout.GridData;
38 import org.eclipse.swt.layout.GridLayout;
39 import org.eclipse.swt.widgets.Button;
40 import org.eclipse.swt.widgets.Composite;
41 import org.eclipse.swt.widgets.Control;
42 import org.eclipse.swt.widgets.Label;
43 import org.eclipse.swt.widgets.List;
44 import org.eclipse.swt.widgets.Text;
47 * Configures the code assist preferences.
51 class CodeAssistConfigurationBlock implements IPreferenceConfigurationBlock {
53 private OverlayPreferenceStore fStore;
55 private PreferencePage fMainPreferencePage;
57 private List fContentAssistColorList;
59 private ColorEditor fContentAssistColorEditor;
61 private Control fAutoInsertDelayText;
63 private Control fAutoInsertJavaTriggerText;
65 private Control fAutoInsertJavaDocTriggerText;
67 private Control fAutoInsertHTMLTriggerText;
69 private Label fAutoInsertDelayLabel;
71 private Label fAutoInsertJavaTriggerLabel;
73 private Label fAutoInsertJavaDocTriggerLabel;
75 private Label fAutoInsertHTMLTriggerLabel;
77 // private Button fCompletionInsertsRadioButton;
78 // private Button fCompletionOverwritesRadioButton;
80 * List of master/slave listeners when there's a dependency.
82 * @see #createDependency(Button, String, Control)
85 private ArrayList fMasterSlaveListeners = new ArrayList();
87 private final String[][] fContentAssistColorListModel = new String[][] {
90 .getString("JavaEditorPreferencePage.backgroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND }, //$NON-NLS-1$
93 .getString("JavaEditorPreferencePage.foregroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND }, //$NON-NLS-1$
94 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForMethodParameters"),
95 // PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND },
97 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForMethodParameters"),
98 // PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND },
100 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionReplacement"),
101 // PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND },
103 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionReplacement"),
104 // PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND }
108 private Map fCheckBoxes = new HashMap();
110 private SelectionListener fCheckBoxListener = new SelectionListener() {
111 public void widgetDefaultSelected(SelectionEvent e) {
114 public void widgetSelected(SelectionEvent e) {
115 Button button = (Button) e.widget;
116 fStore.setValue((String) fCheckBoxes.get(button), button
121 private Map fTextFields = new HashMap();
123 private ModifyListener fTextFieldListener = new ModifyListener() {
124 public void modifyText(ModifyEvent e) {
125 Text text = (Text) e.widget;
126 fStore.setValue((String) fTextFields.get(text), text.getText());
130 private ArrayList fNumberFields = new ArrayList();
132 private ModifyListener fNumberFieldListener = new ModifyListener() {
133 public void modifyText(ModifyEvent e) {
134 numberFieldChanged((Text) e.widget);
138 public CodeAssistConfigurationBlock(PreferencePage mainPreferencePage,
139 OverlayPreferenceStore store) {
140 Assert.isNotNull(mainPreferencePage);
141 Assert.isNotNull(store);
143 fStore.addKeys(createOverlayStoreKeys());
144 fMainPreferencePage = mainPreferencePage;
147 private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
149 ArrayList overlayKeys = new ArrayList();
151 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
152 OverlayPreferenceStore.BOOLEAN,
153 PreferenceConstants.CODEASSIST_AUTOACTIVATION));
154 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
155 OverlayPreferenceStore.INT,
156 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
157 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
158 OverlayPreferenceStore.BOOLEAN,
159 PreferenceConstants.CODEASSIST_AUTOINSERT));
160 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
161 OverlayPreferenceStore.STRING,
162 PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
163 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
164 OverlayPreferenceStore.STRING,
165 PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
166 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
167 OverlayPreferenceStore.STRING,
168 PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
169 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
170 OverlayPreferenceStore.STRING,
171 PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
172 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
173 OverlayPreferenceStore.STRING,
174 PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
175 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
176 OverlayPreferenceStore.STRING,
177 PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
178 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
179 OverlayPreferenceStore.STRING,
180 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
182 .add(new OverlayPreferenceStore.OverlayKey(
183 OverlayPreferenceStore.STRING,
184 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
185 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
186 OverlayPreferenceStore.STRING,
187 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML));
188 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
189 OverlayPreferenceStore.BOOLEAN,
190 PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
191 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
192 OverlayPreferenceStore.BOOLEAN,
193 PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
194 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
195 OverlayPreferenceStore.BOOLEAN,
196 PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
197 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
198 OverlayPreferenceStore.BOOLEAN,
199 PreferenceConstants.CODEASSIST_ADDIMPORT));
200 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
201 OverlayPreferenceStore.BOOLEAN,
202 PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
203 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
204 OverlayPreferenceStore.BOOLEAN,
205 PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
206 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
207 OverlayPreferenceStore.BOOLEAN,
208 PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
209 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
210 OverlayPreferenceStore.BOOLEAN,
211 PreferenceConstants.CODEASSIST_PREFIX_COMPLETION));
213 OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys
215 overlayKeys.toArray(keys);
220 * Creates page for hover preferences.
223 * the parent composite
224 * @return the control for the preference page
226 public Control createControl(Composite parent) {
228 PixelConverter pixelConverter = new PixelConverter(parent);
230 Composite contentAssistComposite = new Composite(parent, SWT.NONE);
231 contentAssistComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
232 GridLayout layout = new GridLayout();
233 layout.numColumns = 2;
234 contentAssistComposite.setLayout(layout);
236 // addCompletionRadioButtons(contentAssistComposite);
240 // PreferencesMessages.getString("JavaEditorPreferencePage.insertSingleProposalsAutomatically");
242 // addCheckBox(contentAssistComposite, label,
243 // PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
246 // PreferencesMessages.getString("JavaEditorPreferencePage.completePrefixes");
248 // addCheckBox(contentAssistComposite, label,
249 // PreferenceConstants.CODEASSIST_PREFIX_COMPLETION, 0);
252 // PreferencesMessages.getString("JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext");
254 // addCheckBox(contentAssistComposite, label,
255 // PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
258 // PreferencesMessages.getString("JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder");
260 // addCheckBox(contentAssistComposite, label,
261 // PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
264 // PreferencesMessages.getString("JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName");
266 // addCheckBox(contentAssistComposite, label,
267 // PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
270 // PreferencesMessages.getString("JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion");
272 // Button master= addCheckBox(contentAssistComposite, label,
273 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
276 // PreferencesMessages.getString("JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion");
278 // Button slave= addCheckBox(contentAssistComposite, label,
279 // PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
280 // createDependency(master,
281 // PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, slave);
283 label = PreferencesMessages
284 .getString("JavaEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
285 final Button autoactivation = addCheckBox(contentAssistComposite,
286 label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
287 autoactivation.addSelectionListener(new SelectionAdapter() {
288 public void widgetSelected(SelectionEvent e) {
289 updateAutoactivationControls();
293 Control[] labelledTextField;
294 label = PreferencesMessages
295 .getString("JavaEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
296 labelledTextField = addLabelledTextField(contentAssistComposite, label,
297 PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
298 fAutoInsertDelayLabel = getLabelControl(labelledTextField);
299 fAutoInsertDelayText = getTextControl(labelledTextField);
301 label = PreferencesMessages
302 .getString("JavaEditorPreferencePage.autoActivationTriggersForJava"); //$NON-NLS-1$
303 labelledTextField = addLabelledTextField(contentAssistComposite, label,
304 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4,
306 fAutoInsertJavaTriggerLabel = getLabelControl(labelledTextField);
307 fAutoInsertJavaTriggerText = getTextControl(labelledTextField);
309 label = PreferencesMessages
310 .getString("JavaEditorPreferencePage.autoActivationTriggersForJavaDoc"); //$NON-NLS-1$
311 labelledTextField = addLabelledTextField(contentAssistComposite, label,
312 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC,
314 fAutoInsertJavaDocTriggerLabel = getLabelControl(labelledTextField);
315 fAutoInsertJavaDocTriggerText = getTextControl(labelledTextField);
317 label = PreferencesMessages
318 .getString("JavaEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
319 labelledTextField = addLabelledTextField(contentAssistComposite, label,
320 PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4,
322 fAutoInsertHTMLTriggerLabel = getLabelControl(labelledTextField);
323 fAutoInsertHTMLTriggerText = getTextControl(labelledTextField);
325 Label l = new Label(contentAssistComposite, SWT.LEFT);
326 l.setText(PreferencesMessages
327 .getString("JavaEditorPreferencePage.codeAssist.colorOptions")); //$NON-NLS-1$
328 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
329 gd.horizontalSpan = 2;
332 Composite editorComposite = new Composite(contentAssistComposite,
334 layout = new GridLayout();
335 layout.numColumns = 2;
336 layout.marginHeight = 0;
337 layout.marginWidth = 0;
338 editorComposite.setLayout(layout);
339 gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL
340 | GridData.FILL_VERTICAL);
341 gd.horizontalSpan = 2;
342 editorComposite.setLayoutData(gd);
344 fContentAssistColorList = new List(editorComposite, SWT.SINGLE
345 | SWT.V_SCROLL | SWT.BORDER);
346 gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING
347 | GridData.FILL_HORIZONTAL);
348 gd.heightHint = pixelConverter.convertHeightInCharsToPixels(8);
349 fContentAssistColorList.setLayoutData(gd);
351 Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
352 layout = new GridLayout();
353 layout.marginHeight = 0;
354 layout.marginWidth = 0;
355 layout.numColumns = 2;
356 stylesComposite.setLayout(layout);
357 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
359 l = new Label(stylesComposite, SWT.LEFT);
360 l.setText(PreferencesMessages
361 .getString("JavaEditorPreferencePage.codeAssist.color")); //$NON-NLS-1$
363 gd.horizontalAlignment = GridData.BEGINNING;
366 fContentAssistColorEditor = new ColorEditor(stylesComposite);
367 Button colorButton = fContentAssistColorEditor.getButton();
368 gd = new GridData(GridData.FILL_HORIZONTAL);
369 gd.horizontalAlignment = GridData.BEGINNING;
370 colorButton.setLayoutData(gd);
372 fContentAssistColorList.addSelectionListener(new SelectionListener() {
373 public void widgetDefaultSelected(SelectionEvent e) {
377 public void widgetSelected(SelectionEvent e) {
378 handleContentAssistColorListSelection();
381 colorButton.addSelectionListener(new SelectionListener() {
382 public void widgetDefaultSelected(SelectionEvent e) {
386 public void widgetSelected(SelectionEvent e) {
387 int i = fContentAssistColorList.getSelectionIndex();
388 String key = fContentAssistColorListModel[i][1];
390 PreferenceConverter.setValue(fStore, key,
391 fContentAssistColorEditor.getColorValue());
395 return contentAssistComposite;
398 // private void createDependency(final Button master, String masterKey,
399 // final Control slave) {
401 // boolean masterState = fStore.getBoolean(masterKey);
402 // slave.setEnabled(masterState);
403 // SelectionListener listener = new SelectionListener() {
404 // public void widgetSelected(SelectionEvent e) {
405 // slave.setEnabled(master.getSelection());
408 // public void widgetDefaultSelected(SelectionEvent e) {
411 // master.addSelectionListener(listener);
412 // fMasterSlaveListeners.add(listener);
415 // private static void indent(Control control) {
416 // GridData gridData = new GridData();
417 // gridData.horizontalIndent = 20;
418 // control.setLayoutData(gridData);
421 private static Text getTextControl(Control[] labelledTextField) {
422 return (Text) labelledTextField[1];
425 private static Label getLabelControl(Control[] labelledTextField) {
426 return (Label) labelledTextField[0];
430 * Returns an array of size 2: - first element is of type <code>Label</code> -
431 * second element is of type <code>Text</code> Use
432 * <code>getLabelControl</code> and <code>getTextControl</code> to get
436 * the parent composite
438 * the text field's label
444 * the field's indentation
446 * <code>true</code> iff this text field is used to e4dit a
450 private Control[] addLabelledTextField(Composite composite, String label,
451 String key, int textLimit, int indentation, boolean isNumber) {
453 PixelConverter pixelConverter = new PixelConverter(composite);
455 Label labelControl = new Label(composite, SWT.NONE);
456 labelControl.setText(label);
457 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
458 gd.horizontalIndent = indentation;
459 labelControl.setLayoutData(gd);
461 Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
462 gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
463 gd.widthHint = pixelConverter
464 .convertWidthInCharsToPixels(textLimit + 1);
465 textControl.setLayoutData(gd);
466 textControl.setTextLimit(textLimit);
467 fTextFields.put(textControl, key);
469 fNumberFields.add(textControl);
470 textControl.addModifyListener(fNumberFieldListener);
472 textControl.addModifyListener(fTextFieldListener);
475 return new Control[] { labelControl, textControl };
478 // private void addCompletionRadioButtons(Composite contentAssistComposite) {
479 // Composite completionComposite = new Composite(contentAssistComposite,
481 // GridData ccgd = new GridData();
482 // ccgd.horizontalSpan = 2;
483 // completionComposite.setLayoutData(ccgd);
484 // GridLayout ccgl = new GridLayout();
485 // ccgl.marginWidth = 0;
486 // ccgl.numColumns = 2;
487 // completionComposite.setLayout(ccgl);
489 // // SelectionListener completionSelectionListener= new SelectionAdapter()
491 // // public void widgetSelected(SelectionEvent e) {
492 // // boolean insert= fCompletionInsertsRadioButton.getSelection();
493 // // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION,
498 // // fCompletionInsertsRadioButton= new Button(completionComposite,
499 // // SWT.RADIO | SWT.LEFT);
500 // // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts"));
502 // // fCompletionInsertsRadioButton.setLayoutData(new GridData());
503 // // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
505 // // fCompletionOverwritesRadioButton= new Button(completionComposite,
506 // // SWT.RADIO | SWT.LEFT);
507 // // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites"));
509 // // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
510 // // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
513 public void initialize() {
516 for (int i = 0; i < fContentAssistColorListModel.length; i++)
517 fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
518 fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
520 if (fContentAssistColorList != null
521 && !fContentAssistColorList.isDisposed()) {
522 fContentAssistColorList.select(0);
523 handleContentAssistColorListSelection();
530 void initializeFields() {
531 Iterator e = fCheckBoxes.keySet().iterator();
532 while (e.hasNext()) {
533 Button b = (Button) e.next();
534 String key = (String) fCheckBoxes.get(b);
535 b.setSelection(fStore.getBoolean(key));
538 e = fTextFields.keySet().iterator();
539 while (e.hasNext()) {
540 Text t = (Text) e.next();
541 String key = (String) fTextFields.get(t);
542 t.setText(fStore.getString(key));
545 // boolean completionInserts=
546 // fStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
547 // fCompletionInsertsRadioButton.setSelection(completionInserts);
548 // fCompletionOverwritesRadioButton.setSelection(! completionInserts);
550 updateAutoactivationControls();
552 updateStatus(validatePositiveNumber("0")); //$NON-NLS-1$
555 Iterator iter = fMasterSlaveListeners.iterator();
556 while (iter.hasNext()) {
557 SelectionListener listener = (SelectionListener) iter.next();
558 listener.widgetSelected(null);
562 private void updateAutoactivationControls() {
563 boolean autoactivation = fStore
564 .getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
565 fAutoInsertDelayText.setEnabled(autoactivation);
566 fAutoInsertDelayLabel.setEnabled(autoactivation);
568 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
569 fAutoInsertJavaTriggerLabel.setEnabled(autoactivation);
571 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
572 fAutoInsertJavaDocTriggerLabel.setEnabled(autoactivation);
574 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
575 fAutoInsertHTMLTriggerLabel.setEnabled(autoactivation);
578 public void performOk() {
581 public void performDefaults() {
582 handleContentAssistColorListSelection();
586 private void handleContentAssistColorListSelection() {
587 int i = fContentAssistColorList.getSelectionIndex();
588 String key = fContentAssistColorListModel[i][1];
589 RGB rgb = PreferenceConverter.getColor(fStore, key);
590 fContentAssistColorEditor.setColorValue(rgb);
593 private void numberFieldChanged(Text textControl) {
594 String number = textControl.getText();
595 IStatus status = validatePositiveNumber(number);
596 if (!status.matches(IStatus.ERROR))
597 fStore.setValue((String) fTextFields.get(textControl), number);
598 updateStatus(status);
601 private IStatus validatePositiveNumber(String number) {
602 StatusInfo status = new StatusInfo();
603 if (number.length() == 0) {
604 status.setError(PreferencesMessages
605 .getString("JavaEditorPreferencePage.empty_input")); //$NON-NLS-1$
608 int value = Integer.parseInt(number);
610 status.setError(PreferencesMessages.getFormattedString(
611 "JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
612 } catch (NumberFormatException e) {
613 status.setError(PreferencesMessages.getFormattedString(
614 "JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
620 private void updateStatus(IStatus status) {
621 fMainPreferencePage.setValid(status.isOK());
622 StatusUtil.applyToStatusLine(fMainPreferencePage, status);
625 private Button addCheckBox(Composite parent, String label, String key,
627 Button checkBox = new Button(parent, SWT.CHECK);
628 checkBox.setText(label);
630 GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
631 gd.horizontalIndent = indentation;
632 gd.horizontalSpan = 2;
633 checkBox.setLayoutData(gd);
634 checkBox.addSelectionListener(fCheckBoxListener);
636 fCheckBoxes.put(checkBox, key);
642 * @see DialogPage#dispose()
644 public void dispose() {
645 // nothing to dispose