Replace deprecated org.eclipse.jface.text.rules.DefaultPartitioner with org.eclipse...
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / preferences / CompilerPreferencePage.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
12
13 import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
14 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
15 import net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener;
16 //import net.sourceforge.phpeclipse.PHPeclipsePlugin;
17 import net.sourceforge.phpeclipse.ui.WebUI;
18
19 import org.eclipse.core.runtime.IStatus;
20 import org.eclipse.jface.dialogs.Dialog;
21 import org.eclipse.jface.preference.PreferencePage;
22 import org.eclipse.swt.widgets.Composite;
23 import org.eclipse.swt.widgets.Control;
24 import org.eclipse.ui.IWorkbench;
25 import org.eclipse.ui.IWorkbenchPreferencePage;
26 import org.eclipse.ui.PlatformUI;
27
28 /*
29  * The page to configure the compiler options.
30  */
31 public class CompilerPreferencePage extends PreferencePage implements
32                 IWorkbenchPreferencePage, IStatusChangeListener {
33
34         private CompilerConfigurationBlock fConfigurationBlock;
35
36         public CompilerPreferencePage() {
37                 setPreferenceStore(WebUI.getDefault().getPreferenceStore());
38                 setDescription(PreferencesMessages
39                                 .getString("CompilerPreferencePage.description")); //$NON-NLS-1$
40
41                 // only used when page is shown programatically
42                 setTitle(PreferencesMessages.getString("CompilerPreferencePage.title")); //$NON-NLS-1$
43
44                 fConfigurationBlock = new CompilerConfigurationBlock(this, null);
45         }
46
47         /*
48          * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
49          */
50         public void init(IWorkbench workbench) {
51         }
52
53         /*
54          * @see PreferencePage#createControl(Composite)
55          */
56         public void createControl(Composite parent) {
57                 super.createControl(parent);
58                 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
59                                 IJavaHelpContextIds.COMPILER_PREFERENCE_PAGE);
60         }
61
62         /*
63          * @see PreferencePage#createContents(Composite)
64          */
65         protected Control createContents(Composite parent) {
66                 Control result = fConfigurationBlock.createContents(parent);
67                 Dialog.applyDialogFont(result);
68                 return result;
69         }
70
71         /*
72          * @see IPreferencePage#performOk()
73          */
74         public boolean performOk() {
75                 if (!fConfigurationBlock.performOk(true)) {
76                         return false;
77                 }
78                 return super.performOk();
79         }
80
81         /*
82          * @see PreferencePage#performDefaults()
83          */
84         protected void performDefaults() {
85                 fConfigurationBlock.performDefaults();
86                 super.performDefaults();
87         }
88
89         /*
90          * (non-Javadoc)
91          * 
92          * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
93          */
94         public void statusChanged(IStatus status) {
95                 setValid(!status.matches(IStatus.ERROR));
96                 StatusUtil.applyToStatusLine(this, status);
97         }
98
99 }