]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2000, 2011 IBM Corporation and others. | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * IBM Corporation - initial API and implementation | |
10 | *******************************************************************************/ | |
11 | package org.eclipse.jdt.internal.ui.preferences; | |
12 | ||
13 | import org.eclipse.swt.widgets.Composite; | |
14 | import org.eclipse.swt.widgets.Control; | |
15 | ||
16 | import org.eclipse.core.resources.IProject; | |
17 | ||
18 | import org.eclipse.ui.PlatformUI; | |
19 | import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; | |
20 | ||
21 | import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; | |
22 | import org.eclipse.jdt.internal.ui.JavaPlugin; | |
23 | ||
24 | /* | |
25 | * The page to configure the task tags | |
26 | */ | |
27 | public class TodoTaskPreferencePage extends PropertyAndPreferencePage { | |
28 | ||
29 | public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.TodoTaskPreferencePage"; //$NON-NLS-1$ | |
30 | public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.TodoTaskPreferencePage"; //$NON-NLS-1$ | |
31 | ||
32 | private TodoTaskConfigurationBlock fConfigurationBlock; | |
33 | ||
34 | public TodoTaskPreferencePage() { | |
35 | setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); | |
36 | setDescription(PreferencesMessages.TodoTaskPreferencePage_description); | |
37 | ||
38 | // only used when page is shown programatically | |
39 | setTitle(PreferencesMessages.TodoTaskPreferencePage_title); | |
40 | } | |
41 | ||
42 | /* | |
43 | * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) | |
44 | */ | |
45 | @Override | |
46 | public void createControl(Composite parent) { | |
47 | IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); | |
48 | fConfigurationBlock= new TodoTaskConfigurationBlock(getNewStatusChangedListener(), getProject(), container); | |
49 | ||
50 | super.createControl(parent); | |
51 | ||
52 | if (isProjectPreferencePage()) { | |
53 | PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PROPERTY_PAGE); | |
54 | } else { | |
55 | PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE); | |
56 | } | |
57 | } | |
58 | ||
59 | /* (non-Javadoc) | |
60 | * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#createPreferenceContent(org.eclipse.swt.widgets.Composite) | |
61 | */ | |
62 | @Override | |
63 | protected Control createPreferenceContent(Composite composite) { | |
64 | return fConfigurationBlock.createContents(composite); | |
65 | } | |
66 | ||
67 | /* (non-Javadoc) | |
68 | * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#hasProjectSpecificOptions(org.eclipse.core.resources.IProject) | |
69 | */ | |
70 | @Override | |
71 | protected boolean hasProjectSpecificOptions(IProject project) { | |
72 | return fConfigurationBlock.hasProjectSpecificOptions(project); | |
73 | } | |
74 | ||
75 | ||
76 | /* (non-Javadoc) | |
77 | * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID() | |
78 | */ | |
79 | @Override | |
80 | protected String getPreferencePageID() { | |
81 | return PREF_ID; | |
82 | } | |
83 | ||
84 | /* (non-Javadoc) | |
85 | * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID() | |
86 | */ | |
87 | @Override | |
88 | protected String getPropertyPageID() { | |
89 | return PROP_ID; | |
90 | } | |
91 | ||
92 | /* (non-Javadoc) | |
93 | * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean) | |
94 | */ | |
95 | @Override | |
96 | protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) { | |
97 | super.enableProjectSpecificSettings(useProjectSpecificSettings); | |
98 | if (fConfigurationBlock != null) { | |
99 | fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings); | |
100 | } | |
101 | } | |
102 | ||
103 | /* | |
104 | * @see org.eclipse.jface.preference.IPreferencePage#performDefaults() | |
105 | */ | |
106 | @Override | |
107 | protected void performDefaults() { | |
108 | super.performDefaults(); | |
109 | if (fConfigurationBlock != null) { | |
110 | fConfigurationBlock.performDefaults(); | |
111 | } | |
112 | } | |
113 | ||
114 | /* | |
115 | * @see org.eclipse.jface.preference.IPreferencePage#performOk() | |
116 | */ | |
117 | @Override | |
118 | public boolean performOk() { | |
119 | if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { | |
120 | return false; | |
121 | } | |
122 | return super.performOk(); | |
123 | } | |
124 | ||
125 | /* | |
126 | * @see org.eclipse.jface.preference.IPreferencePage#performApply() | |
127 | */ | |
128 | @Override | |
129 | public void performApply() { | |
130 | if (fConfigurationBlock != null) { | |
131 | fConfigurationBlock.performApply(); | |
132 | } | |
133 | } | |
134 | ||
135 | /* (non-Javadoc) | |
136 | * @see org.eclipse.jface.dialogs.DialogPage#dispose() | |
137 | */ | |
138 | @Override | |
139 | public void dispose() { | |
140 | if (fConfigurationBlock != null) { | |
141 | fConfigurationBlock.dispose(); | |
142 | } | |
143 | super.dispose(); | |
144 | } | |
145 | ||
146 | } |