KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > preferences > TodoTaskPreferencePage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.ui.preferences;
12
13 import org.eclipse.core.runtime.IAdaptable;
14
15 import org.eclipse.core.resources.IProject;
16
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19
20 import org.eclipse.ui.PlatformUI;
21 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
22
23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
24 import org.eclipse.jdt.internal.ui.JavaPlugin;
25
26 /*
27  * The page to configure the task tags
28  */

29 public class TodoTaskPreferencePage extends PropertyAndPreferencePage {
30
31     public static final String JavaDoc PREF_ID= "org.eclipse.jdt.ui.preferences.TodoTaskPreferencePage"; //$NON-NLS-1$
32
public static final String JavaDoc PROP_ID= "org.eclipse.jdt.ui.propertyPages.TodoTaskPreferencePage"; //$NON-NLS-1$
33

34     private TodoTaskConfigurationBlock fConfigurationBlock;
35
36     public TodoTaskPreferencePage() {
37         setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
38         setDescription(PreferencesMessages.TodoTaskPreferencePage_description);
39         
40         // only used when page is shown programatically
41
setTitle(PreferencesMessages.TodoTaskPreferencePage_title);
42     }
43             
44     /*
45      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
46      */

47     public void createControl(Composite parent) {
48         IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer();
49         fConfigurationBlock= new TodoTaskConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
50         
51         super.createControl(parent);
52         
53         if (isProjectPreferencePage()) {
54             PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PROPERTY_PAGE);
55         } else {
56             PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE);
57         }
58     }
59
60     /* (non-Javadoc)
61      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#createPreferenceContent(org.eclipse.swt.widgets.Composite)
62      */

63     protected Control createPreferenceContent(Composite composite) {
64         return fConfigurationBlock.createContents(composite);
65     }
66     
67     /* (non-Javadoc)
68      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#hasProjectSpecificOptions(org.eclipse.core.resources.IProject)
69      */

70     protected boolean hasProjectSpecificOptions(IProject project) {
71         return fConfigurationBlock.hasProjectSpecificOptions(project);
72     }
73     
74     
75     /* (non-Javadoc)
76      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
77      */

78     protected String JavaDoc getPreferencePageID() {
79         return PREF_ID;
80     }
81     
82     /* (non-Javadoc)
83      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
84      */

85     protected String JavaDoc getPropertyPageID() {
86         return PROP_ID;
87     }
88     
89     /* (non-Javadoc)
90      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean)
91      */

92     protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
93         super.enableProjectSpecificSettings(useProjectSpecificSettings);
94         if (fConfigurationBlock != null) {
95             fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings);
96         }
97     }
98             
99     /*
100      * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
101      */

102     protected void performDefaults() {
103         super.performDefaults();
104         if (fConfigurationBlock != null) {
105             fConfigurationBlock.performDefaults();
106         }
107     }
108
109     /*
110      * @see org.eclipse.jface.preference.IPreferencePage#performOk()
111      */

112     public boolean performOk() {
113         if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) {
114             return false;
115         }
116         return super.performOk();
117     }
118     
119     /*
120      * @see org.eclipse.jface.preference.IPreferencePage#performApply()
121      */

122     public void performApply() {
123         if (fConfigurationBlock != null) {
124             fConfigurationBlock.performApply();
125         }
126     }
127     
128     /* (non-Javadoc)
129      * @see org.eclipse.jface.dialogs.DialogPage#dispose()
130      */

131     public void dispose() {
132         if (fConfigurationBlock != null) {
133             fConfigurationBlock.dispose();
134         }
135         super.dispose();
136     }
137     
138     /* (non-Javadoc)
139      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#setElement(org.eclipse.core.runtime.IAdaptable)
140      */

141     public void setElement(IAdaptable element) {
142         super.setElement(element);
143         setDescription(null); // no description for property page
144
}
145
146
147 }
148
Popular Tags