List of usage examples for org.eclipse.jface.preference StringFieldEditor setErrorMessage
public void setErrorMessage(String message)
From source file:com.appnativa.studio.preferences.MainPreferencePage.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 . jav a 2s .co m */ public void createFieldEditors() { DirectoryFieldEditor df; StringFieldEditor sf; addField(df = new DirectoryFieldEditorEx(PreferenceConstants.APPNATIVA_PATH, Studio.getResourceAsString("Studio.text.wizard.chooseAppNativaSDK") + ":", getFieldEditorParent())); df.setEmptyStringAllowed(false); df.setErrorMessage(Studio.getResourceAsString("Studio.text.wizard.help.directoryAppnativa")); addField(df = new DirectoryFieldEditorEx(PreferenceConstants.ANDROID_PATH, string("Studio.text.wizard.chooseAndroidSDK") + ":", getFieldEditorParent())); df.setErrorMessage(string("Studio.text.wizard.help.directoryAndroid")); df.setErrorMessage(string("Studio.text.wizard.help.directoryXCode")); addField(sf = new StringFieldEditor(PreferenceConstants.SMALL_SCREEN_SIZE, string("Studio.text.wizard.smallPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreen")); addField(sf = new StringFieldEditor(PreferenceConstants.SMALL_SCREEN_SIZE_WITH_MEDIUM, string("Studio.text.wizard.smallMedPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreenMedium")); addField(sf = new StringFieldEditor(PreferenceConstants.MEDIUM_SCREEN_SIZE, string("Studio.text.wizard.mediumPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreenMedium")); addField(sf = new StringFieldEditor(PreferenceConstants.ORGANIZATION_NAME, string("Studio.text.wizard.organizationName") + ":", getFieldEditorParent())); addField(sf = new StringFieldEditor(PreferenceConstants.PACKAGE_NAME, string("Studio.text.wizard.packageName") + ":", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.CANVAS_COLOR, "Canvas Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.GRID_COLOR, "Grid Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.SELECTION_COLOR, "Selection Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.TRACKING_COLOR, "Cell Tracking Color", getFieldEditorParent())); setValid(getAppNativaSDKDirectory() != null); }
From source file:com.clustercontrol.repository.preference.RepositoryPreferencePage.java
License:Open Source License
/** * ????/*from w w w .ja va 2 s. c om*/ */ @Override public void createFieldEditors() { Composite parent = this.getFieldEditorParent(); GridData gridData = null; // ?[] Group nodeGroup = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, null, nodeGroup); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; nodeGroup.setLayoutData(gridData); nodeGroup.setText(Messages.getString("view.repository.node")); // StringFieldEditor progExec = new StringFieldEditor(P_PROGRAM_EXECUTION, MSG_PROGRAM_EXECUTION, nodeGroup); progExec.setTextLimit(DataRangeConstant.VARCHAR_1024); String[] args = { Integer.toString(DataRangeConstant.VARCHAR_1024) }; progExec.setErrorMessage(Messages.getString("message.hinemos.7", args)); this.addField(progExec); // This setting is not available for Web Client. Disable and show message. // Note: RAP BUG? If there is no FieldEditor set, label will not be shown. if (ClusterControlPlugin.isRAP()) { progExec.getTextControl(nodeGroup).setEnabled(false); Label lblNotAvailable = new Label(parent, SWT.LEFT); lblNotAvailable.setText(Messages.getString("preferencepage.notavailable.message")); lblNotAvailable.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); WidgetTestUtil.setTestId(this, "notavailable", nodeGroup); } }
From source file:com.safi.workshop.sqlexplorer.preferences.GeneralPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { IntegerFieldEditor iEdit;//ww w.ja va 2 s. co m StringFieldEditor sEdit; iEdit = new IntegerFieldEditor(IConstants.PRE_ROW_COUNT, Messages.getString("Preview_Max_Rows_3"), getFieldEditorParent(), 5); iEdit.setValidRange(1, 100); iEdit.setErrorMessage(Messages.getString("Accepted_Range_is__1_-_100_1")); iEdit.setEmptyStringAllowed(false); addField(iEdit); iEdit = new IntegerFieldEditor(IConstants.MAX_SQL_ROWS, Messages.getString("SQL_Limit_Rows_2"), getFieldEditorParent()); iEdit.setValidRange(100, 5000); iEdit.setErrorMessage(Messages.getString("Accepted_Range_is__100_-_5000_3")); addField(iEdit); BooleanFieldEditor bfe; addField(bfe = new BooleanFieldEditor(IConstants.AUTO_COMMIT, Messages.getString("GeneralPreferencePage.AutoCommit_1"), getFieldEditorParent())); final Button autoCommitBox = bfe.getCheckbox(); addField(bfe = new BooleanFieldEditor(IConstants.COMMIT_ON_CLOSE, Messages.getString("GeneralPreferencePage.Commit_On_Close_2"), getFieldEditorParent())); final Button commitOnCloseBox = bfe.getCheckbox(); /* * final Button autoCommitBox = new Button(getFieldEditorParent(), SWT.CHECK); * autoCommitBox.setText(Messages.getString("GeneralPreferencePage.AutoCommit_1")); * //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); * gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; * autoCommitBox.setLayoutData(gd); addAccessor(new * CheckBoxAccessor(IConstants.AUTO_COMMIT, autoCommitBox)); * * * final Button commitOnCloseBox = new Button(getFieldEditorParent(), SWT.CHECK); * commitOnCloseBox * .setText(Messages.getString("GeneralPreferencePage.Commit_On_Close_2")); * //$NON-NLS-1$ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = * GridData.BEGINNING; gd.horizontalSpan = 2; commitOnCloseBox.setLayoutData(gd); * addAccessor(new CheckBoxAccessor(IConstants.COMMIT_ON_CLOSE, commitOnCloseBox)); */ autoCommitBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (autoCommitBox.getSelection()) commitOnCloseBox.setEnabled(false); else commitOnCloseBox.setEnabled(true); } }); commitOnCloseBox.setEnabled(!autoCommitBox.getSelection()); addField(new BooleanFieldEditor(IConstants.SQL_ASSIST, Messages.getString( "GeneralPreferencePage.Tables_and_columns_auto-completing_assistance._Use_only_with_fast_database_connections_1"), getFieldEditorParent())); sEdit = new StringFieldEditor(IConstants.SQL_QRY_DELIMITER, Messages.getString("Preferences.SQLExplorer.QueryDelimiter"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(false); sEdit.setTextLimit(1); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.QueryDelimiter.Error")); addField(sEdit); if (sEdit.getStringValue() == null || sEdit.getStringValue().length() == 0) sEdit.loadDefault(); sEdit = new StringFieldEditor(IConstants.SQL_ALT_QRY_DELIMITER, Messages.getString("Preferences.SQLExplorer.AltQueryDelimiter"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(4); addField(sEdit); sEdit = new StringFieldEditor(IConstants.SQL_SL_COMMENT, Messages.getString("Preferences.SQLExplorer.SLComment"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(4); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.SLComment.Error")); addField(sEdit); if (sEdit.getStringValue() == null) sEdit.loadDefault(); sEdit = new StringFieldEditor(IConstants.SQL_ML_COMMENT_START, Messages.getString("Preferences.SQLExplorer.MLCommentStart"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(4); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.MLCommentStart.Error")); addField(sEdit); if (sEdit.getStringValue() == null) sEdit.loadDefault(); sEdit = new StringFieldEditor(IConstants.SQL_ML_COMMENT_END, Messages.getString("Preferences.SQLExplorer.MLCommentEnd"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(4); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.MLCommentEnd.Error")); addField(sEdit); if (sEdit.getStringValue() == null) sEdit.loadDefault(); sEdit = new StringFieldEditor(IConstants.SQL_QUOTE_ESCAPE_CHAR, Messages.getString("Preferences.SQLExplorer.QuoteEscapeChar"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(1); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.QuoteEscapeChar.Error")); addField(sEdit); if (sEdit.getStringValue() == null) sEdit.loadDefault(); addField(new BooleanFieldEditor(IConstants.WORD_WRAP, Messages.getString("Preferences.SQLExplorer.WordWrap"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.AUTO_OPEN_EDITOR, Messages.getString("Preferences.SQLExplorer.OpenEditorOnConnection"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.CLEAR_RESULTS_ON_EXECUTE, Messages.getString("Preferences.SQLExplorer.ClearResultsOnExecute"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.USE_LONG_CAPTIONS_ON_RESULTS, Messages.getString("Preferences.SQLExplorer.UseLongCaptionsOnResults"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.STOP_ON_ERROR, Messages.getString("Preferences.SQLExplorer.StopOnError"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.LOG_SUCCESS_MESSAGES, Messages.getString("Preferences.SQLExplorer.LogSuccessMessages"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.REQUIRE_SAVE_ON_CLOSE_EDITOR, Messages.getString("Preferences.SQLExplorer.RequireSaveOnClose"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.ENABLE_STRUCTURED_COMMENTS, Messages.getString("Preferences.SQLExplorer.EnableStructuredComments"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.WORD_WRAP, Messages.getString("Preferences.SQLExplorer.WordWrap"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.AUTO_OPEN_EDITOR, Messages.getString("Preferences.SQLExplorer.OpenEditorOnConnection"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.TREAT_NEW_AS_SCRATCH, Messages.getString("Preferences.SQLExplorer.TreatNewAsScratch"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.CLEAR_RESULTS_ON_EXECUTE, Messages.getString("Preferences.SQLExplorer.ClearResultsOnExecute"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.USE_LONG_CAPTIONS_ON_RESULTS, Messages.getString("Preferences.SQLExplorer.UseLongCaptionsOnResults"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.STOP_ON_ERROR, Messages.getString("Preferences.SQLExplorer.StopOnError"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.LOG_SUCCESS_MESSAGES, Messages.getString("Preferences.SQLExplorer.LogSuccessMessages"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.LOG_SQL_HISTORY, Messages.getString("Preferences.SQLExplorer.LogSQLHistory"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.REQUIRE_SAVE_ON_CLOSE_EDITOR, Messages.getString("Preferences.SQLExplorer.RequireSaveOnClose"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.ENABLE_STRUCTURED_COMMENTS, Messages.getString("Preferences.SQLExplorer.EnableStructuredComments"), getFieldEditorParent())); final String[][] DEBUG_LEVEL_VALUES = new String[][] { { Messages.getString("Preferences.SQLExplorer.DebugLevelOff"), IConstants.QUERY_DEBUG_OFF }, { Messages.getString("Preferences.SQLExplorer.DebugLevelFailed"), IConstants.QUERY_DEBUG_FAILED }, { Messages.getString("Preferences.SQLExplorer.DebugLevelAll"), IConstants.QUERY_DEBUG_ALL } }; ComboFieldEditor combo = new ComboFieldEditor(IConstants.QUERY_DEBUG_LOG_LEVEL, Messages.getString("Preferences.SQLExplorer.QueryDebugLog"), DEBUG_LEVEL_VALUES, getFieldEditorParent()); addField(combo); }
From source file:net.sourceforge.sqlexplorer.preferences.GeneralPreferencePage.java
License:Open Source License
protected void createFieldEditors() { IntegerFieldEditor iEdit;/*from w w w .j a v a 2 s . c om*/ StringFieldEditor sEdit; iEdit = new IntegerFieldEditor(IConstants.PRE_ROW_COUNT, Messages.getString("Preview_Max_Rows_3"), getFieldEditorParent(), 5); iEdit.setValidRange(1, 100); iEdit.setErrorMessage(Messages.getString("Accepted_Range_is__1_-_100_1")); iEdit.setEmptyStringAllowed(false); addField(iEdit); iEdit = new IntegerFieldEditor(IConstants.MAX_SQL_ROWS, Messages.getString("SQL_Limit_Rows_2"), getFieldEditorParent()); iEdit.setValidRange(100, 5000); iEdit.setErrorMessage(Messages.getString("Accepted_Range_is__100_-_5000_3")); addField(iEdit); BooleanFieldEditor bfe; addField(bfe = new BooleanFieldEditor(IConstants.AUTO_COMMIT, Messages.getString("GeneralPreferencePage.AutoCommit_1"), getFieldEditorParent())); final Button autoCommitBox = bfe.getCheckbox(); addField(bfe = new BooleanFieldEditor(IConstants.COMMIT_ON_CLOSE, Messages.getString("GeneralPreferencePage.Commit_On_Close_2"), getFieldEditorParent())); final Button commitOnCloseBox = bfe.getCheckbox(); /* final Button autoCommitBox = new Button(getFieldEditorParent(), SWT.CHECK); autoCommitBox.setText(Messages.getString("GeneralPreferencePage.AutoCommit_1")); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; autoCommitBox.setLayoutData(gd); addAccessor(new CheckBoxAccessor(IConstants.AUTO_COMMIT, autoCommitBox)); final Button commitOnCloseBox = new Button(getFieldEditorParent(), SWT.CHECK); commitOnCloseBox.setText(Messages.getString("GeneralPreferencePage.Commit_On_Close_2")); //$NON-NLS-1$ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalSpan = 2; commitOnCloseBox.setLayoutData(gd); addAccessor(new CheckBoxAccessor(IConstants.COMMIT_ON_CLOSE, commitOnCloseBox)); */ autoCommitBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (autoCommitBox.getSelection()) commitOnCloseBox.setEnabled(false); else commitOnCloseBox.setEnabled(true); } }); commitOnCloseBox.setEnabled(!autoCommitBox.getSelection()); addField(new BooleanFieldEditor(IConstants.SQL_ASSIST, Messages.getString( "GeneralPreferencePage.Tables_and_columns_auto-completing_assistance._Use_only_with_fast_database_connections_1"), getFieldEditorParent())); sEdit = new StringFieldEditor(IConstants.SQL_QRY_DELIMITER, Messages.getString("Preferences.SQLExplorer.QueryDelimiter"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(false); sEdit.setTextLimit(1); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.QueryDelimiter.Error")); addField(sEdit); if (sEdit.getStringValue() == null || sEdit.getStringValue().length() == 0) sEdit.loadDefault(); sEdit = new StringFieldEditor(IConstants.SQL_ALT_QRY_DELIMITER, Messages.getString("Preferences.SQLExplorer.AltQueryDelimiter"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(true); sEdit.setTextLimit(4); addField(sEdit); sEdit = new StringFieldEditor(IConstants.SQL_COMMENT_DELIMITER, Messages.getString("Preferences.SQLExplorer.CommentDelimiter"), getFieldEditorParent()); sEdit.setEmptyStringAllowed(false); sEdit.setTextLimit(4); sEdit.setErrorMessage(Messages.getString("Preferences.SQLExplorer.CommentDelimiter.Error")); addField(sEdit); if (sEdit.getStringValue() == null || sEdit.getStringValue().length() == 0) sEdit.loadDefault(); addField(new BooleanFieldEditor(IConstants.WORD_WRAP, Messages.getString("Preferences.SQLExplorer.WordWrap"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.AUTO_OPEN_EDITOR, Messages.getString("Preferences.SQLExplorer.OpenEditorOnConnection"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.CLEAR_RESULTS_ON_EXECUTE, Messages.getString("Preferences.SQLExplorer.ClearResultsOnExecute"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.USE_LONG_CAPTIONS_ON_RESULTS, Messages.getString("Preferences.SQLExplorer.UseLongCaptionsOnResults"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.STOP_ON_ERROR, Messages.getString("Preferences.SQLExplorer.StopOnError"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.LOG_SUCCESS_MESSAGES, Messages.getString("Preferences.SQLExplorer.LogSuccessMessages"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.REQUIRE_SAVE_ON_CLOSE_EDITOR, Messages.getString("Preferences.SQLExplorer.RequireSaveOnClose"), getFieldEditorParent())); addField(new BooleanFieldEditor(IConstants.ENABLE_STRUCTURED_COMMENTS, Messages.getString("Preferences.SQLExplorer.EnableStructuredComments"), getFieldEditorParent())); final String[][] DEBUG_LEVEL_VALUES = new String[][] { { Messages.getString("Preferences.SQLExplorer.DebugLevelOff"), IConstants.QUERY_DEBUG_OFF }, { Messages.getString("Preferences.SQLExplorer.DebugLevelFailed"), IConstants.QUERY_DEBUG_FAILED }, { Messages.getString("Preferences.SQLExplorer.DebugLevelAll"), IConstants.QUERY_DEBUG_ALL } }; ComboFieldEditor combo = new ComboFieldEditor(IConstants.QUERY_DEBUG_LOG_LEVEL, Messages.getString("Preferences.SQLExplorer.QueryDebugLog"), DEBUG_LEVEL_VALUES, getFieldEditorParent()); addField(combo); }
From source file:org.mwc.debrief.core.wizards.FlatFilenameWizardPage.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) *//*from ww w . j a v a2s . c om*/ 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); }