1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.core.runtime.IAdaptable; 14 15 import org.eclipse.core.resources.IProject; 16 17 import org.eclipse.swt.widgets.Composite; 18 import org.eclipse.swt.widgets.Control; 19 20 import org.eclipse.ui.PlatformUI; 21 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; 22 23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 24 import org.eclipse.jdt.internal.ui.JavaPlugin; 25 26 29 public class TodoTaskPreferencePage extends PropertyAndPreferencePage { 30 31 public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.TodoTaskPreferencePage"; public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.TodoTaskPreferencePage"; 34 private TodoTaskConfigurationBlock fConfigurationBlock; 35 36 public TodoTaskPreferencePage() { 37 setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); 38 setDescription(PreferencesMessages.TodoTaskPreferencePage_description); 39 40 setTitle(PreferencesMessages.TodoTaskPreferencePage_title); 42 } 43 44 47 public void createControl(Composite parent) { 48 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); 49 fConfigurationBlock= new TodoTaskConfigurationBlock(getNewStatusChangedListener(), getProject(), container); 50 51 super.createControl(parent); 52 53 if (isProjectPreferencePage()) { 54 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PROPERTY_PAGE); 55 } else { 56 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.TODOTASK_PREFERENCE_PAGE); 57 } 58 } 59 60 63 protected Control createPreferenceContent(Composite composite) { 64 return fConfigurationBlock.createContents(composite); 65 } 66 67 70 protected boolean hasProjectSpecificOptions(IProject project) { 71 return fConfigurationBlock.hasProjectSpecificOptions(project); 72 } 73 74 75 78 protected String getPreferencePageID() { 79 return PREF_ID; 80 } 81 82 85 protected String getPropertyPageID() { 86 return PROP_ID; 87 } 88 89 92 protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) { 93 super.enableProjectSpecificSettings(useProjectSpecificSettings); 94 if (fConfigurationBlock != null) { 95 fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings); 96 } 97 } 98 99 102 protected void performDefaults() { 103 super.performDefaults(); 104 if (fConfigurationBlock != null) { 105 fConfigurationBlock.performDefaults(); 106 } 107 } 108 109 112 public boolean performOk() { 113 if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { 114 return false; 115 } 116 return super.performOk(); 117 } 118 119 122 public void performApply() { 123 if (fConfigurationBlock != null) { 124 fConfigurationBlock.performApply(); 125 } 126 } 127 128 131 public void dispose() { 132 if (fConfigurationBlock != null) { 133 fConfigurationBlock.dispose(); 134 } 135 super.dispose(); 136 } 137 138 141 public void setElement(IAdaptable element) { 142 super.setElement(element); 143 setDescription(null); } 145 146 147 } 148 | Popular Tags |