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 {
52 private OverlayPreferenceStore fStore;
53 private PreferencePage fMainPreferencePage;
55 private List fContentAssistColorList;
56 private ColorEditor fContentAssistColorEditor;
57 private Control fAutoInsertDelayText;
58 private Control fAutoInsertJavaTriggerText;
59 private Control fAutoInsertJavaDocTriggerText;
60 private Control fAutoInsertHTMLTriggerText;
61 private Label fAutoInsertDelayLabel;
62 private Label fAutoInsertJavaTriggerLabel;
63 private Label fAutoInsertJavaDocTriggerLabel;
64 private Label fAutoInsertHTMLTriggerLabel;
65 // private Button fCompletionInsertsRadioButton;
66 // private Button fCompletionOverwritesRadioButton;
68 * List of master/slave listeners when there's a dependency.
70 * @see #createDependency(Button, String, Control)
73 private ArrayList fMasterSlaveListeners= new ArrayList();
75 private final String[][] fContentAssistColorListModel= new String[][] {
76 {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND }, //$NON-NLS-1$
77 {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND }, //$NON-NLS-1$
78 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND }, //$NON-NLS-1$
79 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND }, //$NON-NLS-1$
80 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND }, //$NON-NLS-1$
81 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND } //$NON-NLS-1$
85 private Map fCheckBoxes= new HashMap();
86 private SelectionListener fCheckBoxListener= new SelectionListener() {
87 public void widgetDefaultSelected(SelectionEvent e) {
89 public void widgetSelected(SelectionEvent e) {
90 Button button= (Button) e.widget;
91 fStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
95 private Map fTextFields= new HashMap();
96 private ModifyListener fTextFieldListener= new ModifyListener() {
97 public void modifyText(ModifyEvent e) {
98 Text text= (Text) e.widget;
99 fStore.setValue((String) fTextFields.get(text), text.getText());
103 private ArrayList fNumberFields= new ArrayList();
104 private ModifyListener fNumberFieldListener= new ModifyListener() {
105 public void modifyText(ModifyEvent e) {
106 numberFieldChanged((Text) e.widget);
111 public CodeAssistConfigurationBlock(PreferencePage mainPreferencePage, OverlayPreferenceStore store) {
112 Assert.isNotNull(mainPreferencePage);
113 Assert.isNotNull(store);
115 fStore.addKeys(createOverlayStoreKeys());
116 fMainPreferencePage= mainPreferencePage;
120 private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
122 ArrayList overlayKeys= new ArrayList();
124 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION));
125 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
126 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT));
127 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
128 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
129 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
130 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
131 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
132 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
133 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
134 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
135 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML));
136 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
137 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
138 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
139 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT));
140 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
141 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
142 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
143 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_PREFIX_COMPLETION));
145 OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
146 overlayKeys.toArray(keys);
151 * Creates page for hover preferences.
153 * @param parent the parent composite
154 * @return the control for the preference page
156 public Control createControl(Composite parent) {
158 PixelConverter pixelConverter= new PixelConverter(parent);
160 Composite contentAssistComposite= new Composite(parent, SWT.NONE);
161 contentAssistComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
162 GridLayout layout= new GridLayout();
163 layout.numColumns= 2;
164 contentAssistComposite.setLayout(layout);
166 // addCompletionRadioButtons(contentAssistComposite);
169 // label= PreferencesMessages.getString("JavaEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
170 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
172 // label= PreferencesMessages.getString("JavaEditorPreferencePage.completePrefixes"); //$NON-NLS-1$
173 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PREFIX_COMPLETION, 0);
175 // label= PreferencesMessages.getString("JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
176 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
178 // label= PreferencesMessages.getString("JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
179 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
181 // label= PreferencesMessages.getString("JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
182 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
184 // label= PreferencesMessages.getString("JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
185 // Button master= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
187 // label= PreferencesMessages.getString("JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
188 // Button slave= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
189 // createDependency(master, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, slave);
191 label= PreferencesMessages.getString("JavaEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
192 final Button autoactivation= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
193 autoactivation.addSelectionListener(new SelectionAdapter(){
194 public void widgetSelected(SelectionEvent e) {
195 updateAutoactivationControls();
199 Control[] labelledTextField;
200 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
201 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
202 fAutoInsertDelayLabel= getLabelControl(labelledTextField);
203 fAutoInsertDelayText= getTextControl(labelledTextField);
205 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJava"); //$NON-NLS-1$
206 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
207 fAutoInsertJavaTriggerLabel= getLabelControl(labelledTextField);
208 fAutoInsertJavaTriggerText= getTextControl(labelledTextField);
210 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJavaDoc"); //$NON-NLS-1$
211 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
212 fAutoInsertJavaDocTriggerLabel= getLabelControl(labelledTextField);
213 fAutoInsertJavaDocTriggerText= getTextControl(labelledTextField);
215 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
216 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
217 fAutoInsertHTMLTriggerLabel= getLabelControl(labelledTextField);
218 fAutoInsertHTMLTriggerText= getTextControl(labelledTextField);
220 Label l= new Label(contentAssistComposite, SWT.LEFT);
221 l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.colorOptions")); //$NON-NLS-1$
222 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
223 gd.horizontalSpan= 2;
226 Composite editorComposite= new Composite(contentAssistComposite, SWT.NONE);
227 layout= new GridLayout();
228 layout.numColumns= 2;
229 layout.marginHeight= 0;
230 layout.marginWidth= 0;
231 editorComposite.setLayout(layout);
232 gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
233 gd.horizontalSpan= 2;
234 editorComposite.setLayoutData(gd);
236 fContentAssistColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
237 gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
238 gd.heightHint= pixelConverter.convertHeightInCharsToPixels(8);
239 fContentAssistColorList.setLayoutData(gd);
241 Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
242 layout= new GridLayout();
243 layout.marginHeight= 0;
244 layout.marginWidth= 0;
245 layout.numColumns= 2;
246 stylesComposite.setLayout(layout);
247 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
249 l= new Label(stylesComposite, SWT.LEFT);
250 l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.color")); //$NON-NLS-1$
252 gd.horizontalAlignment= GridData.BEGINNING;
255 fContentAssistColorEditor= new ColorEditor(stylesComposite);
256 Button colorButton= fContentAssistColorEditor.getButton();
257 gd= new GridData(GridData.FILL_HORIZONTAL);
258 gd.horizontalAlignment= GridData.BEGINNING;
259 colorButton.setLayoutData(gd);
261 fContentAssistColorList.addSelectionListener(new SelectionListener() {
262 public void widgetDefaultSelected(SelectionEvent e) {
265 public void widgetSelected(SelectionEvent e) {
266 handleContentAssistColorListSelection();
269 colorButton.addSelectionListener(new SelectionListener() {
270 public void widgetDefaultSelected(SelectionEvent e) {
273 public void widgetSelected(SelectionEvent e) {
274 int i= fContentAssistColorList.getSelectionIndex();
275 String key= fContentAssistColorListModel[i][1];
277 PreferenceConverter.setValue(fStore, key, fContentAssistColorEditor.getColorValue());
281 return contentAssistComposite;
284 private void createDependency(final Button master, String masterKey, final Control slave) {
286 boolean masterState= fStore.getBoolean(masterKey);
287 slave.setEnabled(masterState);
288 SelectionListener listener= new SelectionListener() {
289 public void widgetSelected(SelectionEvent e) {
290 slave.setEnabled(master.getSelection());
293 public void widgetDefaultSelected(SelectionEvent e) {}
295 master.addSelectionListener(listener);
296 fMasterSlaveListeners.add(listener);
299 private static void indent(Control control) {
300 GridData gridData= new GridData();
301 gridData.horizontalIndent= 20;
302 control.setLayoutData(gridData);
305 private static Text getTextControl(Control[] labelledTextField){
306 return (Text)labelledTextField[1];
309 private static Label getLabelControl(Control[] labelledTextField){
310 return (Label)labelledTextField[0];
314 * Returns an array of size 2:
315 * - first element is of type <code>Label</code>
316 * - second element is of type <code>Text</code>
317 * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
319 * @param composite the parent composite
320 * @param label the text field's label
321 * @param key the preference key
322 * @param textLimit the text limit
323 * @param indentation the field's indentation
324 * @param isNumber <code>true</code> iff this text field is used to e4dit a number
327 private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
329 PixelConverter pixelConverter= new PixelConverter(composite);
331 Label labelControl= new Label(composite, SWT.NONE);
332 labelControl.setText(label);
333 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
334 gd.horizontalIndent= indentation;
335 labelControl.setLayoutData(gd);
337 Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
338 gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
339 gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
340 textControl.setLayoutData(gd);
341 textControl.setTextLimit(textLimit);
342 fTextFields.put(textControl, key);
344 fNumberFields.add(textControl);
345 textControl.addModifyListener(fNumberFieldListener);
347 textControl.addModifyListener(fTextFieldListener);
350 return new Control[]{labelControl, textControl};
353 private void addCompletionRadioButtons(Composite contentAssistComposite) {
354 Composite completionComposite= new Composite(contentAssistComposite, SWT.NONE);
355 GridData ccgd= new GridData();
356 ccgd.horizontalSpan= 2;
357 completionComposite.setLayoutData(ccgd);
358 GridLayout ccgl= new GridLayout();
361 completionComposite.setLayout(ccgl);
363 // SelectionListener completionSelectionListener= new SelectionAdapter() {
364 // public void widgetSelected(SelectionEvent e) {
365 // boolean insert= fCompletionInsertsRadioButton.getSelection();
366 // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, insert);
370 // fCompletionInsertsRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
371 // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts")); //$NON-NLS-1$
372 // fCompletionInsertsRadioButton.setLayoutData(new GridData());
373 // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
375 // fCompletionOverwritesRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
376 // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites")); //$NON-NLS-1$
377 // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
378 // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
381 public void initialize() {
384 for (int i= 0; i < fContentAssistColorListModel.length; i++)
385 fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
386 fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
388 if (fContentAssistColorList != null && !fContentAssistColorList.isDisposed()) {
389 fContentAssistColorList.select(0);
390 handleContentAssistColorListSelection();
397 void initializeFields() {
398 Iterator e= fCheckBoxes.keySet().iterator();
399 while (e.hasNext()) {
400 Button b= (Button) e.next();
401 String key= (String) fCheckBoxes.get(b);
402 b.setSelection(fStore.getBoolean(key));
405 e= fTextFields.keySet().iterator();
406 while (e.hasNext()) {
407 Text t= (Text) e.next();
408 String key= (String) fTextFields.get(t);
409 t.setText(fStore.getString(key));
412 // boolean completionInserts= fStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
413 // fCompletionInsertsRadioButton.setSelection(completionInserts);
414 // fCompletionOverwritesRadioButton.setSelection(! completionInserts);
416 updateAutoactivationControls();
418 updateStatus(validatePositiveNumber("0")); //$NON-NLS-1$
421 Iterator iter= fMasterSlaveListeners.iterator();
422 while (iter.hasNext()) {
423 SelectionListener listener= (SelectionListener)iter.next();
424 listener.widgetSelected(null);
428 private void updateAutoactivationControls() {
429 boolean autoactivation= fStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
430 fAutoInsertDelayText.setEnabled(autoactivation);
431 fAutoInsertDelayLabel.setEnabled(autoactivation);
433 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
434 fAutoInsertJavaTriggerLabel.setEnabled(autoactivation);
436 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
437 fAutoInsertJavaDocTriggerLabel.setEnabled(autoactivation);
439 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
440 fAutoInsertHTMLTriggerLabel.setEnabled(autoactivation);
443 public void performOk() {
446 public void performDefaults() {
447 handleContentAssistColorListSelection();
451 private void handleContentAssistColorListSelection() {
452 int i= fContentAssistColorList.getSelectionIndex();
453 String key= fContentAssistColorListModel[i][1];
454 RGB rgb= PreferenceConverter.getColor(fStore, key);
455 fContentAssistColorEditor.setColorValue(rgb);
458 private void numberFieldChanged(Text textControl) {
459 String number= textControl.getText();
460 IStatus status= validatePositiveNumber(number);
461 if (!status.matches(IStatus.ERROR))
462 fStore.setValue((String) fTextFields.get(textControl), number);
463 updateStatus(status);
466 private IStatus validatePositiveNumber(String number) {
467 StatusInfo status= new StatusInfo();
468 if (number.length() == 0) {
469 status.setError(PreferencesMessages.getString("JavaEditorPreferencePage.empty_input")); //$NON-NLS-1$
472 int value= Integer.parseInt(number);
474 status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
475 } catch (NumberFormatException e) {
476 status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
482 private void updateStatus(IStatus status) {
483 fMainPreferencePage.setValid(status.isOK());
484 StatusUtil.applyToStatusLine(fMainPreferencePage, status);
487 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
488 Button checkBox= new Button(parent, SWT.CHECK);
489 checkBox.setText(label);
491 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
492 gd.horizontalIndent= indentation;
493 gd.horizontalSpan= 2;
494 checkBox.setLayoutData(gd);
495 checkBox.addSelectionListener(fCheckBoxListener);
497 fCheckBoxes.put(checkBox, key);
503 * @see DialogPage#dispose()
505 public void dispose() {
506 // nothing to dispose