Refactory
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / preferences / TodoTaskPreferencePage.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 TodoTaskPreferencePage extends PreferencePage implements
32                 IWorkbenchPreferencePage, IStatusChangeListener {
33
34         public static final String ID = "net.sourceforge.phpdt.ui.preferences.TodoTaskPreferencePage"; //$NON-NLS-1$
35
36         private TodoTaskConfigurationBlock fConfigurationBlock;
37
38         public TodoTaskPreferencePage() {
39                 setPreferenceStore(WebUI.getDefault().getPreferenceStore());
40                 // setDescription(PreferencesMessages.getString("TodoTaskPreferencePage.description"));
41                 // //$NON-NLS-1$
42
43                 // only used when page is shown programatically
44                 setTitle(PreferencesMessages.getString("TodoTaskPreferencePage.title")); //$NON-NLS-1$
45
46                 fConfigurationBlock = new TodoTaskConfigurationBlock(this, null);
47         }
48
49         /*
50          * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
51          */
52         public void init(IWorkbench workbench) {
53         }
54
55         /*
56          * @see PreferencePage#createControl(Composite)
57          */
58         public void createControl(Composite parent) {
59                 // added for 1GEUGE6: ITPJUI:WIN2000 - Help is the same on all
60                 // preference pages
61                 super.createControl(parent);
62                 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
63                                 IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE);
64         }
65
66         /*
67          * @see PreferencePage#createContents(Composite)
68          */
69         protected Control createContents(Composite parent) {
70                 Control result = fConfigurationBlock.createContents(parent);
71                 Dialog.applyDialogFont(result);
72                 return result;
73         }
74
75         /*
76          * @see IPreferencePage#performOk()
77          */
78         public boolean performOk() {
79                 if (!fConfigurationBlock.performOk(true)) {
80                         return false;
81                 }
82                 return super.performOk();
83         }
84
85         /*
86          * @see PreferencePage#performDefaults()
87          */
88         protected void performDefaults() {
89                 fConfigurationBlock.performDefaults();
90                 super.performDefaults();
91         }
92
93         /*
94          * (non-Javadoc)
95          * 
96          * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
97          */
98         public void statusChanged(IStatus status) {
99                 setValid(!status.matches(IStatus.ERROR));
100                 StatusUtil.applyToStatusLine(this, status);
101         }
102
103 }