1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.core.resources.IProject; 14 15 import org.eclipse.swt.widgets.Composite; 16 import org.eclipse.swt.widgets.Control; 17 18 import org.eclipse.ui.IWorkbenchPreferencePage; 19 import org.eclipse.ui.PlatformUI; 20 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; 21 22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 23 import org.eclipse.jdt.internal.ui.JavaPlugin; 24 25 28 public class CodeStylePreferencePage extends PropertyAndPreferencePage implements IWorkbenchPreferencePage { 29 30 public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.CodeStylePreferencePage"; public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.CodeStylePreferencePage"; 33 private NameConventionConfigurationBlock fConfigurationBlock; 34 35 public CodeStylePreferencePage() { 36 setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); 37 39 setTitle(PreferencesMessages.CodeStylePreferencePage_title); 41 } 42 43 46 public void createControl(Composite parent) { 47 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); 48 fConfigurationBlock= new NameConventionConfigurationBlock(getNewStatusChangedListener(), getProject(), container); 49 50 super.createControl(parent); 51 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.CODE_MANIPULATION_PREFERENCE_PAGE); 52 } 53 54 protected Control createPreferenceContent(Composite composite) { 55 return fConfigurationBlock.createContents(composite); 56 } 57 58 protected boolean hasProjectSpecificOptions(IProject project) { 59 return fConfigurationBlock.hasProjectSpecificOptions(project); 60 } 61 62 65 protected String getPreferencePageID() { 66 return PREF_ID; 67 } 68 69 72 protected String getPropertyPageID() { 73 return PROP_ID; 74 } 75 76 79 protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) { 80 super.enableProjectSpecificSettings(useProjectSpecificSettings); 81 if (fConfigurationBlock != null) { 82 fConfigurationBlock.useProjectSpecificSettings(useProjectSpecificSettings); 83 } 84 } 85 86 89 public void dispose() { 90 if (fConfigurationBlock != null) { 91 fConfigurationBlock.dispose(); 92 } 93 super.dispose(); 94 } 95 96 99 protected void performDefaults() { 100 super.performDefaults(); 101 if (fConfigurationBlock != null) { 102 fConfigurationBlock.performDefaults(); 103 } 104 } 105 106 109 public boolean performOk() { 110 if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { 111 return false; 112 } 113 return super.performOk(); 114 } 115 116 119 public void performApply() { 120 if (fConfigurationBlock != null) { 121 fConfigurationBlock.performApply(); 122 } 123 } 124 125 126 } 127 128 129 130 | Popular Tags |