List of usage examples for org.eclipse.jface.preference BooleanFieldEditor BooleanFieldEditor
public BooleanFieldEditor(String name, String labelText, int style, Composite parent)
From source file:com.aptana.js.interactive_console.console.prefs.InteractiveConsolePrefs.java
License:Open Source License
@Override protected void createFieldEditors() { Composite p = getFieldEditorParent(); ColorFieldEditor sysout = new ColorFieldEditor(JSConsoleConstants.CONSOLE_OUTPUT_COLOR, "Stdout color", p); ColorFieldEditor syserr = new ColorFieldEditor(JSConsoleConstants.CONSOLE_ERROR_COLOR, "Stderr color", p); ColorFieldEditor sysin = new ColorFieldEditor(JSConsoleConstants.CONSOLE_INPUT_COLOR, "Stdin color", p); ColorFieldEditor prompt = new ColorFieldEditor(JSConsoleConstants.CONSOLE_PROMPT_COLOR, "Prompt color", p); ColorFieldEditor background = new ColorFieldEditor(JSConsoleConstants.CONSOLE_BACKGROUND_COLOR, "Background color", p); ColorFieldEditor debugBackground = new ColorFieldEditor(JSConsoleConstants.DEBUG_CONSOLE_BACKGROUND_COLOR, "Debug console background color", p); addField(sysout);/*from w w w .j av a 2s . c o m*/ addField(syserr); addField(sysin); addField(prompt); addField(background); addField(debugBackground); addField(new MultiStringFieldEditor(JSConsoleConstants.INITIAL_INTERPRETER_CMDS, "Initial\ninterpreter\ncommands:\n", p)); addField(new StringFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_VM_ARGS, "Vm Args for Rhino\n(used only on external\nprocess option):", p)); addField(new IntegerFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS, "Maximum connection attempts\nfor initial communication:", p)); addField(new BooleanFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START, "Focus console when it's started?", BooleanFieldEditor.SEPARATE_LABEL, p)); addField(new BooleanFieldEditor( JSConsoleConstants.INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR, "When creating console send\ncurrent selection/editor\ncontents for execution?", BooleanFieldEditor.SEPARATE_LABEL, p)); addField(new BooleanFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND, "Focus console when an evaluate\ncommand is sent from the editor?", BooleanFieldEditor.SEPARATE_LABEL, p)); }
From source file:com.aptana.ui.preferences.TroubleshootingPreferencePage.java
License:Open Source License
/** * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various * types of preferences. Each field editor knows how to save and restore itself. *//*from ww w. j av a2 s . com*/ public void createFieldEditors() { Composite appearanceComposite = getFieldEditorParent(); Composite group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.TroubleshootingPreferencePage_LBL_DebuggingOutputLevel); Composite debugComp = new Composite(group, SWT.NONE); debugComp.setLayout(GridLayoutFactory.fillDefaults().margins(0, 5).numColumns(2).create()); debugComp.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Label levelLabel = new Label(debugComp, SWT.NONE); levelLabel.setText(Messages.TroubleshootingPreferencePage_LBL_DebugLevel); levelLabel.setLayoutData(GridDataFactory.swtDefaults().create()); debugCombo = new Combo(debugComp, SWT.READ_ONLY); debugCombo.setItems(new String[] { Messages.TroubleshootingPreferencePage_Level_Errors, Messages.TroubleshootingPreferencePage_Level_Warnings, Messages.TroubleshootingPreferencePage_Level_All }); debugCombo.select(StatusLevel .valueOf(getPreferenceStore().getString(ICorePreferenceConstants.PREF_DEBUG_LEVEL)).ordinal()); final Label currentValue = new Label(debugComp, SWT.LEFT); currentValue.setText(getValueLabel(debugCombo.getSelectionIndex())); currentValue.setFont(SWTUtils.getDefaultSmallFont()); currentValue.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).grab(true, true).create()); debugCombo.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } public void widgetSelected(SelectionEvent e) { currentValue.setText(getValueLabel(debugCombo.getSelectionIndex())); } }); BooleanFieldEditor showHiddenProcesses = new BooleanFieldEditor( ICorePreferenceConstants.PREF_SHOW_SYSTEM_JOBS, Messages.TroubleshootingPreferencePage_ShowHiddenProcesses, SWT.DEFAULT, group); addField(showHiddenProcesses); toggleComponents = new BooleanFieldEditor(ICorePreferenceConstants.PREF_ENABLE_COMPONENT_DEBUGGING, Messages.TroubleshootingPreferencePage_DebugSpecificComponents, SWT.DEFAULT, group); addField(toggleComponents); Composite composite = new Composite(group, SWT.NONE); composite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 5).create()); composite.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).hint(400, 300).grab(true, true).create()); Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE); table.setFont(group.getFont()); categoryViewer = new CheckboxTableViewer(table); categoryViewer.getControl().setFont(group.getFont()); categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); categoryViewer.setContentProvider(ArrayContentProvider.getInstance()); categoryViewer.setLabelProvider(new ColumnLabelProvider()); categoryViewer.setComparator(new ViewerComparator()); Map<String, String> tItems = EclipseUtil.getTraceableItems(); Set<String> keys = tItems.keySet(); String[] items = keys.toArray(new String[keys.size()]); Arrays.sort(items); categoryViewer.setInput(items); categoryViewer.setCheckedElements(EclipseUtil.getCurrentDebuggableComponents()); categoryViewer.getTable().setEnabled(false); if (getPreferenceStore().getBoolean(ICorePreferenceConstants.PREF_ENABLE_COMPONENT_DEBUGGING)) { categoryViewer.getTable().setEnabled(true); } Composite buttonComp = new Composite(composite, SWT.NONE); buttonComp.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); buttonComp.setLayoutData(GridDataFactory.fillDefaults().create()); Button selectAllButton = new Button(buttonComp, SWT.BORDER); selectAllButton.setText(Messages.TroubleshootingPreferencePage_SelectAll); selectAllButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { categoryViewer.setAllChecked(true); } }); Button selectNoneButton = new Button(buttonComp, SWT.BORDER); selectNoneButton.setText(Messages.TroubleshootingPreferencePage_SelectNone); selectNoneButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { categoryViewer.setAllChecked(false); } }); }
From source file:com.arm.cmsis.pack.ui.preferences.CpConsolePreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new BooleanFieldEditor(CpUIPreferenceConstants.CONSOLE_OPEN_ON_OUT, CpStringsUI.CpConsolePreferencePage_AutoOpen, SWT.NONE, getFieldEditorParent())); addField(new ColorFieldEditor(CpUIPreferenceConstants.CONSOLE_OUT_COLOR, CpStringsUI.CpConsolePreferencePage_OutputColor, getFieldEditorParent())); addField(new ColorFieldEditor(CpUIPreferenceConstants.CONSOLE_INFO_COLOR, CpStringsUI.CpConsolePreferencePage_InfoColor, getFieldEditorParent())); addField(new ColorFieldEditor(CpUIPreferenceConstants.CONSOLE_ERROR_COLOR, CpStringsUI.CpConsolePreferencePage_ErrorColor, getFieldEditorParent())); addField(new ColorFieldEditor(CpUIPreferenceConstants.CONSOLE_BG_COLOR, CpStringsUI.CpConsolePreferencePage_BgColor, getFieldEditorParent())); }
From source file:com.chookapp.org.bracketeer.preferences.HighlightingBracketsPrefPage.java
License:Open Source License
/** * Create contents of the preference page. * @param parent//from w ww . j a v a2 s . c o m */ @Override public Control createPageContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new FillLayout(SWT.HORIZONTAL)); TabFolder tabFolder = new TabFolder(container, SWT.NONE); IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor(ProcessorsRegistry.PROC_FACTORY_ID); if (config.length == 0) { Text txtNoBracketeerEditor = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.MULTI); txtNoBracketeerEditor.setText(Messages.MainPrefPage_txtNoBracketeerEditor_text); return container; } // If we want to re-enable design mode, we should comment out this "for", and comment in this stub // IConfigurationElement element = null; // stub for (IConfigurationElement element : config) { String pluginName = element.getAttribute("name"); //$NON-NLS-1$ TabInfo tabInfo = new TabInfo(); _tabInfos.add(tabInfo); tabInfo._name = pluginName; TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE); tbtmNewItem.setText(pluginName); Composite composite = new Composite(tabFolder, SWT.NONE); tbtmNewItem.setControl(composite); composite.setLayout(new GridLayout(1, false)); Group grpHighlight = new Group(composite, SWT.NONE); grpHighlight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); grpHighlight.setText(Messages.HighlightingBracketsPrefPage_BrktHighlighting); grpHighlight.setLayout(new GridLayout(3, false)); Composite composite_13 = new Composite(grpHighlight, SWT.NONE); composite_13.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); composite_13.setLayout(new GridLayout(1, false)); List list = new List(composite_13, SWT.BORDER); list.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateHihglightFieldEditors(); } }); list.setItems(new String[] { Messages.HighlightingBracketsPrefPage_DefaultItem, Messages.HighlightingBracketsPrefPage_Pair1, Messages.HighlightingBracketsPrefPage_Pair2, Messages.HighlightingBracketsPrefPage_Pair3, Messages.HighlightingBracketsPrefPage_Pair4, Messages.HighlightingBracketsPrefPage_MissingPair }); GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1); gd_list.widthHint = 119; list.setLayoutData(gd_list); list.setSize(71, 177); list.setSelection(0); tabInfo._highlighList = list; Composite composite_1 = new Composite(grpHighlight, SWT.NONE); composite_1.setLayout(new GridLayout(1, false)); Group grpForegroundColor = new Group(composite_1, SWT.NONE); grpForegroundColor.setText(Messages.HighlightingBracketsPrefPage_FgColor); grpForegroundColor.setLayout(new GridLayout(1, false)); Composite composite_2 = new Composite(grpForegroundColor, SWT.NONE); BooleanFieldEditor bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Highlights.getAttrPath(0, true) + PreferencesConstants.Highlights.UseDefault, Messages.HighlightingBracketsPrefPage_UseDef, BooleanFieldEditor.DEFAULT, composite_2); addField(bfe); tabInfo._highlighUseDefualtFE.add(bfe); Composite composite_10 = new Composite(grpForegroundColor, SWT.NONE); GridLayout gl_composite_10 = new GridLayout(1, false); gl_composite_10.marginLeft = 10; composite_10.setLayout(gl_composite_10); Composite composite_4 = new Composite(composite_10, SWT.NONE); ColorFieldEditor cfe = new ColorFieldEditor(PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Highlights.getAttrPath(0, true) + PreferencesConstants.Highlights.Color, Messages.HighlightingBracketsPrefPage_Color, composite_4); addField(cfe); tabInfo._highlighColorFE.add(cfe); tabInfo._highlighColorFEparent.add(composite_4); Group grpBackgroundColor = new Group(composite_1, SWT.NONE); grpBackgroundColor.setText(Messages.HighlightingBracketsPrefPage_BgColor); grpBackgroundColor.setLayout(new GridLayout(1, false)); Composite composite_3 = new Composite(grpBackgroundColor, SWT.NONE); bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Highlights.getAttrPath(0, false) + PreferencesConstants.Highlights.UseDefault, Messages.HighlightingBracketsPrefPage_UseDef, BooleanFieldEditor.DEFAULT, composite_3); addField(bfe); tabInfo._highlighUseDefualtFE.add(bfe); Composite composite_14 = new Composite(grpBackgroundColor, SWT.NONE); GridLayout gl_composite_14 = new GridLayout(1, false); gl_composite_14.marginLeft = 10; composite_14.setLayout(gl_composite_14); Composite composite_5 = new Composite(composite_14, SWT.NONE); cfe = new ColorFieldEditor(PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Highlights.getAttrPath(0, false) + PreferencesConstants.Highlights.Color, Messages.HighlightingBracketsPrefPage_Color, composite_5); addField(cfe); tabInfo._highlighColorFE.add(cfe); tabInfo._highlighColorFEparent.add(composite_5); Composite composite_15 = new Composite(composite_14, SWT.NONE); composite_15.setSize(230, 25); ComboFieldEditor cofe = new ComboFieldEditor( PreferencesConstants.preferencePath(tabInfo._name) + PreferencesConstants.Highlights.getAttrPath(0, false) + PreferencesConstants.Highlights.HighlightTypeAttr, Messages.HighlightingBracketsPrefPage_BgStyle, new String[][] { { PreferencesConstants.Highlights.HighlightTypeValNone, Messages.HighlightingBracketsPrefPage_None }, { PreferencesConstants.Highlights.HighlightTypeValSolid, Messages.HighlightingBracketsPrefPage_Solid }, { PreferencesConstants.Highlights.HighlightTypeValOutline, Messages.HighlightingBracketsPrefPage_Outline } }, composite_15); addField(cofe); tabInfo._highlighStyleFE = cofe; tabInfo._highlighStyleFEparent = composite_15; Group grpAnnotation = new Group(grpHighlight, SWT.NONE); grpAnnotation.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); grpAnnotation.setText(Messages.HighlightingBracketsPrefPage_grpAnnotation_text); grpAnnotation.setLayout(new GridLayout(1, false)); Composite composite_19 = new Composite(grpAnnotation, SWT.NONE); composite_19.setLayout(new GridLayout(1, false)); tabInfo._annotationComposite = composite_19; Composite composite_20 = new Composite(composite_19, SWT.NONE); bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(tabInfo._name) + PreferencesConstants.Annotations.Enable, Messages.HighlightingBracketsPrefPage_enableAnnotation, BooleanFieldEditor.DEFAULT, composite_20); addField(bfe); Link link = new Link(composite_19, SWT.NONE); GridData gd_link = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_link.horizontalIndent = 10; link.setLayoutData(gd_link); link.setBounds(0, 0, 54, 17); link.setText(Messages.HighlightingBracketsPrefPage_annotationLink); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.ui.editors.preferencePages.Annotations", null, null); //$NON-NLS-1$ } }); Group grpSurroundingBrackets = new Group(composite, SWT.NONE); grpSurroundingBrackets.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); grpSurroundingBrackets.setText(Messages.HighlightingBracketsPrefPage_SurroundingBrkt); grpSurroundingBrackets.setLayout(new GridLayout(1, false)); Composite composite_6 = new Composite(grpSurroundingBrackets, SWT.NONE); bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Surrounding.Enable, Messages.HighlightingBracketsPrefPage_Enable, BooleanFieldEditor.DEFAULT, composite_6); addField(bfe); tabInfo._surroundingEnableFE = bfe; Composite composite_7 = new Composite(grpSurroundingBrackets, SWT.NONE); GridLayout gl_composite_7 = new GridLayout(2, false); gl_composite_7.marginLeft = 10; composite_7.setLayout(gl_composite_7); tabInfo._surroundingComposite = composite_7; Composite composite_8 = new Composite(composite_7, SWT.NONE); GridLayout gl_composite_8 = new GridLayout(1, false); gl_composite_8.marginWidth = 10; composite_8.setLayout(gl_composite_8); Group grpPairsToShow = new Group(composite_8, SWT.NONE); grpPairsToShow.setText(Messages.HighlightingBracketsPrefPage_PairsToShow); grpPairsToShow.setLayout(new GridLayout(2, false)); Composite composite_16 = new Composite(composite_7, SWT.NONE); composite_16.setLayout(new GridLayout(1, false)); // If we want to re-enable design mode, we should comment out this field addition addField(new StringPartCheckBoxes( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Surrounding.ShowBrackets, grpPairsToShow, element.getAttribute(ProcessorsRegistry.SUPPORTED_BRACKETS_ATTR))); Composite composite_12 = new Composite(composite_16, SWT.NONE); composite_12.setLayout(new GridLayout(3, false)); Composite composite_11 = new Composite(composite_12, SWT.NONE); SpinnerFieldEditor spinner = new SpinnerFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Surrounding.NumBracketsToShow, Messages.HighlightingBracketsPrefPage_ShowUpTo, composite_11); addField(spinner); spinner.getSpinner().setMinimum(1); spinner.getSpinner().setMaximum(PreferencesConstants.MAX_PAIRS); Label lblNewLabel = new Label(composite_12, SWT.NONE); lblNewLabel.setAlignment(SWT.RIGHT); lblNewLabel.setText(Messages.HighlightingBracketsPrefPage_Pairs); Composite composite_17 = new Composite(composite_16, SWT.NONE); composite_17.setLayout(new GridLayout(3, false)); Composite composite_18 = new Composite(composite_17, SWT.NONE); spinner = new SpinnerFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Surrounding.MinDistanceBetweenBrackets, Messages.HighlightingBracketsPrefPage_ShowPairsWhichAreAtLeast, composite_18); addField(spinner); lblNewLabel = new Label(composite_17, SWT.NONE); lblNewLabel.setAlignment(SWT.RIGHT); lblNewLabel.setText(Messages.HighlightingBracketsPrefPage_charsApart); Group grpHovering = new Group(composite, SWT.NONE); grpHovering.setLayout(new GridLayout(1, false)); grpHovering.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); grpHovering.setText(Messages.HighlightingBracketsPrefPage_Hover); Composite composite_9 = new Composite(grpHovering, SWT.NONE); addField(new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hovering.Enable, Messages.HighlightingBracketsPrefPage_ShowHoveredPairs, BooleanFieldEditor.DEFAULT, composite_9)); Composite composite_21 = new Composite(grpHovering, SWT.NONE); bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hovering.PopupEnable, Messages.HighlightingBracketsPrefPage_ShowPopup, BooleanFieldEditor.DEFAULT, composite_21); addField(bfe); tabInfo._popupEn = bfe; Composite composite_22 = new Composite(grpHovering, SWT.NONE); GridData gd_composite_22 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_composite_22.horizontalIndent = 20; composite_22.setLayoutData(gd_composite_22); bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hovering.PopupOnlyWithoutHint, Messages.HighlightingBracketsPrefPage_PopupOnlyWithoutHint, BooleanFieldEditor.DEFAULT, composite_22); addField(bfe); tabInfo._popupWithoutHint = composite_22; } PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "com.choockapp.org.bracketeer.highlight_pref"); //$NON-NLS-1$ return container; }
From source file:com.chookapp.org.bracketeer.preferences.HintsPrefPage.java
License:Open Source License
/** * Create contents of the preference page. * @param parent/*from ww w.j a v a2 s. c om*/ */ @Override public Control createPageContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, false)); TabFolder tabFolder = new TabFolder(container, SWT.NONE); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor(ProcessorsRegistry.PROC_FACTORY_ID); if (config.length == 0) { Text txtNoBracketeerEditor = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.MULTI); txtNoBracketeerEditor.setText(Messages.MainPrefPage_txtNoBracketeerEditor_text); return container; } // If we want to re-enable design mode, we should comment out this "for", and comment in this stub // IConfigurationElement element = null; // stub for (IConfigurationElement element : config) { String pluginName = element.getAttribute("name"); //$NON-NLS-1$ TabInfo tabInfo = new TabInfo(); _tabInfos.add(tabInfo); tabInfo._name = pluginName; tabInfo._dynamicFe = new ArrayList<FEInfo>(); String basePref = PreferencesConstants.Hints.preferencePath(pluginName, PreferencesConstants.Hints.DEFAULT_TYPE); TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE); tbtmNewItem.setText(pluginName); Composite composite = new Composite(tabFolder, SWT.NONE); tbtmNewItem.setControl(composite); composite.setLayout(new GridLayout(1, false)); IConfigurationElement[] hints = element.getChildren("Hint"); //$NON-NLS-1$ if (hints.length == 0) { Label lable = new Label(composite, NONE); lable.setText(Messages.HintsPrefPage_NotSupported); tabInfo._hintsList = null; // If we want to re-enable design mode, we should comment out this line continue; } Composite composite_2 = new Composite(composite, SWT.NONE); addField(new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hints.Globals.SHOW_IN_EDITOR, Messages.HintsPrefPage_DisplayHintsInEditor, BooleanFieldEditor.DEFAULT, composite_2)); Composite composite_3 = new Composite(composite, SWT.NONE); BooleanFieldEditor bfe = new BooleanFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hints.Hover.ENABLE, Messages.HintsPrefPage_HintOnHover, BooleanFieldEditor.DEFAULT, composite_3); addField(bfe); tabInfo._hoverEn = bfe; Composite composite_24 = new Composite(composite, SWT.NONE); GridLayout gl_composite_24 = new GridLayout(1, false); gl_composite_24.verticalSpacing = 0; gl_composite_24.marginHeight = 0; gl_composite_24.marginLeft = 10; composite_24.setLayout(gl_composite_24); Composite composite_23 = new Composite(composite_24, SWT.NONE); SpinnerFieldEditor spinner = new SpinnerFieldEditor( PreferencesConstants.preferencePath(pluginName) + PreferencesConstants.Hints.Hover.MAX_LEN, Messages.HintsPrefPage_OverrideMaxLength, composite_23); spinner.setLabelText(Messages.HintsPrefPage_HintHoverMaxLen); addField(spinner); tabInfo._hoverMaxLen = composite_23; Group grpHintsConfiguration = new Group(composite, SWT.NONE); grpHintsConfiguration.setText(Messages.HintsPrefPage_grpHintsConfiguration_text); grpHintsConfiguration.setLayout(new GridLayout(1, false)); // Composite composite_3 = new Composite(composite, SWT.NONE); // addField(new BooleanFieldEditor(PreferencesConstants.Hints.Globals.SHOW_ON_HOVER, // "Display tooltip on hover", BooleanFieldEditor.DEFAULT, composite_3)); Composite composite_1 = new Composite(grpHintsConfiguration, SWT.NONE); composite_1.setLayout(new GridLayout(2, false)); Composite composite_4 = new Composite(composite_1, SWT.NONE); composite_4.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); composite_4.setBounds(0, 0, 64, 64); composite_4.setLayout(new GridLayout(1, false)); List list = new List(composite_4, SWT.BORDER); GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1); gd_list.widthHint = 148; list.setLayoutData(gd_list); tabInfo._hintsList = list; list.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateHintFieldEditors(); } }); list.add(Messages.HintsPrefPage_DefaultEntry); for (IConfigurationElement hint : hints) { String hintType = hint.getAttribute("type"); //$NON-NLS-1$ list.add(hintType); } list.setSelection(0); Composite composite_5 = new Composite(composite_1, SWT.NONE); composite_5.setLayout(new GridLayout(1, false)); composite_5.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false, 1, 1)); composite_5.setBounds(0, 0, 64, 64); Group grpWhenToShow = new Group(composite_5, SWT.NONE); grpWhenToShow.setText(Messages.HintsPrefPage_WhenToShow); grpWhenToShow.setLayout(new GridLayout(1, false)); Composite composite_6 = new Composite(grpWhenToShow, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.WhenToShow.USE_DEFAULT, Messages.HintsPrefPage_UseDef, BooleanFieldEditor.DEFAULT, composite_6); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.WhenToShow.USE_DEFAULT); tabInfo._whenToShowUseDef = bfe; tabInfo._whenToShowUseDefParent = composite_6; Composite composite_15 = new Composite(grpWhenToShow, SWT.NONE); GridLayout gl_composite_15 = new GridLayout(1, false); gl_composite_15.marginLeft = 10; composite_15.setLayout(gl_composite_15); Composite composite_7 = new Composite(composite_15, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.WhenToShow.SHOW_IN_EDITOR, Messages.HintsPrefPage_DisplayHintsInEditor, BooleanFieldEditor.DEFAULT, composite_7); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.WhenToShow.SHOW_IN_EDITOR); tabInfo._showInEditor = bfe; tabInfo._showInEditorParent = composite_7; Composite composite_14 = new Composite(composite_15, SWT.NONE); spinner = new SpinnerFieldEditor(basePref + PreferencesConstants.Hints.WhenToShow.MIN_LINES_DISTANCE, Messages.HintsPrefPage_MinLines, composite_14); addField(spinner); addDynamicFE(tabInfo, spinner, PreferencesConstants.Hints.WhenToShow.MIN_LINES_DISTANCE); tabInfo._whenToShowMinLines = composite_14; Composite composite_20 = new Composite(composite_5, SWT.NONE); composite_20.setLayout(new GridLayout(2, false)); Group grpFont = new Group(composite_20, SWT.NONE); grpFont.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); grpFont.setText(Messages.HintsPrefPage_Font); grpFont.setBounds(0, 0, 209, 147); grpFont.setLayout(new GridLayout(1, false)); Composite composite_8 = new Composite(grpFont, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Font.USE_DEFAULT, Messages.HintsPrefPage_UseDef, BooleanFieldEditor.DEFAULT, composite_8); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Font.USE_DEFAULT); tabInfo._fontUseDef = bfe; tabInfo._fontUseDefParent = composite_8; Composite composite_9 = new Composite(grpFont, SWT.NONE); composite_9.setBounds(0, 0, 64, 64); GridLayout gl_composite_9 = new GridLayout(1, false); gl_composite_9.marginLeft = 10; composite_9.setLayout(gl_composite_9); tabInfo._fontGrp = composite_9; Group grpForegroundColor = new Group(composite_9, SWT.NONE); grpForegroundColor.setText(Messages.HintsPrefPage_FgColor); grpForegroundColor.setLayout(new GridLayout(1, false)); Composite composite_21 = new Composite(grpForegroundColor, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Font.FG_DEFAULT, Messages.HintsPrefPage_UseSysDef, BooleanFieldEditor.DEFAULT, composite_21); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Font.FG_DEFAULT); tabInfo._fontFgDef = bfe; Composite composite_10 = new Composite(grpForegroundColor, SWT.NONE); ColorFieldEditor cfe = new ColorFieldEditor(basePref + PreferencesConstants.Hints.Font.FG_COLOR, Messages.HintsPrefPage_Color, composite_10); addField(cfe); addDynamicFE(tabInfo, cfe, PreferencesConstants.Hints.Font.FG_COLOR); tabInfo._fontFgColor = composite_10; Group grpBackgroundColor = new Group(composite_9, SWT.NONE); grpBackgroundColor.setText(Messages.HintsPrefPage_BgColor); grpBackgroundColor.setLayout(new GridLayout(1, false)); Composite composite_22 = new Composite(grpBackgroundColor, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Font.BG_DEFAULT, Messages.HintsPrefPage_UseSysDef, BooleanFieldEditor.DEFAULT, composite_22); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Font.BG_DEFAULT); tabInfo._fontBgDef = bfe; Composite composite_11 = new Composite(grpBackgroundColor, SWT.NONE); cfe = new ColorFieldEditor(basePref + PreferencesConstants.Hints.Font.BG_COLOR, Messages.HintsPrefPage_Color, composite_11); addField(cfe); addDynamicFE(tabInfo, cfe, PreferencesConstants.Hints.Font.BG_COLOR); tabInfo._fontBgColor = composite_11; Composite composite_12 = new Composite(composite_9, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Font.ITALIC, Messages.HintsPrefPage_Italic, BooleanFieldEditor.DEFAULT, composite_12); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Font.ITALIC); Group grpShow = new Group(composite_20, SWT.NONE); grpShow.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); grpShow.setSize(160, 183); grpShow.setText(Messages.HintsPrefPage_Display); grpShow.setLayout(new GridLayout(1, false)); Composite composite_13 = new Composite(grpShow, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Display.USE_DEFAULT, Messages.HintsPrefPage_UseDef, BooleanFieldEditor.DEFAULT, composite_13); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Display.USE_DEFAULT); tabInfo._displayUseDef = bfe; tabInfo._displayUseDefParnet = composite_13; Composite composite_18 = new Composite(grpShow, SWT.NONE); GridLayout gl_composite_18 = new GridLayout(1, false); gl_composite_18.marginLeft = 10; composite_18.setLayout(gl_composite_18); tabInfo._displayGrp = composite_18; Composite composite_19 = new Composite(composite_18, SWT.NONE); spinner = new SpinnerFieldEditor(basePref + PreferencesConstants.Hints.Display.MAX_LENGTH, Messages.HintsPrefPage_MaxLen, composite_19); addField(spinner); addDynamicFE(tabInfo, spinner, PreferencesConstants.Hints.Display.MAX_LENGTH); Composite composite_17 = new Composite(composite_18, SWT.NONE); bfe = new BooleanFieldEditor(basePref + PreferencesConstants.Hints.Display.STRIP_WHITESPACE, Messages.HintsPrefPage_StipWhitespace, BooleanFieldEditor.DEFAULT, composite_17); addField(bfe); addDynamicFE(tabInfo, bfe, PreferencesConstants.Hints.Display.STRIP_WHITESPACE); Composite composite_16 = new Composite(composite_18, SWT.NONE); { RadioGroupFieldEditor radioGroupFieldEditor = new RadioGroupFieldEditor( basePref + PreferencesConstants.Hints.Display.Ellipsis.ATTR, Messages.HintsPrefPage_Ellipsis, 1, new String[][] { { Messages.HintsPrefPage_Mid, PreferencesConstants.Hints.Display.Ellipsis.VAL_MID }, { Messages.HintsPrefPage_End, PreferencesConstants.Hints.Display.Ellipsis.VAL_END } }, composite_16, false); radioGroupFieldEditor.setIndent(0); addField(radioGroupFieldEditor); addDynamicFE(tabInfo, radioGroupFieldEditor, PreferencesConstants.Hints.Display.Ellipsis.ATTR); } } PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "com.choockapp.org.bracketeer.hints_pref"); //$NON-NLS-1$ return container; }
From source file:com.ge.research.sadl.ui.preferences.ReasonerConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override/* ww w. j a v a 2 s.c o m*/ public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; if (config != null) { for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug(key + " class = " + optionValue.getClass().getName()); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } else { logger.info("No configuration options available"); } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(reasonerCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.ge.research.sadl.ui.preferences.TranslatorConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override// www . j a va 2 s .co m public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; if (config == null) { messageArea.updateText("No options available", IMessageProvider.NONE); return; } for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug( key + " class = " + (optionValue != null ? optionValue.getClass().getName() : "null")); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue == null) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(translatorCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.ge.research.sadl.ui.properties.ReasonerConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override//from ww w. j ava 2 s . c om public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug(key + " class = " + optionValue.getClass().getName()); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(reasonerCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.ge.research.sadl.ui.properties.TranslatorConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override/*from ww w.ja v a 2s . co m*/ public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; if (config == null) { messageArea.updateText("No options available", IMessageProvider.NONE); return; } for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug(key + " class = " + optionValue.getClass().getName()); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(translatorCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.google.devtools.depan.maven.eclipse.preferences.AnalysisPreferencesPage.java
License:Apache License
@Override protected void createFieldEditors() { Composite parent = getFieldEditorParent(); FileFieldEditor executable = new FileFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EXECUTABLE, "Maven Executable", true, parent); executable.setEmptyStringAllowed(false); BooleanFieldEditor systemjava = new BooleanFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA, "Use System JAVA_HOME", BooleanFieldEditor.SEPARATE_LABEL, parent); final DirectoryFieldEditor javahome = new DirectoryFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME, "JAVA_HOME", parent); StringFieldEditor effectivepom = new StringFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EFFECTIVEPOM, "Maven Effective POM command", parent); effectivepom.setEmptyStringAllowed(false); addField(executable);/*w w w .j a v a2s.co m*/ addField(systemjava); addField(javahome); addField(effectivepom); }