KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2007 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.resources.IProject;
14
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.Control;
17
18 import org.eclipse.ui.IWorkbenchPreferencePage;
19 import org.eclipse.ui.PlatformUI;
20 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
21
22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
23
24
25 /**
26  * Content Assist > Static Members preference page.
27  * <p>
28  * Note: Must be public since it is referenced from plugin.xml
29  * </p>
30  *
31  * @since 3.3
32  */

33 public class CodeAssistFavoritesPreferencePage extends PropertyAndPreferencePage implements IWorkbenchPreferencePage {
34
35     private CodeAssistFavoritesConfigurationBlock fConfigurationBlock;
36
37     public void createControl(Composite parent) {
38         IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer();
39         fConfigurationBlock= new CodeAssistFavoritesConfigurationBlock(getNewStatusChangedListener(), container);
40         
41         super.createControl(parent);
42         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
43     }
44
45     protected Control createPreferenceContent(Composite composite) {
46         return fConfigurationBlock.createContents(composite);
47     }
48
49     protected boolean hasProjectSpecificOptions(IProject project) {
50         return false;
51     }
52
53     protected String JavaDoc getPreferencePageID() {
54         return "org.eclipse.jdt.ui.preferences.CodeAssistStaticMembersPreferencePage"; //$NON-NLS-1$
55
}
56
57     protected String JavaDoc getPropertyPageID() {
58         return null;
59     }
60     
61         /* (non-Javadoc)
62      * @see org.eclipse.jface.dialogs.DialogPage#dispose()
63      */

64     public void dispose() {
65         if (fConfigurationBlock != null) {
66             fConfigurationBlock.dispose();
67         }
68         super.dispose();
69     }
70     
71     /*
72      * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
73      */

74     protected void performDefaults() {
75         super.performDefaults();
76         if (fConfigurationBlock != null) {
77             fConfigurationBlock.performDefaults();
78         }
79     }
80
81     /*
82      * @see org.eclipse.jface.preference.IPreferencePage#performOk()
83      */

84     public boolean performOk() {
85         if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) {
86             return false;
87         }
88         return super.performOk();
89     }
90     
91     /*
92      * @see org.eclipse.jface.preference.IPreferencePage#performApply()
93      */

94     public void performApply() {
95         if (fConfigurationBlock != null) {
96             fConfigurationBlock.performApply();
97         }
98     }
99
100 }
101
Popular Tags