KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > editors > text > SpellingPreferencePage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.editors.text;
12
13 import org.eclipse.core.runtime.IStatus;
14
15 import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
16 import org.eclipse.ui.texteditor.spelling.IPreferenceStatusMonitor;
17
18
19 /**
20  * Spelling preference page.
21  * <p>
22  * Note: Must be public since it is referenced from plugin.xml
23  * </p>
24  *
25  * @since 3.1
26  */

27 public class SpellingPreferencePage extends AbstractConfigurationBlockPreferencePage {
28
29     /**
30      * Status monitor.
31      */

32     private class StatusMonitor implements IPreferenceStatusMonitor {
33
34         /*
35          * @see org.eclipse.ui.texteditor.spelling.IStatusMonitor#statusChanged(org.eclipse.core.runtime.IStatus)
36          */

37         public void statusChanged(IStatus status) {
38             handleStatusChanged(status);
39         }
40     }
41
42     /**
43      * Handles status changes.
44      *
45      * @param status the new status
46      */

47     protected void handleStatusChanged(IStatus status) {
48         setValid(!status.matches(IStatus.ERROR));
49         StatusUtil.applyToStatusLine(this, status);
50     }
51
52     /*
53      * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
54      */

55     protected String JavaDoc getHelpId() {
56         // XXX: To be made public after 3.3, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=188281
57
return IAbstractTextEditorHelpContextIds.PREFIX + "spelling_preference_page_context"; //$NON-NLS-1$
58
}
59
60     /*
61      * @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
62      */

63     protected void setDescription() {
64     }
65
66     /*
67      * @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
68      */

69     protected void setPreferenceStore() {
70         setPreferenceStore(EditorsPlugin.getDefault().getPreferenceStore());
71     }
72
73     /*
74      * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
75      */

76     protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
77         return new SpellingConfigurationBlock(overlayPreferenceStore, new StatusMonitor());
78     }
79 }
80
Popular Tags