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 JavaBuildPreferencePage extends PropertyAndPreferencePage { 30 31 public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.JavaBuildPreferencePage"; public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.JavaBuildPreferencePage"; 34 private JavaBuildConfigurationBlock fConfigurationBlock; 35 36 public JavaBuildPreferencePage() { 37 setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); 38 40 setTitle(PreferencesMessages.JavaBuildPreferencePage_title); 42 } 43 44 47 public void createControl(Composite parent) { 48 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); 49 fConfigurationBlock= new JavaBuildConfigurationBlock(getNewStatusChangedListener(), getProject(), container); 50 51 super.createControl(parent); 52 if (isProjectPreferencePage()) { 53 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_BUILD_PROPERTY_PAGE); 54 } else { 55 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_BUILD_PREFERENCE_PAGE); 56 } 57 } 58 59 protected Control createPreferenceContent(Composite composite) { 60 return fConfigurationBlock.createContents(composite); 61 } 62 63 protected boolean hasProjectSpecificOptions(IProject project) { 64 return fConfigurationBlock.hasProjectSpecificOptions(project); 65 } 66 67 70 protected String getPreferencePageID() { 71 return PREF_ID; 72 } 73 74 77 protected String getPropertyPageID() { 78 return PROP_ID; 79 } 80 81 84 public void dispose() { 85 if (fConfigurationBlock != null) { 86 fConfigurationBlock.dispose(); 87 } 88 super.dispose(); 89 } 90 91 94 protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) { 95 super.enableProjectSpecificSettings(useProjectSpecificSettings); 96 if (fConfigurationBlock != null) { 97 fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings); 98 } 99 } 100 101 104 protected void performDefaults() { 105 super.performDefaults(); 106 if (fConfigurationBlock != null) { 107 fConfigurationBlock.performDefaults(); 108 } 109 } 110 111 114 public boolean performOk() { 115 if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { 116 return false; 117 } 118 return super.performOk(); 119 } 120 121 124 public void performApply() { 125 if (fConfigurationBlock != null) { 126 fConfigurationBlock.performApply(); 127 } 128 } 129 130 133 public void setElement(IAdaptable element) { 134 super.setElement(element); 135 setDescription(null); } 137 138 } 139 | Popular Tags |