List of usage examples for org.eclipse.jface.preference StringFieldEditor setPropertyChangeListener
public void setPropertyChangeListener(IPropertyChangeListener listener)
From source file:com.siemens.ct.mp3m.ui.editors.id3.databinding.Id3TagPage.java
License:Open Source License
private void addKeyValuePair(String key, IMP3Info id3TagInfo, String value, final DataBindingContext bindingContext, boolean editable) { StringFieldEditor stringEditor = new StringFieldEditor(key, key + ":", section); //$NON-NLS-1$ toolkit.adapt(stringEditor.getTextControl(section), true, true); stringEditor.setEnabled(editable, section); Label label = stringEditor.getLabelControl(section); label.setEnabled(true);/* w ww . j a v a 2 s .c o m*/ toolkit.adapt(label, false, false); ControlDecoration controlDecoration = createTextDecoration(stringEditor.getTextControl(section)); // do the data binding bindingContext.bindValue(SWTObservables.observeText(stringEditor.getTextControl(section), SWT.Modify), PojoObservables.observeValue(id3TagInfo, value), new UpdateValueStrategy().setAfterConvertValidator(new RequiredValidator(controlDecoration, this)), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)); stringEditor.setPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (AggregateValidationStatus .getStatusMerged(bindingContext.getValidationStatusProviders()) == Status.OK_STATUS) { if (event.getProperty().equals("field_editor_value")) { isDirty = true; } getEditor().editorDirtyStateChanged(); } } }); fieldEditors.add(stringEditor); }
From source file:com.siemens.ct.mp3m.ui.editors.id3.Id3TagPage.java
License:Open Source License
private void addKeyValuePair(String key, String value, boolean editable) { StringFieldEditor stringEditor = new StringFieldEditor(key, key + ":", section); //$NON-NLS-1$ toolkit.adapt(stringEditor.getTextControl(section), true, true); stringEditor.setStringValue(value);/*from ww w .ja v a 2s.c o m*/ stringEditor.setEnabled(editable, section); Label label = stringEditor.getLabelControl(section); label.setEnabled(true); toolkit.adapt(label, false, false); stringEditor.setPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals("field_editor_value")) { isDirty = true; } getEditor().editorDirtyStateChanged(); } }); fieldEditors.add(stringEditor); }
From source file:org.chromium.debug.ui.launcher.ChromiumRemoteTab.java
License:Open Source License
protected static TabElements createBasicTabElements(Composite composite, final Runnable modifyListener, PreferenceStore store, Params params) { final StringFieldEditor debugHost; final IntegerFieldEditor debugPort; final BooleanFieldEditor addNetworkConsole; {/*from w w w. j a v a2 s. com*/ Group connectionGroup = new Group(composite, 0); connectionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); connectionGroup.setText(Messages.ChromiumRemoteTab_CONNECTION_GROUP); connectionGroup.setLayout(new GridLayout(1, false)); IPropertyChangeListener propertyModifyListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { modifyListener.run(); } }; Composite propertiesComp = createInnerComposite(connectionGroup, 2); // Host text field debugHost = new StringFieldEditor(HOST_FIELD_NAME, Messages.ChromiumRemoteTab_HostLabel, propertiesComp); debugHost.setPropertyChangeListener(propertyModifyListener); debugHost.setPreferenceStore(store); // Port text field debugPort = new IntegerFieldEditor(PORT_FIELD_NAME, Messages.ChromiumRemoteTab_PortLabel, propertiesComp); debugPort.setPropertyChangeListener(propertyModifyListener); debugPort.setPreferenceStore(store); addNetworkConsole = new BooleanFieldEditor(ADD_NETWORK_CONSOLE_FIELD_NAME, Messages.ChromiumRemoteTab_ShowDebuggerNetworkCommunication, propertiesComp); addNetworkConsole.setPreferenceStore(store); addNetworkConsole.setPropertyChangeListener(propertyModifyListener); } return new TabElements() { @Override public StringFieldEditor getHost() { return debugHost; } @Override public IntegerFieldEditor getPort() { return debugPort; } @Override public BooleanFieldEditor getAddNetworkConsole() { return addNetworkConsole; } }; }
From source file:pl.zgora.uz.imgpro.ui.preferences.GeneralPreferencePage.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. *///ww w. j a v a 2s . com public void createFieldEditors() { final Composite fieldEditorParent = getFieldEditorParent(); final StringFieldEditor sourceEditor = new StringFieldEditor(PreferenceConstants.MATLAB_SOURCE_FOLDER, " &Source folder for matlab files: ", fieldEditorParent); addField(sourceEditor); sourceEditor.setEmptyStringAllowed(false); sourceEditor.setPropertyChangeListener(this); final StringFieldEditor outputEditor = new StringFieldEditor(PreferenceConstants.OUTPUT_FOLDER, " &Output folder for images: ", fieldEditorParent); addField(outputEditor); outputEditor.setEmptyStringAllowed(false); outputEditor.setPropertyChangeListener(this); }