1 11 package org.eclipse.pde.internal.ui.preferences; 12 13 import org.eclipse.ui.IWorkbench; 14 import org.eclipse.pde.internal.ui.IPreferenceConstants; 15 import org.eclipse.pde.internal.ui.PDEPlugin; 16 import org.eclipse.swt.SWT; 17 import org.eclipse.swt.layout.GridData; 18 import org.eclipse.swt.layout.GridLayout; 19 import org.eclipse.swt.widgets.Button; 20 import org.eclipse.swt.widgets.Control; 21 import org.eclipse.swt.widgets.Composite; 22 import org.eclipse.jface.dialogs.Dialog; 23 import org.eclipse.jface.preference.IPreferenceStore; 24 import org.eclipse.jface.preference.PreferencePage; 25 import org.eclipse.ui.IWorkbenchPreferencePage; 26 27 30 public class BuildOptionsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPreferenceConstants { 31 private IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore(); 32 private Button fFailOnError; 33 private Button fVerbose; 34 private Button fDebugInfo; 35 36 39 public BuildOptionsPreferencePage() { 40 setDescription(PDEPlugin.getResourceString("BuildPropertiesPreferencePage.desc")); } 42 43 46 public void init(IWorkbench workbench) { 47 } 48 49 52 protected Control createContents(Composite parent) { 53 Composite composite = new Composite(parent, SWT.NONE); 54 GridLayout layout = new GridLayout(); 55 layout.numColumns = 2; 56 layout.marginWidth = 15; 57 composite.setLayout(layout); 58 59 fFailOnError = new Button(composite, SWT.CHECK); 60 fFailOnError.setText(PDEPlugin.getResourceString("BuildPropertiesPreferencePage.failOnError")); fFailOnError.setSelection(store.getBoolean(PROP_JAVAC_FAIL_ON_ERROR)); 62 GridData gd = new GridData(); 63 gd.horizontalSpan = 2; 64 fFailOnError.setLayoutData(gd); 65 66 fVerbose = new Button(composite, SWT.CHECK); 67 fVerbose.setText(PDEPlugin.getResourceString("BuildPropertiesPreferencePage.compilerVerbose")); fVerbose.setSelection(store.getBoolean(PROP_JAVAC_VERBOSE)); 69 gd = new GridData(); 70 gd.horizontalSpan = 2; 71 fVerbose.setLayoutData(gd); 72 73 fDebugInfo = new Button(composite, SWT.CHECK); 74 fDebugInfo.setText(PDEPlugin.getResourceString("BuildPropertiesPreferencePage.compilerDebug")); fDebugInfo.setSelection(store.getBoolean(PROP_JAVAC_DEBUG_INFO)); 76 gd = new GridData(); 77 gd.horizontalSpan = 2; 78 fDebugInfo.setLayoutData(gd); 79 80 81 Dialog.applyDialogFont(composite); 82 83 return composite; 84 } 85 86 89 public boolean performOk() { 90 store.setValue(PROP_JAVAC_FAIL_ON_ERROR, fFailOnError.getSelection()); 91 store.setValue(PROP_JAVAC_VERBOSE, fVerbose.getSelection()); 92 store.setValue(PROP_JAVAC_DEBUG_INFO, fDebugInfo.getSelection()); 93 PDEPlugin.getDefault().savePluginPreferences(); 94 return super.performOk(); 95 } 96 97 100 protected void performDefaults() { 101 fFailOnError.setSelection(store.getDefaultBoolean(PROP_JAVAC_FAIL_ON_ERROR)); 102 fVerbose.setSelection(store.getDefaultBoolean(PROP_JAVAC_VERBOSE)); 103 fDebugInfo.setSelection(store.getDefaultBoolean(PROP_JAVAC_DEBUG_INFO)); 104 } 105 } 106 | Popular Tags |