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