List of usage examples for org.eclipse.jface.preference StringFieldEditor setEmptyStringAllowed
public void setEmptyStringAllowed(boolean b)
From source file:org.eclipse.ptp.remotetools.environment.generichost.preferences.ui.PreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { // setTitle must be called here or it wont work setTitle(Messages.PreferencePage_Title); addField(new LabelFieldEditor(Messages.PreferencePage_HeaderConnection, getFieldEditorParent())); StringFieldEditor addrfield = new StringFieldEditor(ConfigFactory.ATTR_CONNECTION_ADDRESS, Messages.PreferencePage_LabelConnectionAddress, getFieldEditorParent()); addrfield.setEmptyStringAllowed(true); addField(addrfield);/* w ww . jav a2s .com*/ IntegerFieldEditor portfield = new IntegerFieldEditor(ConfigFactory.ATTR_CONNECTION_PORT, Messages.PreferencePage_LabelConnectionPort, getFieldEditorParent()); portfield.setEmptyStringAllowed(false); addField(portfield); StringFieldEditor userfield = new StringFieldEditor(ConfigFactory.ATTR_LOGIN_USERNAME, Messages.PreferencePage_LabelLoginUserName, getFieldEditorParent()); userfield.setEmptyStringAllowed(true); addField(userfield); BooleanFieldEditor loggingField = new BooleanFieldEditor(LOGGING_PREF, "Enable logging", getFieldEditorParent()); addField(loggingField); }
From source file:org.fhsolution.eclipse.plugins.csvedit.customeditor.preferences.CSVPreferencePage.java
License:Apache 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. * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() *//*from www .j a v a 2 s .co m*/ public void createFieldEditors() { String[][] pagesLabelsAndValues = new String[2][2]; pagesLabelsAndValues[0][0] = "Table"; pagesLabelsAndValues[0][1] = "0"; pagesLabelsAndValues[1][0] = "Source"; pagesLabelsAndValues[1][1] = "1"; addField(new ComboFieldEditor(PreferenceConstants.DEFAULT_VIEW_PAGE, "Select the default tab to view csv file:", pagesLabelsAndValues, getFieldEditorParent())); addField(new BooleanFieldEditor(PreferenceConstants.USE_FIRST_LINE_AS_HEADER, "&Use the first line of the CSV file as the column headers", getFieldEditorParent())); StringFieldEditor customDelimiterField = new StringFieldEditor(PreferenceConstants.CUSTOM_DELIMITER, "Choose the delimiter to use:", 2, getFieldEditorParent()); customDelimiterField.setTextLimit(1); customDelimiterField.setEmptyStringAllowed(false); addField(customDelimiterField); StringFieldEditor textQualifierChar = new StringFieldEditor(PreferenceConstants.TEXT_QUALIFIER, "Define the character used as a text qualifier of the data:", 2, getFieldEditorParent()); customDelimiterField.setTextLimit(1); customDelimiterField.setEmptyStringAllowed(false); addField(textQualifierChar); addField(new BooleanFieldEditor(PreferenceConstants.USE_QUALIFIER, "For the text qualifier to be used for all fields", getFieldEditorParent())); StringFieldEditor commentChar = new StringFieldEditor(PreferenceConstants.COMMENT_CHAR, "Choose the character to use as a comment:", 2, getFieldEditorParent()); customDelimiterField.setTextLimit(1); customDelimiterField.setEmptyStringAllowed(true); addField(commentChar); addField(new BooleanFieldEditor(PreferenceConstants.CASE_SENSITIVE_SEARCH, "&make filtering case sensitive", getFieldEditorParent())); }
From source file:org.lyllo.kickassplugin.ui.PreferencesCompiler.java
License:Open Source License
/** * {@inheritDoc}/*w w w. j a va 2s .c o m*/ */ protected void createFieldEditors() { Composite parent = getFieldEditorParent(); // Field for Compiler-Executable FileFieldEditor compiler = new FileFieldEditor(Constants.PREFERENCES_COMPILER_NAME, Messages.COMPILER_NAME + ": ", true, parent); compiler.setEmptyStringAllowed(false); compiler.setFileExtensions(new String[] { "*.jar" }); addField(compiler); BooleanFieldEditor symbols = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_SYMBOLS, Messages.COMPILER_SYMBOLS, parent); addField(symbols); BooleanFieldEditor vicesymbols = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_VICESYMBOLS, Messages.COMPILER_VICESYMBOLS, parent); addField(vicesymbols); BooleanFieldEditor afo = new BooleanFieldEditor(Constants.PREFERENCES_COMPILER_AFO, Messages.COMPILER_AFO, parent); addField(afo); StringFieldEditor kickasscfg = new StringFieldEditor(Constants.PREFERENCES_LOCAL_CONFIG, Messages.COMPILER_LOCAL_CFG, parent); kickasscfg.setEmptyStringAllowed(true); addField(kickasscfg); PathEditor pathEditor = new PathEditor(Constants.PREFERENCES_COMPILER_LIBDIRS, Messages.COMPILER_LIBDIRS, Messages.COMPILER_LIBDIRS_CHOOSETEXT, parent); addField(pathEditor); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; Label label = new Label(parent, SWT.LEFT); label.setText(Messages.PARAMS_TEMPLATE_COMPILER); label.setLayoutData(gd); // Field for parameters to use Compiler-Executable MultiLineStringFieldEditor params = new MultiLineStringFieldEditor(Constants.PREFERENCES_COMPILER_PARAMS, Messages.PARAMS_NAME, parent); params.setErrorMessage("Invalid parameter. Must be in 'key=value' format."); addField(params); }
From source file:org.mwc.debrief.core.wizards.FlatFilenameWizardPage.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) *//*from w w w . j a v a2 s . c o m*/ public void createControl(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; final String filenameKey = "3Debrief.FlatFileOutput"; final String sensor1Key = "3Debrief.FlatFileSensorType1"; final String sensor2Key = "3Debrief.FlatFileSensorType2"; final String protMarkKey = "3Debrief.FlatFileProtMarking"; final String serialKey = "3Debrief.FlatFileSerialName"; final String sensor1fwdKey = "3Debrief.FlatFileSensor1fwd"; final String sensor1aftKey = "3Debrief.FlatFileSensor1aft"; final String sensor2fwdKey = "3Debrief.FlatFileSensor2fwd"; final String sensor2aftKey = "3Debrief.FlatFileSensor2aft"; final String speedOfSoundKey = "3Debrief.speedOfSoundKey"; final String title = "Output directory:"; _fileFieldEditor = new DirectoryFieldEditor(filenameKey, title, container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; // tell the ui to update itself _filePath = (String) newValue; dialogChanged(); this.store(); } @Override protected boolean doCheckState() { return _filePath != null; } }; _fileFieldEditor.fillIntoGrid(container, 3); _fileFieldEditor.setPreferenceStore(getPreferenceStore()); _fileFieldEditor.setPage(this); _fileFieldEditor.setEmptyStringAllowed(false); _fileFieldEditor.load(); // store the current editor value _filePath = _fileFieldEditor.getStringValue(); // ok, we also need the sensor depth attribute if (_fileVersion.equals(FlatFileExporter.UPDATED_VERSION)) { // ok, get the sensor1 depth final StringFieldEditor speedOfSoundEditor = new StringFieldEditor(speedOfSoundKey, "Speed of Sound (m/sec):", container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; // is this the value property? try { _speedOfSound = MWCXMLReader.readThisDouble(newValue.toString()); } catch (final ParseException e) { // ignore } dialogChanged(); // and remember the new value store(); } @Override protected boolean doCheckState() { return _speedOfSound != null; } }; speedOfSoundEditor.setEmptyStringAllowed(false); speedOfSoundEditor.setPreferenceStore(getPreferenceStore()); speedOfSoundEditor.setPage(this); speedOfSoundEditor.setErrorMessage("A value for speed of sound must be supplied"); speedOfSoundEditor.setStringValue(""); speedOfSoundEditor.load(); if (speedOfSoundEditor.getStringValue() != null) { try { _speedOfSound = MWCXMLReader.readThisDouble(speedOfSoundEditor.getStringValue()); } catch (final ParseException pe) { // ignore } } @SuppressWarnings("unused") final Label lbl3 = new Label(container, SWT.None); } // sort out the correct selection lists String[][] sensorTypes; if (_fileVersion.equals(FlatFileExporter.INITIAL_VERSION)) { sensorTypes = sensor1Types; } else { sensorTypes = sensor2Types; } // sort out the first sensor _sensor1TypeEditor = new RadioGroupFieldEditor(sensor1Key, "Sensor 1 type:", 2, sensorTypes, container) { protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; _sensorType1 = (String) newValue; enableAftEditor(container, _sensor1AftEditor, _sensorType1); dialogChanged(); // remember the value this.store(); } }; _sensor1TypeEditor.setPreferenceStore(getPreferenceStore()); _sensor1TypeEditor.setPage(this); _sensor1TypeEditor.load(); _sensorType1 = getPreferenceStore().getString(sensor1Key); @SuppressWarnings("unused") final Label lbl = new Label(container, SWT.None); // ok, we also need the sensor depth attribute if (_fileVersion.equals(FlatFileExporter.UPDATED_VERSION)) { // ok, get the sensor1 depth final StringFieldEditor sensor1FwdEditor = new StringFieldEditor(sensor1fwdKey, "Sensor 1 fwd depth (m):", container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; try { _sensor1Fwd = MWCXMLReader.readThisDouble(newValue.toString()); } catch (final ParseException pe) { _sensor1Fwd = null; } if (_sensor1AftEditor != null) _sensor1AftEditor.setEnabled(!_sensorType1.startsWith("H"), container); // we may not have a second editor = get checking // if (_sensor2AftEditor != null) // _sensor2AftEditor.setEnabled(!_sensorType2.startsWith("H"), // container); dialogChanged(); // remember the value this.store(); } @Override protected boolean doCheckState() { return _sensor1Fwd != null; } }; sensor1FwdEditor.setEmptyStringAllowed(false); sensor1FwdEditor.setPreferenceStore(getPreferenceStore()); sensor1FwdEditor.setPage(this); sensor1FwdEditor.setErrorMessage("A value for Sensor 1 fwd depth must be supplied"); sensor1FwdEditor.setStringValue(""); sensor1FwdEditor.load(); if (sensor1FwdEditor.getStringValue() != null) { try { _sensor1Fwd = MWCXMLReader.readThisDouble(sensor1FwdEditor.getStringValue()); } catch (final ParseException pe) { // ignore } } @SuppressWarnings("unused") final Label lbl2 = new Label(container, SWT.None); // ok, get the sensor1 depth _sensor1AftEditor = new StringFieldEditor(sensor1aftKey, "Sensor 1 aft depth (m):", container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; // is this the value property? try { _sensor1Aft = MWCXMLReader.readThisDouble(newValue.toString()); } catch (final ParseException pe) { _sensor1Aft = null; } dialogChanged(); // remember this value this.store(); } @Override protected boolean doCheckState() { return _sensor1Aft != null; } }; _sensor1AftEditor.setEmptyStringAllowed(false); _sensor1AftEditor.setPreferenceStore(getPreferenceStore()); _sensor1AftEditor.setPage(this); _sensor1AftEditor.setErrorMessage("A value for Sensor 1 aft depth must be supplied"); _sensor1AftEditor.setStringValue(""); _sensor1AftEditor.load(); enableAftEditor(container, _sensor1AftEditor, _sensorType1); if (_sensor1AftEditor.getStringValue() != null) { try { _sensor1Aft = MWCXMLReader.readThisDouble(_sensor1AftEditor.getStringValue()); } catch (final ParseException pe) { // ignore } } @SuppressWarnings("unused") final Label lbl3b = new Label(container, SWT.None); } // and now the second sensor if (_numSensors > 1) { _sensor2TypeEditor = new RadioGroupFieldEditor(sensor2Key, "Sensor 2 type:", 2, sensorTypes, container) { protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; _sensorType2 = (String) newValue; enableAftEditor(container, _sensor2AftEditor, _sensorType2); dialogChanged(); // remember this value this.store(); } }; _sensor2TypeEditor.setPreferenceStore(getPreferenceStore()); _sensor2TypeEditor.setPage(this); _sensor2TypeEditor.load(); _sensorType2 = getPreferenceStore().getString(sensor2Key); @SuppressWarnings("unused") final Label lbl2 = new Label(container, SWT.None); // ok, we also need the sensor depth attribute if (_fileVersion.equals(FlatFileExporter.UPDATED_VERSION)) { // ok, get the sensor1 depth final StringFieldEditor sensor2FwdEditor = new StringFieldEditor(sensor2fwdKey, "Sensor 2 fwd depth (m):", container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; // is this the value property? try { _sensor2Fwd = MWCXMLReader.readThisDouble(newValue.toString()); dialogChanged(); // remember this value this.store(); } catch (final ParseException pe) { _sensor2Fwd = null; } } @Override protected boolean doCheckState() { return _sensor2Fwd != null; } }; sensor2FwdEditor.setEmptyStringAllowed(false); sensor2FwdEditor.setPreferenceStore(getPreferenceStore()); sensor2FwdEditor.setPage(this); sensor2FwdEditor.setErrorMessage("A value for Sensor 2 fwd depth must be supplied"); sensor2FwdEditor.load(); if (sensor2FwdEditor.getStringValue() != null) { try { _sensor2Fwd = MWCXMLReader.readThisDouble(sensor2FwdEditor.getStringValue()); } catch (final ParseException pe) { // ignore } } @SuppressWarnings("unused") final Label lbl3 = new Label(container, SWT.None); // ok, get the sensor1 depth _sensor2AftEditor = new StringFieldEditor(sensor2aftKey, "Sensor 2 aft depth (m):", container) { @Override protected void doLoad() { super.doLoad(); fireValueChanged(FieldEditor.VALUE, null, this.getStringValue()); } protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; // is this the value property? try { _sensor2Aft = MWCXMLReader.readThisDouble(newValue.toString()); } catch (final ParseException pe) { _sensor2Aft = null; } // remember this value this.store(); dialogChanged(); } @Override protected boolean doCheckState() { return _sensor2Aft != null; } }; _sensor2AftEditor.setEmptyStringAllowed(false); _sensor2AftEditor.setPreferenceStore(getPreferenceStore()); _sensor2AftEditor.setPage(this); _sensor2AftEditor.setErrorMessage("A value for Sensor 2 aft depth must be supplied"); _sensor2AftEditor.load(); enableAftEditor(container, _sensor2AftEditor, _sensorType2); if (_sensor2AftEditor.getStringValue() != null) { try { _sensor2Aft = MWCXMLReader.readThisDouble(_sensor2AftEditor.getStringValue()); } catch (final ParseException pe) { // ignore } } @SuppressWarnings("unused") final Label lbl4 = new Label(container, SWT.None); } } if (_fileVersion.equals(FlatFileExporter.UPDATED_VERSION)) { // we also want to specify the prot marking editor _protMarkingEditor = new StringFieldEditor(protMarkKey, "Protective Marking:", container) { protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; _protMarking = (String) newValue; dialogChanged(); // remember this value this.store(); } @Override protected boolean doCheckState() { return _protMarking != null; } }; _protMarkingEditor.setEmptyStringAllowed(false); _protMarkingEditor.setPreferenceStore(getPreferenceStore()); _protMarkingEditor.setPage(this); _protMarkingEditor.setErrorMessage("A value for protective marking must be supplied"); _protMarkingEditor.setStringValue(""); _protMarkingEditor.load(); _protMarking = _protMarkingEditor.getStringValue(); @SuppressWarnings("unused") final Label lbl3 = new Label(container, SWT.None); } // we also want to specify the serial nane (for single or double sensors) _serialNameEditor = new StringFieldEditor(serialKey, "Serial name:", container) { protected void fireValueChanged(final String property, final Object oldValue, final Object newValue) { super.fireValueChanged(property, oldValue, newValue); // is this the value property? if (!property.equals(FieldEditor.VALUE)) return; _serialName = (String) newValue; dialogChanged(); // remember this value this.store(); } @Override protected boolean doCheckState() { return _serialName != null; } }; _serialNameEditor.setPreferenceStore(getPreferenceStore()); _serialNameEditor.setPage(this); _serialNameEditor.setEmptyStringAllowed(false); _serialNameEditor.setErrorMessage("The serial name must be supplied"); _serialNameEditor.load(); _serialName = _serialNameEditor.getStringValue(); final GridLayout urlLayout = (GridLayout) container.getLayout(); urlLayout.numColumns = 3; container.layout(); setControl(container); }
From source file:org.neo4j.neoclipse.preference.DecoratorPreferencePage.java
License:Apache License
/** * Initializes the several input fields. *//* ww w . j a va 2 s . c o m*/ @Override protected void createFieldEditors() { // node label properties StringFieldEditor propertyNameField = new StringFieldEditor(DecoratorPreferences.NODE_PROPERTY_NAMES, NODE_LABEL_PROPERTIES_LABEL, getFieldEditorParent()); propertyNameField.setEmptyStringAllowed(true); addField(propertyNameField, PROPTERTY_NAMES_NOTE); // node label properties StringFieldEditor relPropertyNameField = new StringFieldEditor( DecoratorPreferences.RELATIONSHIP_PROPERTY_NAMES, RELATIONSHIP_LABEL_PROPERTIES_LABEL, getFieldEditorParent()); relPropertyNameField.setEmptyStringAllowed(true); addField(relPropertyNameField, PROPTERTY_NAMES_NOTE); // icon locations DirectoryFieldEditor iconLocationField = new DirectoryFieldEditor(DecoratorPreferences.NODE_ICON_LOCATION, NODE_ICONS_LOCATION_LABEL, getFieldEditorParent()); iconLocationField.setEmptyStringAllowed(true); iconLocationField.setErrorMessage(NODE_ICONS_LOCATION_ERROR); addField(iconLocationField, ICON_LOCATION_NOTE); // node icon filename properties StringFieldEditor iconPropertyNameField = new StringFieldEditor( DecoratorPreferences.NODE_ICON_PROPERTY_NAMES, NODE_ICON_FILENAME_PROPERTIES_LABEL, getFieldEditorParent()); iconPropertyNameField.setEmptyStringAllowed(true); addField(iconPropertyNameField, ICON_PROPERTY_NAMES_NOTE); }
From source file:org.talend.designer.esb.components.rs.provider.EsbPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { StringFieldEditor localRestServiceUri = new StringFieldEditor(Activator.REST_URI_PREFERENCE, Messages.getString("esb.preferences.rest.service.uri.default"), getFieldEditorParent()); localRestServiceUri.setEmptyStringAllowed(false); addField(localRestServiceUri);/* w ww . j ava 2 s . c om*/ StringFieldEditor defaultServiceNamespace = new StringFieldEditor(Activator.DEFAULT_SL_NAMESPACE_PREF, Messages.EsbPreferencePage_SL_NAMESPACE, getFieldEditorParent()); defaultServiceNamespace.setEmptyStringAllowed(false); addField(defaultServiceNamespace); }
From source file:org.thanlwinsoft.languagetest.eclipse.prefs.RecordingPreferencePage.java
License:Open Source License
private void addConverterFieldEditors(String convPref, String convLabelId, String argPref, String argLabelId) { StringFieldEditor argumentEditor = null; FileFieldEditor fileEditor = null;// w w w .j av a 2s .co m fileEditor = new FileFieldEditor(convPref, MessageUtil.getString(convLabelId), false, getFieldEditorParent()); if (Platform.getOS().equals(Platform.OS_WIN32)) { fileEditor.setFileExtensions(new String[] { ".exe" }); } fileEditor.setEmptyStringAllowed(true); addField(fileEditor); fileEditor.fillIntoGrid(getFieldEditorParent(), 3); argumentEditor = new StringFieldEditor(argPref, MessageUtil.getString(argLabelId), SWT.NONE, getFieldEditorParent()); argumentEditor.setEmptyStringAllowed(true); addField(argumentEditor); argumentEditor.fillIntoGrid(getFieldEditorParent(), 3); adjustTextControl(fileEditor); adjustTextControl(argumentEditor); }
From source file:pl.poznan.put.cs.gui4pddl.preferences.ui.PlannerPreferencesPageTabItem.java
License:Open Source License
private StringFieldEditor createPlannerNameFieldEditor(Composite tabItemComposite) { StringFieldEditor plannerName = new StringFieldEditor("Planner Name", "Planner Name", tabItemComposite); plannerName.fillIntoGrid(tabItemComposite, 3); plannerName.setEmptyStringAllowed(false); plannerName.setStringValue(preferences.getPlannerName()); return plannerName; }
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. *///from w ww . j a va 2 s. c o m 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); }