KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

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

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