Added some examples for context menu on Outline
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / preferences / SpellingPreferencePage.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.internal.ui.preferences;
13
14 import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
15 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
16 import net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener;
17 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
18
19 import org.eclipse.core.runtime.IStatus;
20 import org.eclipse.jface.dialogs.Dialog;
21 import org.eclipse.jface.preference.PreferencePage;
22 import org.eclipse.swt.widgets.Composite;
23 import org.eclipse.swt.widgets.Control;
24 import org.eclipse.ui.IWorkbench;
25 import org.eclipse.ui.IWorkbenchPreferencePage;
26 import org.eclipse.ui.help.WorkbenchHelp;
27
28 /**
29  * Preference page for spell checking preferences.
30  * 
31  * @since 3.0
32  */
33 public class SpellingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IStatusChangeListener {
34
35         /** The spelling configuration block */
36         private final SpellingConfigurationBlock fBlock= new SpellingConfigurationBlock(this, null);
37
38         /**
39          * Creates a new spelling preference page.
40          */
41         public SpellingPreferencePage() {
42
43                 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
44                 setDescription(PreferencesMessages.getString("SpellingPreferencePage.description")); //$NON-NLS-1$
45                 setTitle(PreferencesMessages.getString("SpellingPreferencePage.title")); //$NON-NLS-1$
46         }
47
48         /*
49          * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
50          */
51         protected Control createContents(final Composite parent) {
52
53                 final Control control= fBlock.createContents(parent);
54                 Dialog.applyDialogFont(control);
55
56                 return control;
57         }
58
59         /*
60          * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
61          */
62         public void createControl(final Composite parent) {
63                 super.createControl(parent);
64                 WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
65         }
66
67         /*
68          * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
69          */
70         public void init(final IWorkbench workbench) {
71                 // Do nothing
72         }
73
74         /*
75          * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
76          */
77         protected void performDefaults() {
78                 fBlock.performDefaults();
79
80                 super.performDefaults();
81         }
82
83         /*
84          * @see org.eclipse.jface.preference.IPreferencePage#performOk()
85          */
86         public boolean performOk() {
87
88                 if (!fBlock.performOk(true))
89                         return false;
90
91                 return super.performOk();
92         }
93
94         /*
95          * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
96          */
97         public void statusChanged(final IStatus status) {
98                 setValid(!status.matches(IStatus.ERROR));
99
100                 StatusUtil.applyToStatusLine(this, status);
101         }
102 }