KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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  * Page used to configure both workspace and project specific compiler settings
28  */

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

34     private JavadocProblemsConfigurationBlock fConfigurationBlock;
35
36     public JavadocProblemsPreferencePage() {
37         setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
38         //setDescription(PreferencesMessages.getString("JavadocProblemsPreferencePage.description")); //$NON-NLS-1$
39

40         // only used when page is shown programatically
41
setTitle(PreferencesMessages.JavadocProblemsPreferencePage_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 JavadocProblemsConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
50         
51         super.createControl(parent);
52         if (isProjectPreferencePage()) {
53             PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVADOC_PROBLEMS_PROPERTY_PAGE);
54         } else {
55             PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVADOC_PROBLEMS_PREFERENCE_PAGE);
56         }
57     }
58
59     protected Control createPreferenceContent(Composite composite) {
60         return fConfigurationBlock.createContents(composite);
61     }
62     
63     protected boolean hasProjectSpecificOptions(IProject project) {
64         return fConfigurationBlock.hasProjectSpecificOptions(project);
65     }
66     
67     /* (non-Javadoc)
68      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
69      */

70     protected String JavaDoc getPreferencePageID() {
71         return PREF_ID;
72     }
73     
74     /* (non-Javadoc)
75      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
76      */

77     protected String JavaDoc getPropertyPageID() {
78         return PROP_ID;
79     }
80     
81     /* (non-Javadoc)
82      * @see org.eclipse.jface.dialogs.DialogPage#dispose()
83      */

84     public void dispose() {
85         if (fConfigurationBlock != null) {
86             fConfigurationBlock.dispose();
87         }
88         super.dispose();
89     }
90     
91     /* (non-Javadoc)
92      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean)
93      */

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

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

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

124     public void performApply() {
125         if (fConfigurationBlock != null) {
126             fConfigurationBlock.performApply();
127         }
128     }
129     
130     /* (non-Javadoc)
131      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#setElement(org.eclipse.core.runtime.IAdaptable)
132      */

133     public void setElement(IAdaptable element) {
134         super.setElement(element);
135         setDescription(null); // no description for property page
136
}
137     
138 }
139
Popular Tags