KickJava   Java API By Example, From Geeks To Geeks.

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


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 naming style options.
28  */

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

34     
35     private ImportOrganizeConfigurationBlock fConfigurationBlock;
36
37     public ImportOrganizePreferencePage() {
38         setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
39         //setDescription(PreferencesMessages.ImportOrganizePreferencePage_description);
40

41         // only used when page is shown programatically
42
setTitle(PreferencesMessages.ImportOrganizePreferencePage_title);
43     }
44
45     /*
46      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
47      */

48     public void createControl(Composite parent) {
49         IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer();
50         fConfigurationBlock= new ImportOrganizeConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
51         
52         super.createControl(parent);
53         PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.ORGANIZE_IMPORTS_PREFERENCE_PAGE);
54     }
55
56     protected Control createPreferenceContent(Composite composite) {
57         return fConfigurationBlock.createContents(composite);
58     }
59     
60     protected boolean hasProjectSpecificOptions(IProject project) {
61         return fConfigurationBlock.hasProjectSpecificOptions(project);
62     }
63     
64     /* (non-Javadoc)
65      * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
66      */

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

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

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

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

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

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

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

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