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