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