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 org.eclipse.core.runtime.IStatus;
21 import org.eclipse.swt.SWT;
22 import org.eclipse.swt.events.ModifyEvent;
23 import org.eclipse.swt.events.ModifyListener;
24 import org.eclipse.swt.events.SelectionAdapter;
25 import org.eclipse.swt.events.SelectionEvent;
26 import org.eclipse.swt.events.SelectionListener;
27 import org.eclipse.swt.graphics.RGB;
28 import org.eclipse.swt.layout.GridData;
29 import org.eclipse.swt.layout.GridLayout;
30 import org.eclipse.swt.widgets.Button;
31 import org.eclipse.swt.widgets.Composite;
32 import org.eclipse.swt.widgets.Control;
33 import org.eclipse.swt.widgets.Label;
34 import org.eclipse.swt.widgets.List;
35 import org.eclipse.swt.widgets.Text;
37 import org.eclipse.jface.preference.PreferenceConverter;
38 import org.eclipse.jface.preference.PreferencePage;
40 import org.eclipse.jface.text.Assert;
42 import net.sourceforge.phpdt.ui.PreferenceConstants;
44 import net.sourceforge.phpdt.internal.ui.dialogs.StatusInfo;
45 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
46 import net.sourceforge.phpdt.internal.ui.util.PixelConverter;
49 * Configures the code assist preferences.
53 class CodeAssistConfigurationBlock implements IPreferenceConfigurationBlock {
56 private OverlayPreferenceStore fStore;
57 private PreferencePage fMainPreferencePage;
59 private List fContentAssistColorList;
60 private ColorEditor fContentAssistColorEditor;
61 private Control fAutoInsertDelayText;
62 private Control fAutoInsertJavaTriggerText;
63 private Control fAutoInsertJavaDocTriggerText;
64 private Control fAutoInsertHTMLTriggerText;
65 private Label fAutoInsertDelayLabel;
66 private Label fAutoInsertJavaTriggerLabel;
67 private Label fAutoInsertJavaDocTriggerLabel;
68 private Label fAutoInsertHTMLTriggerLabel;
69 // private Button fCompletionInsertsRadioButton;
70 // private Button fCompletionOverwritesRadioButton;
72 * List of master/slave listeners when there's a dependency.
74 * @see #createDependency(Button, String, Control)
77 private ArrayList fMasterSlaveListeners= new ArrayList();
79 private final String[][] fContentAssistColorListModel= new String[][] {
80 {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND }, //$NON-NLS-1$
81 {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionProposals"), PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND }, //$NON-NLS-1$
82 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND }, //$NON-NLS-1$
83 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForMethodParameters"), PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND }, //$NON-NLS-1$
84 // {PreferencesMessages.getString("JavaEditorPreferencePage.backgroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND }, //$NON-NLS-1$
85 // {PreferencesMessages.getString("JavaEditorPreferencePage.foregroundForCompletionReplacement"), PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND } //$NON-NLS-1$
89 private Map fCheckBoxes= new HashMap();
90 private SelectionListener fCheckBoxListener= new SelectionListener() {
91 public void widgetDefaultSelected(SelectionEvent e) {
93 public void widgetSelected(SelectionEvent e) {
94 Button button= (Button) e.widget;
95 fStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
99 private Map fTextFields= new HashMap();
100 private ModifyListener fTextFieldListener= new ModifyListener() {
101 public void modifyText(ModifyEvent e) {
102 Text text= (Text) e.widget;
103 fStore.setValue((String) fTextFields.get(text), text.getText());
107 private ArrayList fNumberFields= new ArrayList();
108 private ModifyListener fNumberFieldListener= new ModifyListener() {
109 public void modifyText(ModifyEvent e) {
110 numberFieldChanged((Text) e.widget);
115 public CodeAssistConfigurationBlock(PreferencePage mainPreferencePage, OverlayPreferenceStore store) {
116 Assert.isNotNull(mainPreferencePage);
117 Assert.isNotNull(store);
119 fStore.addKeys(createOverlayStoreKeys());
120 fMainPreferencePage= mainPreferencePage;
124 private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
126 ArrayList overlayKeys= new ArrayList();
128 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOACTIVATION));
129 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
130 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_AUTOINSERT));
131 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND));
132 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND));
133 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND));
134 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND));
135 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND));
136 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND));
137 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA));
138 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC));
139 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML));
140 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS));
141 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS));
142 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_CASE_SENSITIVITY));
143 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_ADDIMPORT));
144 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_INSERT_COMPLETION));
145 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES));
146 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS));
147 overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.CODEASSIST_PREFIX_COMPLETION));
149 OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
150 overlayKeys.toArray(keys);
155 * Creates page for hover preferences.
157 * @param parent the parent composite
158 * @return the control for the preference page
160 public Control createControl(Composite parent) {
162 PixelConverter pixelConverter= new PixelConverter(parent);
164 Composite contentAssistComposite= new Composite(parent, SWT.NONE);
165 contentAssistComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
166 GridLayout layout= new GridLayout();
167 layout.numColumns= 2;
168 contentAssistComposite.setLayout(layout);
170 // addCompletionRadioButtons(contentAssistComposite);
173 // label= PreferencesMessages.getString("JavaEditorPreferencePage.insertSingleProposalsAutomatically"); //$NON-NLS-1$
174 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOINSERT, 0);
176 // label= PreferencesMessages.getString("JavaEditorPreferencePage.completePrefixes"); //$NON-NLS-1$
177 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_PREFIX_COMPLETION, 0);
179 // label= PreferencesMessages.getString("JavaEditorPreferencePage.showOnlyProposalsVisibleInTheInvocationContext"); //$NON-NLS-1$
180 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, 0);
182 // label= PreferencesMessages.getString("JavaEditorPreferencePage.presentProposalsInAlphabeticalOrder"); //$NON-NLS-1$
183 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ORDER_PROPOSALS, 0);
185 // label= PreferencesMessages.getString("JavaEditorPreferencePage.automaticallyAddImportInsteadOfQualifiedName"); //$NON-NLS-1$
186 // addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_ADDIMPORT, 0);
188 // label= PreferencesMessages.getString("JavaEditorPreferencePage.fillArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
189 // Button master= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, 0);
191 // label= PreferencesMessages.getString("JavaEditorPreferencePage.guessArgumentNamesOnMethodCompletion"); //$NON-NLS-1$
192 // Button slave= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, 0);
193 // createDependency(master, PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES, slave);
195 label= PreferencesMessages.getString("JavaEditorPreferencePage.enableAutoActivation"); //$NON-NLS-1$
196 final Button autoactivation= addCheckBox(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION, 0);
197 autoactivation.addSelectionListener(new SelectionAdapter(){
198 public void widgetSelected(SelectionEvent e) {
199 updateAutoactivationControls();
203 Control[] labelledTextField;
204 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationDelay"); //$NON-NLS-1$
205 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 4, 0, true);
206 fAutoInsertDelayLabel= getLabelControl(labelledTextField);
207 fAutoInsertDelayText= getTextControl(labelledTextField);
209 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJava"); //$NON-NLS-1$
210 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA, 4, 0, false);
211 fAutoInsertJavaTriggerLabel= getLabelControl(labelledTextField);
212 fAutoInsertJavaTriggerText= getTextControl(labelledTextField);
214 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForJavaDoc"); //$NON-NLS-1$
215 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVADOC, 4, 0, false);
216 fAutoInsertJavaDocTriggerLabel= getLabelControl(labelledTextField);
217 fAutoInsertJavaDocTriggerText= getTextControl(labelledTextField);
219 label= PreferencesMessages.getString("JavaEditorPreferencePage.autoActivationTriggersForHTML"); //$NON-NLS-1$
220 labelledTextField= addLabelledTextField(contentAssistComposite, label, PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_HTML, 4, 0, false);
221 fAutoInsertHTMLTriggerLabel= getLabelControl(labelledTextField);
222 fAutoInsertHTMLTriggerText= getTextControl(labelledTextField);
224 Label l= new Label(contentAssistComposite, SWT.LEFT);
225 l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.colorOptions")); //$NON-NLS-1$
226 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
227 gd.horizontalSpan= 2;
230 Composite editorComposite= new Composite(contentAssistComposite, SWT.NONE);
231 layout= new GridLayout();
232 layout.numColumns= 2;
233 layout.marginHeight= 0;
234 layout.marginWidth= 0;
235 editorComposite.setLayout(layout);
236 gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
237 gd.horizontalSpan= 2;
238 editorComposite.setLayoutData(gd);
240 fContentAssistColorList= new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
241 gd= new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
242 gd.heightHint= pixelConverter.convertHeightInCharsToPixels(8);
243 fContentAssistColorList.setLayoutData(gd);
245 Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
246 layout= new GridLayout();
247 layout.marginHeight= 0;
248 layout.marginWidth= 0;
249 layout.numColumns= 2;
250 stylesComposite.setLayout(layout);
251 stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
253 l= new Label(stylesComposite, SWT.LEFT);
254 l.setText(PreferencesMessages.getString("JavaEditorPreferencePage.codeAssist.color")); //$NON-NLS-1$
256 gd.horizontalAlignment= GridData.BEGINNING;
259 fContentAssistColorEditor= new ColorEditor(stylesComposite);
260 Button colorButton= fContentAssistColorEditor.getButton();
261 gd= new GridData(GridData.FILL_HORIZONTAL);
262 gd.horizontalAlignment= GridData.BEGINNING;
263 colorButton.setLayoutData(gd);
265 fContentAssistColorList.addSelectionListener(new SelectionListener() {
266 public void widgetDefaultSelected(SelectionEvent e) {
269 public void widgetSelected(SelectionEvent e) {
270 handleContentAssistColorListSelection();
273 colorButton.addSelectionListener(new SelectionListener() {
274 public void widgetDefaultSelected(SelectionEvent e) {
277 public void widgetSelected(SelectionEvent e) {
278 int i= fContentAssistColorList.getSelectionIndex();
279 String key= fContentAssistColorListModel[i][1];
281 PreferenceConverter.setValue(fStore, key, fContentAssistColorEditor.getColorValue());
285 return contentAssistComposite;
288 private void createDependency(final Button master, String masterKey, final Control slave) {
290 boolean masterState= fStore.getBoolean(masterKey);
291 slave.setEnabled(masterState);
292 SelectionListener listener= new SelectionListener() {
293 public void widgetSelected(SelectionEvent e) {
294 slave.setEnabled(master.getSelection());
297 public void widgetDefaultSelected(SelectionEvent e) {}
299 master.addSelectionListener(listener);
300 fMasterSlaveListeners.add(listener);
303 private static void indent(Control control) {
304 GridData gridData= new GridData();
305 gridData.horizontalIndent= 20;
306 control.setLayoutData(gridData);
309 private static Text getTextControl(Control[] labelledTextField){
310 return (Text)labelledTextField[1];
313 private static Label getLabelControl(Control[] labelledTextField){
314 return (Label)labelledTextField[0];
318 * Returns an array of size 2:
319 * - first element is of type <code>Label</code>
320 * - second element is of type <code>Text</code>
321 * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
323 * @param composite the parent composite
324 * @param label the text field's label
325 * @param key the preference key
326 * @param textLimit the text limit
327 * @param indentation the field's indentation
328 * @param isNumber <code>true</code> iff this text field is used to e4dit a number
331 private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
333 PixelConverter pixelConverter= new PixelConverter(composite);
335 Label labelControl= new Label(composite, SWT.NONE);
336 labelControl.setText(label);
337 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
338 gd.horizontalIndent= indentation;
339 labelControl.setLayoutData(gd);
341 Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
342 gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
343 gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
344 textControl.setLayoutData(gd);
345 textControl.setTextLimit(textLimit);
346 fTextFields.put(textControl, key);
348 fNumberFields.add(textControl);
349 textControl.addModifyListener(fNumberFieldListener);
351 textControl.addModifyListener(fTextFieldListener);
354 return new Control[]{labelControl, textControl};
357 private void addCompletionRadioButtons(Composite contentAssistComposite) {
358 Composite completionComposite= new Composite(contentAssistComposite, SWT.NONE);
359 GridData ccgd= new GridData();
360 ccgd.horizontalSpan= 2;
361 completionComposite.setLayoutData(ccgd);
362 GridLayout ccgl= new GridLayout();
365 completionComposite.setLayout(ccgl);
367 // SelectionListener completionSelectionListener= new SelectionAdapter() {
368 // public void widgetSelected(SelectionEvent e) {
369 // boolean insert= fCompletionInsertsRadioButton.getSelection();
370 // fStore.setValue(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, insert);
374 // fCompletionInsertsRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
375 // fCompletionInsertsRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionInserts")); //$NON-NLS-1$
376 // fCompletionInsertsRadioButton.setLayoutData(new GridData());
377 // fCompletionInsertsRadioButton.addSelectionListener(completionSelectionListener);
379 // fCompletionOverwritesRadioButton= new Button(completionComposite, SWT.RADIO | SWT.LEFT);
380 // fCompletionOverwritesRadioButton.setText(PreferencesMessages.getString("JavaEditorPreferencePage.completionOverwrites")); //$NON-NLS-1$
381 // fCompletionOverwritesRadioButton.setLayoutData(new GridData());
382 // fCompletionOverwritesRadioButton.addSelectionListener(completionSelectionListener);
385 public void initialize() {
388 for (int i= 0; i < fContentAssistColorListModel.length; i++)
389 fContentAssistColorList.add(fContentAssistColorListModel[i][0]);
390 fContentAssistColorList.getDisplay().asyncExec(new Runnable() {
392 if (fContentAssistColorList != null && !fContentAssistColorList.isDisposed()) {
393 fContentAssistColorList.select(0);
394 handleContentAssistColorListSelection();
401 void initializeFields() {
402 Iterator e= fCheckBoxes.keySet().iterator();
403 while (e.hasNext()) {
404 Button b= (Button) e.next();
405 String key= (String) fCheckBoxes.get(b);
406 b.setSelection(fStore.getBoolean(key));
409 e= fTextFields.keySet().iterator();
410 while (e.hasNext()) {
411 Text t= (Text) e.next();
412 String key= (String) fTextFields.get(t);
413 t.setText(fStore.getString(key));
416 // boolean completionInserts= fStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION);
417 // fCompletionInsertsRadioButton.setSelection(completionInserts);
418 // fCompletionOverwritesRadioButton.setSelection(! completionInserts);
420 updateAutoactivationControls();
422 updateStatus(validatePositiveNumber("0")); //$NON-NLS-1$
425 Iterator iter= fMasterSlaveListeners.iterator();
426 while (iter.hasNext()) {
427 SelectionListener listener= (SelectionListener)iter.next();
428 listener.widgetSelected(null);
432 private void updateAutoactivationControls() {
433 boolean autoactivation= fStore.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
434 fAutoInsertDelayText.setEnabled(autoactivation);
435 fAutoInsertDelayLabel.setEnabled(autoactivation);
437 fAutoInsertJavaTriggerText.setEnabled(autoactivation);
438 fAutoInsertJavaTriggerLabel.setEnabled(autoactivation);
440 fAutoInsertJavaDocTriggerText.setEnabled(autoactivation);
441 fAutoInsertJavaDocTriggerLabel.setEnabled(autoactivation);
443 fAutoInsertHTMLTriggerText.setEnabled(autoactivation);
444 fAutoInsertHTMLTriggerLabel.setEnabled(autoactivation);
447 public void performOk() {
450 public void performDefaults() {
451 handleContentAssistColorListSelection();
455 private void handleContentAssistColorListSelection() {
456 int i= fContentAssistColorList.getSelectionIndex();
457 String key= fContentAssistColorListModel[i][1];
458 RGB rgb= PreferenceConverter.getColor(fStore, key);
459 fContentAssistColorEditor.setColorValue(rgb);
462 private void numberFieldChanged(Text textControl) {
463 String number= textControl.getText();
464 IStatus status= validatePositiveNumber(number);
465 if (!status.matches(IStatus.ERROR))
466 fStore.setValue((String) fTextFields.get(textControl), number);
467 updateStatus(status);
470 private IStatus validatePositiveNumber(String number) {
471 StatusInfo status= new StatusInfo();
472 if (number.length() == 0) {
473 status.setError(PreferencesMessages.getString("JavaEditorPreferencePage.empty_input")); //$NON-NLS-1$
476 int value= Integer.parseInt(number);
478 status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
479 } catch (NumberFormatException e) {
480 status.setError(PreferencesMessages.getFormattedString("JavaEditorPreferencePage.invalid_input", number)); //$NON-NLS-1$
486 private void updateStatus(IStatus status) {
487 fMainPreferencePage.setValid(status.isOK());
488 StatusUtil.applyToStatusLine(fMainPreferencePage, status);
491 private Button addCheckBox(Composite parent, String label, String key, int indentation) {
492 Button checkBox= new Button(parent, SWT.CHECK);
493 checkBox.setText(label);
495 GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
496 gd.horizontalIndent= indentation;
497 gd.horizontalSpan= 2;
498 checkBox.setLayoutData(gd);
499 checkBox.addSelectionListener(fCheckBoxListener);
501 fCheckBoxes.put(checkBox, key);
507 * @see DialogPage#dispose()
509 public void dispose() {
510 // nothing to dispose