List of usage examples for org.eclipse.jface.preference ComboFieldEditor setEnabled
@Override
public void setEnabled(boolean enabled, Composite parent)
From source file:com.aptana.editor.common.preferences.ContentAssistPreferencePage.java
License:Open Source License
/** * createFilterSelector/*from www . j a va 2s . com*/ * * @param parent */ protected void createFilterSelector(Composite parent) { // @formatter:off ComboFieldEditor fieldEditor = new ComboFieldEditor( com.aptana.editor.common.contentassist.IPreferenceConstants.CONTENT_ASSIST_USER_AGENT_FILTER_TYPE, Messages.ContentAssistPreferencePage_ProposalFilterTypeLabel, new String[][] { { Messages.ContentAssistPreferencePage_NoFilterLabel, UserAgentFilterType.NO_FILTER.getText() }, { Messages.ContentAssistPreferencePage_OneOrMoreFilterLabel, UserAgentFilterType.ONE_OR_MORE.getText() }, { Messages.ContentAssistPreferencePage_AllFilterLabel, UserAgentFilterType.ALL.getText() } }, parent); addField(fieldEditor); // @formatter:on // We only want to enable this field editor for workspace-specific settings. // Since the UI will not draw anything unless we have at least one field-editor in this page, we have to add it // and disable it for project-specific. fieldEditor.setEnabled(!isProjectPreferencePage(), parent); }
From source file:gov.redhawk.internal.ui.preferences.FftBlockPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { if (workbench != null) { addField(createFftModesField()); }/*from w w w .j a v a 2s . c o m*/ IntegerFieldEditor numAvgs = new IntegerFieldEditor(FftPreferences.NUM_AVERAGES.getName(), "&Num Averages:", getFieldEditorParent()); numAvgs.setValidRange(1, Integer.MAX_VALUE); numAvgs.setErrorMessage("Number of averages must be integer >= 1"); addField(numAvgs); ComboFieldEditor outputType = createOutputTypeField(); addField(outputType); if (workbench == null) { outputType.setEnabled(false, getFieldEditorParent()); } IntegerFieldEditor overlapField = new IntegerFieldEditor(FftPreferences.OVERLAP.getName(), "O&verlap:", getFieldEditorParent()); overlapField.setValidRange(0, 100); overlapField.setErrorMessage("Overlap must be an integer between 0 - 100"); addField(overlapField); IntegerFieldEditor slidingAvgField = new IntegerFieldEditor(FftPreferences.SLIDING_NUM_AVERAGES.getName(), "&Sliding Num Averages:", getFieldEditorParent()); slidingAvgField.setValidRange(1, Integer.MAX_VALUE); slidingAvgField.setErrorMessage("Sliding number of averages must be integer >= 1"); addField(slidingAvgField); IntegerFieldEditor transformSizeField = new IntegerFieldEditor(FftPreferences.TRANSFORM_SIZE.getName(), "&Transform Size:", getFieldEditorParent()) { @Override public Text getTextControl(Composite parent) { Text retVal = super.getTextControl(parent); retVal.setToolTipText("For best performance should be a power of 2"); return retVal; } }; transformSizeField.setValidRange(2, Integer.MAX_VALUE); transformSizeField.setErrorMessage("Transform Size must be integer >= 2"); addField(transformSizeField); List<String[]> windowTypeValues = new ArrayList<String[]>(); for (FftNxmBlockSettings.WindowType type : FftNxmBlockSettings.WindowType.values()) { windowTypeValues.add(new String[] { type.getLabel(), type.toString() }); } String[][] windowValue = windowTypeValues.toArray(new String[0][]); ComboFieldEditor windowTypeField = new ComboFieldEditor(FftPreferences.WINDOW_TYPE.getName(), "&Window Type:", windowValue, getFieldEditorParent()); addField(windowTypeField); // TODO // createAdvancedFields(); }
From source file:org.key_project.key4eclipse.common.ui.preference.page.StarterPreferencePage.java
License:Open Source License
/** * Creates a tab.//from w w w. j a v a2s. c o m * @param starterKindsTabFolder The {@link TabFolder} to fill. * @param tabTitle The tab title. * @param starterDescriptions The available {@link StarterDescription}s. * @param selectedStarterProperty The property to store the selected {@link StarterDescription}. * @param dontAskAgainProperty The property to store the do not ask again value. * @param disableProperty The property to store the disabled value. */ protected <I> void createTab(TabFolder starterKindsTabFolder, String tabTitle, final ImmutableList<StarterDescription<I>> starterDescriptions, String selectedStarterProperty, String dontAskAgainProperty, String disableProperty) { final Composite globalStarterTabComposite = new Composite(starterKindsTabFolder, SWT.NONE); globalStarterTabComposite.setLayout(new GridLayout(1, false)); final String[][] globalStarterEntries = new String[starterDescriptions.size()][]; int i = 0; for (StarterDescription<I> sd : starterDescriptions) { globalStarterEntries[i] = new String[] { sd.getName(), sd.getId() }; i++; } final ComboFieldEditor selectedGlobalStarterEditor = new ComboFieldEditor(selectedStarterProperty, "Selected Application", globalStarterEntries, globalStarterTabComposite); addField(selectedGlobalStarterEditor); Group descriptionGroup = new Group(globalStarterTabComposite, SWT.NONE); GridData descriptionGroupData = new GridData(GridData.FILL_BOTH); descriptionGroupData.widthHint = 400; descriptionGroup.setLayoutData(descriptionGroupData); descriptionGroup.setText("Description"); descriptionGroup.setLayout(new FillLayout()); final Text descriptionText = new Text(descriptionGroup, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP); descriptionText.setEditable(false); StarterDescription<I> initialSd = StarterUtil.searchStarter(starterDescriptions, getPreferenceStore().getString(selectedStarterProperty)); if (initialSd == null && !starterDescriptions.isEmpty()) { initialSd = starterDescriptions.head(); } if (initialSd != null) { SWTUtil.setText(descriptionText, initialSd.getDescription()); } try { final Combo combo = (Combo) ObjectUtil.get(selectedGlobalStarterEditor, "fCombo"); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int index = combo.getSelectionIndex(); if (index >= 0 && index < starterDescriptions.size()) { SWTUtil.setText(descriptionText, starterDescriptions.take(index).head().getDescription()); } else { descriptionText.setText(StringUtil.EMPTY_STRING); } } }); } catch (Exception e) { LogUtil.getLogger().logError(e); } final BooleanFieldEditor dontAskEditor = new BooleanFieldEditor(dontAskAgainProperty, "&Do not ask", globalStarterTabComposite); addField(dontAskEditor); BooleanFieldEditor disabledEditor = new BooleanFieldEditor(disableProperty, "D&isable functionality", globalStarterTabComposite); addField(disabledEditor); try { final Button button = (Button) ObjectUtil.get(disabledEditor, "checkBox"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean disabled = button.getSelection(); selectedGlobalStarterEditor.setEnabled(!disabled, globalStarterTabComposite); descriptionText.setEnabled(!disabled); dontAskEditor.setEnabled(!disabled, globalStarterTabComposite); } }); } catch (Exception e) { LogUtil.getLogger().logError(e); } TabItem globalStarterTabItem = new TabItem(starterKindsTabFolder, SWT.NONE); globalStarterTabItem.setText(tabTitle); globalStarterTabItem.setControl(globalStarterTabComposite); boolean disabled = getPreferenceStore().getBoolean(disableProperty); selectedGlobalStarterEditor.setEnabled(!disabled, globalStarterTabComposite); descriptionText.setEnabled(!disabled); dontAskEditor.setEnabled(!disabled, globalStarterTabComposite); }
From source file:org.key_project.sed.key.ui.preference.page.KeYLaunchSymbolicDebugPreferencePage.java
License:Open Source License
/** * {@inheritDoc}//from w w w .ja v a 2s. c o m */ @Override protected void createFieldEditors() { // Group style was copied from org.eclipse.debug.internal.ui.preferences.LaunchingPreferencePage Group group = SWTFactory.createGroup(getFieldEditorParent(), "Symbolic Execution Tree", 1, 1, GridData.FILL_HORIZONTAL); final Composite spacer = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL); BooleanFieldEditor returnEdit = new BooleanFieldEditor( KeYSEDPreferences.SHOW_METHOD_RETURN_VALUES_IN_DEBUG_NODES, "&Show method return values in debug nodes", SWT.NONE, spacer); addField(returnEdit); BooleanFieldEditor mergeEdit = new BooleanFieldEditor(KeYSEDPreferences.MERGE_BRANCH_CONDITIONS, "&Merge branch conditions", SWT.NONE, spacer); addField(mergeEdit); final ObservableBooleanFieldEditor ppEdit = new ObservableBooleanFieldEditor( KeYSEDPreferences.USE_PRETTY_PRINTING, "Use &pretty printing", SWT.NONE, spacer); addField(ppEdit); final BooleanFieldEditor unicodeEdit = new BooleanFieldEditor(KeYSEDPreferences.USE_UNICODE, "Use &unicode symbols", SWT.NONE, spacer); addField(unicodeEdit); ppEdit.addFieldEditorValueListener(new IFieldEditorValueListener() { @Override public void shownValueChanged(FieldEditorValueEvent e) { unicodeEdit.setEnabled(ppEdit.getBooleanValue(), spacer); } }); BooleanFieldEditor sigEdit = new BooleanFieldEditor(KeYSEDPreferences.SHOW_SIGNATURE_ON_METHOD_RETURN_NODES, "Show signature instead of only the name on method &return nodes", SWT.NONE, spacer); addField(sigEdit); BooleanFieldEditor truthEvaluationEdit = new BooleanFieldEditor( KeYSEDPreferences.TRUTH_VALUE_EVALUATION_ENABLED, "Truth value evaluation enabled (EXPERIMENTAL, not all rules are correctly supported)", SWT.NONE, spacer); addField(truthEvaluationEdit); group = SWTFactory.createGroup(getFieldEditorParent(), "Variables", 1, 1, GridData.FILL_HORIZONTAL); final Composite variablesSpacer = SWTFactory.createComposite(group, 2, 1, GridData.FILL_HORIZONTAL); final ObservableBooleanFieldEditor varEdit = new ObservableBooleanFieldEditor( KeYSEDPreferences.SHOW_VARIABLES_OF_SELECTED_DEBUG_NODE, "Show &variables of selected debug node", SWT.NONE, variablesSpacer); varEdit.fillIntoGrid(variablesSpacer, 2); addField(varEdit); final ComboFieldEditor variablesEditor = new ComboFieldEditor( KeYSEDPreferences.VARIABLES_ARE_COMPUTED_FROM_UPDATES, "Variables &computation", new String[][] { { "Based on visible type structure", "false" }, { "Based on sequent", "true" } }, variablesSpacer); addField(variablesEditor); varEdit.addFieldEditorValueListener(new IFieldEditorValueListener() { @Override public void shownValueChanged(FieldEditorValueEvent e) { variablesEditor.setEnabled(varEdit.getBooleanValue(), variablesSpacer); } }); group = SWTFactory.createGroup(getFieldEditorParent(), "Source Code", 1, 1, GridData.FILL_HORIZONTAL); Composite sourceCodeSpacer = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL); BooleanFieldEditor highlightReachedCode = new BooleanFieldEditor( KeYSEDPreferences.HIGHLIGHT_REACHED_SOURCE_CODE, "Highlight reached source code during symbolic execution", SWT.NONE, sourceCodeSpacer); addField(highlightReachedCode); group = SWTFactory.createGroup(getFieldEditorParent(), "KeY", 1, 1, GridData.FILL_HORIZONTAL); Composite keySpacer = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL); BooleanFieldEditor mainWindowEdit = new BooleanFieldEditor(KeYSEDPreferences.SHOW_KEY_MAIN_WINDOW, "Show &KeY's main window (only for experienced user)", SWT.NONE, keySpacer); addField(mainWindowEdit); }