KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > forrest > eclipse > preference > ForrestPreferences


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation or its licensors,
3  * as applicable.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.forrest.eclipse.preference;
18
19 import org.apache.forrest.eclipse.ForrestPlugin;
20 import org.eclipse.jface.preference.DirectoryFieldEditor;
21 import org.eclipse.jface.preference.FieldEditorPreferencePage;
22 import org.eclipse.ui.IWorkbench;
23 import org.eclipse.ui.IWorkbenchPreferencePage;
24
25 /**
26  * This class represents a preference page that is contributed to the
27  * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage </samp>,
28  * we can use the field support built into JFace that allows us to create a page
29  * that is small and knows how to save, restore and apply itself.
30  * <p>
31  * This page is used to modify preferences only. They are stored in the
32  * preference store that belongs to the main plug-in class. That way,
33  * preferences can be accessed directly via the preference store.
34  */

35
36 public class ForrestPreferences extends FieldEditorPreferencePage implements
37         IWorkbenchPreferencePage {
38     public static final String JavaDoc FORREST_HOME = "FORREST_HOME";
39     
40
41     public ForrestPreferences() {
42         super(GRID);
43         setPreferenceStore(ForrestPlugin.getDefault().getPreferenceStore());
44         setDescription("Configuration for Forrest");
45     }
46     
47     /**
48      * Creates the field editors. Field editors are abstractions of the common
49      * GUI blocks needed to manipulate various types of preferences. Each field
50      * editor knows how to save and restore itself.
51      */

52     public void createFieldEditors() {
53         addField(new DirectoryFieldEditor(FORREST_HOME, "&Forrest Home:",
54                 getFieldEditorParent()));
55
56     }
57
58     public void init(IWorkbench workbench) {
59         setPreferenceStore(ForrestPlugin.getDefault().getPreferenceStore());
60     }
61     
62 }
63
Popular Tags