List of usage examples for org.eclipse.jface.preference FieldEditor getPreferenceName
public String getPreferenceName()
From source file:de.fu_berlin.inf.dpp.videosharing.preferences.VideoSharingPreferenceHelper.java
License:Open Source License
public static void checkXugglerInstallationOnPropertyChange(FieldEditorPreferencePage page, PropertyChangeEvent event) { if (event.getSource() instanceof FieldEditor) { FieldEditor field = (FieldEditor) event.getSource(); if (field.getPreferenceName().equals(PreferenceConstants.ENCODING_CODEC)) { if (event.getNewValue() instanceof String) { String newValue = (String) event.getNewValue(); if (newValue.equals(Codec.XUGGLER.name())) { checkXugglerInstallation(page); } else { page.setErrorMessage(null); }// w w w. ja va2s . c o m } } } }
From source file:it.unibz.instasearch.prefs.InstaSearchPreferencePage.java
License:Open Source License
@Override public void propertyChange(PropertyChangeEvent event) { super.propertyChange(event); if (event.getSource() instanceof FieldEditor) { FieldEditor field = (FieldEditor) event.getSource(); if (field == periodicReindexEnabled) { periodicReindexInterval.setEnabled(periodicReindexEnabled.getBooleanValue(), getFieldEditorParent()); }// ww w .j a v a 2 s .co m if (PreferenceConstants.P_INDEXABLE_EXTENSIONS.equals(field.getPreferenceName()) || PreferenceConstants.P_EXCLUDE_DIRS.equals(field.getPreferenceName()) || PreferenceConstants.P_INDEX_EMPTY_EXTENSION.equals(field.getPreferenceName())) setMessage("Rebuilding of index is recommended", INFORMATION); else if (PreferenceConstants.P_INDEX_ARCHIVES.equals(field.getPreferenceName())) setMessage("Rebuilding of index is required", INFORMATION); } }
From source file:jmockit.assist.prefs.PreferencePage.java
License:Open Source License
@Override public void propertyChange(final PropertyChangeEvent event) { super.propertyChange(event); if (event.getSource() instanceof FieldEditor) { FieldEditor field = (FieldEditor) event.getSource(); if (Prefs.PROP_CHECK_SCOPE.equals(field.getPreferenceName())) { setMessage("Checks will be performed on next build", INFORMATION); }//from www . j ava2 s. c o m } }
From source file:net.sourceforge.eclipseccase.ui.preferences.MasterBooleanFieldEditor.java
License:Open Source License
private void updateSlaves() { boolean enable = enabled && getBooleanValue(); for (int i = 0; i < slaves.size(); i++) { Object e = slaves.get(i); FieldEditor fe = (FieldEditor) e; String name = fe.getPreferenceName(); String imageccelelmentback = ClearCaseUIPreferences.IMAGE_CLEARCASE_ELEMENTS_BACKGROUND; if (name.equals(imageccelelmentback) && enable) { FileFieldEditor fed = ((FileFieldEditor) fe); fed.setEmptyStringAllowed(false); } else if (name.equals(imageccelelmentback) && !enable) { FileFieldEditor fed = ((FileFieldEditor) fe); fed.setEmptyStringAllowed(true); }//from w w w.ja va 2 s .c om fe.setEnabled(enable, parent); } }
From source file:org.chromium.debug.ui.launcher.TabBase.java
License:Open Source License
private static void storeEditor(FieldEditor editor, String errorValue) { if (editor.isValid()) { editor.store();/*from w ww . j a va 2 s . com*/ } else { editor.getPreferenceStore().setValue(editor.getPreferenceName(), errorValue); } }
From source file:org.csstudio.diirt.util.preferences.BasePreferencePage.java
License:Open Source License
/** * Add the given {@code editor} field to this page. The editor's * caption foreground will be updated when the editor's value changes. * * @param fieldEditor The {@link FieldEditor} to be added and updated. * @param parent The {@link Composite} owning the given {@code editor}. * @param canBeDefaulted {@code true} if the given {@code editor} can be * restored to its default value. * @param defaultGetter The {@link Supplier} of the editor's default value. * Can be {@code null} if the editor's caption foreground * should not be updated when the editor's value changes. * @param storedGetter The {@link Supplier} of the editor's stored value. * Can be {@code null} if the editor's caption foreground * should not be initially updated. * @param listener Called when a field editor fires a value property change. *///from w w w .j av a 2 s . c om protected void addField(FieldEditor fieldEditor, Composite parent, boolean canBeDefaulted, Supplier<Object> defaultGetter, Supplier<Object> storedGetter, IPropertyChangeListener listener) { final IPreferenceStore store = getPreferenceStore(); final Editor editor = new Editor(fieldEditor, parent, canBeDefaulted, defaultGetter, storedGetter); fieldEditor.getLabelControl(parent).setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); fieldEditor.setPage(this); fieldEditor.setPreferenceStore(store); fieldEditor.load(); fieldEditor.setPropertyChangeListener(e -> { if (FieldEditor.VALUE.equals(e.getProperty())) { if (storedGetter != null) { editor.setRestartRequired(!Objects.equals(e.getNewValue(), storedGetter.get())); } editor.updateCaptionColor(e.getNewValue()); if (listener != null) { listener.propertyChange(e); } } }); editor.updateCaptionColor(); editors.put(fieldEditor, editor); if (PREF_CONFIGURATION_DIRECTORY.equals(fieldEditor.getPreferenceName())) { directoryEditor = editor; } }
From source file:org.eclipse.cdt.managedbuilder.ui.properties.BuildOptionSettingsUI.java
License:Open Source License
@Override public void propertyChange(PropertyChangeEvent event) { // allow superclass to handle as well super.propertyChange(event); Object source = event.getSource(); IOption changedOption = null;// ww w. java2s . co m IHoldsOptions changedHolder = null; String id = null; if (source instanceof FieldEditor) { FieldEditor fe = (FieldEditor) source; if (fe instanceof TriStateBooleanFieldEditor) ((TriStateBooleanFieldEditor) fe).set3(false); id = fe.getPreferenceName(); Object[] option = this.getToolSettingsPrefStore().getOption(id); if (option == null) { int n = id.lastIndexOf('.'); if (n > 0) { id = id.substring(0, n); option = getToolSettingsPrefStore().getOption(id); } } if (option != null) { changedOption = (IOption) option[1]; changedHolder = (IHoldsOptions) option[0]; try { switch (changedOption.getValueType()) { case IOption.STRING: if (fe instanceof StringFieldEditor) { String val = ((StringFieldEditor) fe).getStringValue(); ManagedBuildManager.setOption(fInfo, changedHolder, changedOption, val); } break; case IOption.BOOLEAN: if (fe instanceof BooleanFieldEditor) { boolean val = ((BooleanFieldEditor) fe).getBooleanValue(); ManagedBuildManager.setOption(fInfo, changedHolder, changedOption, val); } break; case IOption.ENUMERATED: if (fe instanceof BuildOptionComboFieldEditor) { String name = ((BuildOptionComboFieldEditor) fe).getSelection(); String enumId = changedOption.getEnumeratedId(name); ManagedBuildManager.setOption(fInfo, changedHolder, changedOption, (enumId != null && enumId.length() > 0) ? enumId : name); } break; case IOption.TREE: if (fe instanceof TreeBrowseFieldEditor) { String name = ((TreeBrowseFieldEditor) fe).getStringValue(); String treeId = changedOption.getId(name); ManagedBuildManager.setOption(fInfo, changedHolder, changedOption, (treeId != null && treeId.length() > 0) ? treeId : name); } break; case IOption.INCLUDE_PATH: case IOption.STRING_LIST: case IOption.PREPROCESSOR_SYMBOLS: case IOption.LIBRARIES: case IOption.OBJECTS: case IOption.INCLUDE_FILES: case IOption.LIBRARY_PATHS: case IOption.LIBRARY_FILES: case IOption.MACRO_FILES: case IOption.UNDEF_INCLUDE_PATH: case IOption.UNDEF_PREPROCESSOR_SYMBOLS: case IOption.UNDEF_INCLUDE_FILES: case IOption.UNDEF_LIBRARY_PATHS: case IOption.UNDEF_LIBRARY_FILES: case IOption.UNDEF_MACRO_FILES: if (fe instanceof FileListControlFieldEditor) { String val[] = ((FileListControlFieldEditor) fe).getStringListValue(); ManagedBuildManager.setOption(fInfo, changedHolder, changedOption, val); } break; default: break; } } catch (BuildException e) { } } } Object[][] options = category.getOptions(fInfo, optionHolder); // some option has changed on this page... update enabled/disabled state for all options for (int index = 0; index < options.length; ++index) { // Get the option IHoldsOptions holder = (IHoldsOptions) options[index][0]; if (holder == null) break; // The array may not be full IOption opt = (IOption) options[index][1]; String optId = getToolSettingsPrefStore().getOptionId(opt); // is the option on this page? if (fieldsMap.containsKey(optId)) { // check to see if the option has an applicability calculator IOptionApplicability applicabilityCalculator = opt.getApplicabilityCalculator(); FieldEditor fieldEditor = fieldsMap.get(optId); try { if (opt.getValueType() == IOption.ENUMERATED) { // the item list of this enumerated option may have changed, update it updateEnumList(fieldEditor, opt, holder, fInfo); } } catch (BuildException be) { } if (applicabilityCalculator != null) { Composite parent = fieldEditorsToParentMap.get(fieldEditor); setFieldEditorEnablement(holder, opt, applicabilityCalculator, fieldEditor, parent); } } } Collection<FieldEditor> xxx = fieldsMap.values(); for (FieldEditor editor : xxx) { if (id == null || !id.equals(editor.getPreferenceName())) editor.load(); } }
From source file:org.eclipse.linuxtools.internal.lttng2.control.ui.views.preferences.ControlPreferencePage.java
License:Open Source License
@Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.VALUE)) { if (event.getSource() instanceof FieldEditor) { FieldEditor editor = (FieldEditor) event.getSource(); if (editor.getPreferenceName().equals(ControlPreferences.TRACE_CONTROL_LOG_COMMANDS_PREF)) { Boolean enabled = (Boolean) event.getNewValue(); fVerboseLevel.setEnabled(enabled, getFieldEditorParent()); fIsAppend.setEnabled(enabled, getFieldEditorParent()); }//from www. j a va 2 s . c om } } super.propertyChange(event); }
From source file:org.eclipse.titan.designer.properties.pages.FieldEditorPropertyPage.java
License:Open Source License
/** * The field editor preference page implementation of this * <code>PreferencePage</code> method saves all field editors by calling * <code>FieldEditor.store</code>. Note that this method does not save * the preference store itself; it just stores the values back into the * preference store.// w w w. ja va 2s . c o m * * @see FieldEditor#store() */ @Override public boolean performOk() { if (editors != null) { Iterator<FieldEditor> e = editors.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.store(); pe.getPreferenceStore().setToDefault(pe.getPreferenceName()); } } super.performOk(); return true; }
From source file:org.eclipse.ui.internal.monitoring.preferences.MonitoringPreferencePage.java
License:Open Source License
private void enableDependentFields(boolean enable) { for (Map.Entry<FieldEditor, Composite> entry : editors.entrySet()) { FieldEditor editor = entry.getKey(); if (!editor.getPreferenceName().equals(PreferenceConstants.MONITORING_ENABLED)) { editor.setEnabled(enable, entry.getValue()); }//from w w w . ja v a 2 s. com } }