1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.core.runtime.IStatus; 14 15 import org.eclipse.swt.widgets.Composite; 16 import org.eclipse.swt.widgets.Control; 17 18 import org.eclipse.jface.dialogs.Dialog; 19 import org.eclipse.jface.preference.PreferencePage; 20 21 import org.eclipse.ui.IWorkbench; 22 import org.eclipse.ui.IWorkbenchPreferencePage; 23 import org.eclipse.ui.help.WorkbenchHelp; 24 25 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 26 import org.eclipse.jdt.internal.ui.JavaPlugin; 27 import org.eclipse.jdt.internal.ui.dialogs.StatusUtil; 28 import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener; 29 30 33 public class CompilerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IStatusChangeListener { 34 35 private CompilerConfigurationBlock fConfigurationBlock; 36 37 public CompilerPreferencePage() { 38 setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore()); 39 setDescription(PreferencesMessages.getString("CompilerPreferencePage.description")); 41 setTitle(PreferencesMessages.getString("CompilerPreferencePage.title")); 44 fConfigurationBlock= new CompilerConfigurationBlock(this, null); 45 } 46 47 50 public void init(IWorkbench workbench) { 51 } 52 53 56 public void createControl(Composite parent) { 57 super.createControl(parent); 58 WorkbenchHelp.setHelp(getControl(), IJavaHelpContextIds.COMPILER_PREFERENCE_PAGE); 59 } 60 61 64 protected Control createContents(Composite parent) { 65 Control result= fConfigurationBlock.createContents(parent); 66 Dialog.applyDialogFont(result); 67 return result; 68 } 69 70 73 public boolean performOk() { 74 if (!fConfigurationBlock.performOk(true)) { 75 return false; 76 } 77 return super.performOk(); 78 } 79 80 83 protected void performDefaults() { 84 fConfigurationBlock.performDefaults(); 85 super.performDefaults(); 86 } 87 88 91 public void statusChanged(IStatus status) { 92 setValid(!status.matches(IStatus.ERROR)); 93 StatusUtil.applyToStatusLine(this, status); 94 } 95 96 } 97 | Popular Tags |