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 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;
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.PlatformUI;
29 * Preference page for spell checking preferences.
33 public class SpellingPreferencePage extends PreferencePage implements
34 IWorkbenchPreferencePage, IStatusChangeListener {
36 /** The spelling configuration block */
37 private final SpellingConfigurationBlock fBlock = new SpellingConfigurationBlock(
41 * Creates a new spelling preference page.
43 public SpellingPreferencePage() {
45 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
46 setDescription(PreferencesMessages
47 .getString("SpellingPreferencePage.description")); //$NON-NLS-1$
48 setTitle(PreferencesMessages.getString("SpellingPreferencePage.title")); //$NON-NLS-1$
52 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
54 protected Control createContents(final Composite parent) {
56 final Control control = fBlock.createContents(parent);
57 Dialog.applyDialogFont(control);
63 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
65 public void createControl(final Composite parent) {
66 super.createControl(parent);
67 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
68 IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
72 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
74 public void init(final IWorkbench workbench) {
79 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
81 protected void performDefaults() {
82 fBlock.performDefaults();
84 super.performDefaults();
88 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
90 public boolean performOk() {
92 if (!fBlock.performOk(true))
95 return super.performOk();
99 * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
101 public void statusChanged(final IStatus status) {
102 setValid(!status.matches(IStatus.ERROR));
104 StatusUtil.applyToStatusLine(this, status);