KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > preferences > CompilersPreferencePage


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.pde.internal.ui.preferences;
12
13 import org.eclipse.jface.dialogs.Dialog;
14 import org.eclipse.jface.preference.PreferencePage;
15 import org.eclipse.pde.internal.ui.IHelpContextIds;
16 import org.eclipse.pde.internal.ui.PDEUIMessages;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.ui.IWorkbench;
20 import org.eclipse.ui.IWorkbenchPreferencePage;
21 import org.eclipse.ui.PlatformUI;
22
23 public class CompilersPreferencePage extends PreferencePage implements
24         IWorkbenchPreferencePage {
25
26     private CompilersConfigurationTab configurationBlock;
27
28     /**
29      *
30      */

31     public CompilersPreferencePage() {
32         super();
33         setDescription(PDEUIMessages.CompilersPreferencePage_desc);
34         // only used when page is shown programatically
35
setTitle(PDEUIMessages.CompilersPreferencePage_title);
36
37         configurationBlock = new CompilersConfigurationTab(null);
38     }
39
40     /*
41      * (non-Javadoc)
42      *
43      * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
44      */

45     protected Control createContents(Composite parent) {
46         Control result = configurationBlock.createContents(parent);
47         Dialog.applyDialogFont(result);
48         return result;
49     }
50
51     /*
52      * @see PreferencePage#createControl(Composite)
53      */

54     public void createControl(Composite parent) {
55         super.createControl(parent);
56         PlatformUI.getWorkbench().getHelpSystem()
57                 .setHelp(getControl(), IHelpContextIds.COMPILERS_PREFERENCE_PAGE);
58     }
59
60     /*
61      * (non-Javadoc)
62      *
63      * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
64      */

65     public void init(IWorkbench workbench) {
66     }
67
68     /*
69      * @see PreferencePage#performDefaults()
70      */

71     protected void performDefaults() {
72         configurationBlock.performDefaults();
73         super.performDefaults();
74     }
75
76     /*
77      * @see IPreferencePage#performOk()
78      */

79     public boolean performOk() {
80         if (!configurationBlock.performOk(true)) {
81             getContainer().updateButtons();
82             return false;
83         }
84         return super.performOk();
85     }
86
87 }
88
Popular Tags