01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.preferences;
11:
12: import org.eclipse.jface.dialogs.Dialog;
13: import org.eclipse.jface.preference.PreferencePage;
14: import org.eclipse.pde.internal.ui.IHelpContextIds;
15: import org.eclipse.pde.internal.ui.PDEUIMessages;
16: import org.eclipse.swt.widgets.Composite;
17: import org.eclipse.swt.widgets.Control;
18: import org.eclipse.ui.IWorkbench;
19: import org.eclipse.ui.IWorkbenchPreferencePage;
20: import org.eclipse.ui.PlatformUI;
21:
22: public class CompilersPreferencePage extends PreferencePage implements
23: IWorkbenchPreferencePage {
24:
25: private CompilersConfigurationTab configurationBlock;
26:
27: /**
28: *
29: */
30: public CompilersPreferencePage() {
31: super ();
32: setDescription(PDEUIMessages.CompilersPreferencePage_desc);
33: // only used when page is shown programatically
34: setTitle(PDEUIMessages.CompilersPreferencePage_title);
35:
36: configurationBlock = new CompilersConfigurationTab(null);
37: }
38:
39: /*
40: * (non-Javadoc)
41: *
42: * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
43: */
44: protected Control createContents(Composite parent) {
45: Control result = configurationBlock.createContents(parent);
46: Dialog.applyDialogFont(result);
47: return result;
48: }
49:
50: /*
51: * @see PreferencePage#createControl(Composite)
52: */
53: public void createControl(Composite parent) {
54: super .createControl(parent);
55: PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
56: IHelpContextIds.COMPILERS_PREFERENCE_PAGE);
57: }
58:
59: /*
60: * (non-Javadoc)
61: *
62: * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
63: */
64: public void init(IWorkbench workbench) {
65: }
66:
67: /*
68: * @see PreferencePage#performDefaults()
69: */
70: protected void performDefaults() {
71: configurationBlock.performDefaults();
72: super .performDefaults();
73: }
74:
75: /*
76: * @see IPreferencePage#performOk()
77: */
78: public boolean performOk() {
79: if (!configurationBlock.performOk(true)) {
80: getContainer().updateButtons();
81: return false;
82: }
83: return super.performOk();
84: }
85:
86: }
|