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 ImportOrganizePreferencePage extends PropertyAndPreferencePage { 30 31 public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.ImportOrganizePreferencePage"; public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.ImportOrganizePreferencePage"; 34 35 private ImportOrganizeConfigurationBlock fConfigurationBlock; 36 37 public ImportOrganizePreferencePage() { 38 setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); 39 41 setTitle(PreferencesMessages.ImportOrganizePreferencePage_title); 43 } 44 45 48 public void createControl(Composite parent) { 49 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); 50 fConfigurationBlock= new ImportOrganizeConfigurationBlock(getNewStatusChangedListener(), getProject(), container); 51 52 super.createControl(parent); 53 PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.ORGANIZE_IMPORTS_PREFERENCE_PAGE); 54 } 55 56 protected Control createPreferenceContent(Composite composite) { 57 return fConfigurationBlock.createContents(composite); 58 } 59 60 protected boolean hasProjectSpecificOptions(IProject project) { 61 return fConfigurationBlock.hasProjectSpecificOptions(project); 62 } 63 64 67 protected String getPreferencePageID() { 68 return PREF_ID; 69 } 70 71 74 protected String getPropertyPageID() { 75 return PROP_ID; 76 } 77 78 81 public void dispose() { 82 if (fConfigurationBlock != null) { 83 fConfigurationBlock.dispose(); 84 } 85 super.dispose(); 86 } 87 88 91 protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) { 92 super.enableProjectSpecificSettings(useProjectSpecificSettings); 93 if (fConfigurationBlock != null) { 94 fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings); 95 } 96 } 97 98 101 protected void performDefaults() { 102 super.performDefaults(); 103 if (fConfigurationBlock != null) { 104 fConfigurationBlock.performDefaults(); 105 } 106 } 107 108 111 public boolean performOk() { 112 if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { 113 return false; 114 } 115 return super.performOk(); 116 } 117 118 121 public void performApply() { 122 if (fConfigurationBlock != null) { 123 fConfigurationBlock.performApply(); 124 } 125 } 126 127 130 public void setElement(IAdaptable element) { 131 super.setElement(element); 132 setDescription(null); } 134 135 136 } 137 138 139 140 | Popular Tags |