1 /*
2 * ========================================================================
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * ========================================================================
20 */
21 package org.apache.cactus.eclipse.runner.ui;
22
23 import org.eclipse.jface.preference.DirectoryFieldEditor;
24 import org.eclipse.jface.preference.FieldEditorPreferencePage;
25 import org.eclipse.jface.preference.IntegerFieldEditor;
26 import org.eclipse.jface.preference.StringFieldEditor;
27 import org.eclipse.ui.IWorkbench;
28 import org.eclipse.ui.IWorkbenchPreferencePage;
29
30 /**
31 * This class represents a preference page that is contributed to the
32 * Preferences dialog.
33 * <p>
34 * By subclassing <samp>FieldEditorPreferencePage</samp>, we can use the
35 * field support built into JFace that allows us to create a page that is
36 * small and knows how to save, restore and apply itself.
37 * </p>
38 * <p>
39 * This page is used to modify preferences only. They are stored in the
40 * preference store that belongs to the main plug-in class. That way,
41 * preferences can be accessed directly via the preference store.
42 * </p>
43 *
44 * @version $Id: CactusPreferencePage.java 238816 2004-02-29 16:36:46Z vmassol $
45 */
46 public class CactusPreferencePage
47 extends FieldEditorPreferencePage
48 implements IWorkbenchPreferencePage
49 {
50 /**
51 * Sets default plugin preferences.
52 */
53 public CactusPreferencePage()
54 {
55 super(GRID);
56 setPreferenceStore(CactusPlugin.getDefault().getPreferenceStore());
57 setDescription(
58 CactusMessages.getString("CactusPreferencePage.description"));
59 }
60
61 /**
62 * Creates the field editors. Field editors are abstractions of
63 * the common GUI blocks needed to manipulate various types
64 * of preferences. Each field editor knows how to save and
65 * restore itself.
66 */
67 public void createFieldEditors()
68 {
69 addField(
70 new StringFieldEditor(
71 CactusPreferences.CONTEXT_URL_HOST,
72 CactusMessages.getString("CactusPreferencePage.label.host"),
73 getFieldEditorParent()));
74 addField(
75 new IntegerFieldEditor(
76 CactusPreferences.CONTEXT_URL_PORT,
77 CactusMessages.getString("CactusPreferencePage.label.port"),
78 getFieldEditorParent()));
79 addField(
80 new StringFieldEditor(
81 CactusPreferences.CONTEXT_URL_PATH,
82 CactusMessages.getString("CactusPreferencePage.label.context"),
83 getFieldEditorParent()));
84 addField(
85 new DirectoryFieldEditor(
86 CactusPreferences.TEMP_DIR,
87 CactusMessages.getString("CactusPreferencePage.label.temp"),
88 getFieldEditorParent()));
89 }
90
91 /**
92 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
93 */
94 public void init(IWorkbench theWorkbench)
95 {
96 // nothing to do (yet)
97 }
98
99 }