List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:com.puppetlabs.geppetto.module.dsl.ui.preferences.ForgePreferencesPage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(FORGE_LOCATION, "Module Forge Service URL", getFieldEditorParent())); addField(new StringFieldEditor(FORGE_LOGIN, "Module Forge Login", getFieldEditorParent()) { @Override/*from ww w . j av a 2 s.com*/ protected boolean checkState() { if (super.checkState()) { try { ModuleName.checkOwner(getStringValue(), true); return true; } catch (BadOwnerCharactersException e) { setErrorMessage(e.getMessage()); showErrorMessage(); } } return false; } }); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.preferences.PPEnvironmentPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { this.addField(new StringFieldEditor(getPreferenceId(), "Environment", getFieldEditorParent())); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.preferences.PPForgePreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(PPPreferenceConstants.FORGE_LOCATION, // "Module Forge Service URL", // getFieldEditorParent()));//from w ww .jav a2 s.c om addField(new StringFieldEditor(PPPreferenceConstants.FORGE_LOGIN, // "Module Forge Login", // getFieldEditorParent()) { @Override protected boolean checkState() { if (super.checkState()) { try { ModuleName.checkOwner(getStringValue(), true); return true; } catch (BadOwnerCharactersException e) { setErrorMessage(e.getMessage()); showErrorMessage(); } } return false; } }); }
From source file:com.python.pydev.analysis.ui.AnalysisPreferencesPage.java
License:Open Source License
@Override public void createFieldEditors() { final Composite initialParent = getFieldEditorParent(); Composite p = initialParent;// w w w . j a v a 2s . c om addField(new LabelFieldEditor("Analysis_pref_note", "NOTE: Any file with the comment below will not be analyzed.\n\n#@PydevCodeAnalysisIgnore\n\nOptions:\n\n", p)); TabFolder tabFolder = new TabFolder(p, SWT.NONE); tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); p = createTab(tabFolder, "Options"); String[][] whenAnalyze = new String[][] { { "Only on save", String.valueOf(IAnalysisPreferences.ANALYZE_ON_SAVE) }, { "On any successful parse", String.valueOf(IAnalysisPreferences.ANALYZE_ON_SUCCESFUL_PARSE) } }; addField(new BooleanFieldEditor(AnalysisPreferenceInitializer.DO_CODE_ANALYSIS, "Do code analysis?", BooleanFieldEditor.DEFAULT, p)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.WHEN_ANALYZE, "When do we analyze?", 2, whenAnalyze, p, true)); String[][] values = new String[][] { { "Error", String.valueOf(IMarker.SEVERITY_ERROR) }, { "Warning", String.valueOf(IMarker.SEVERITY_WARNING) }, { "Ignore", String.valueOf(IMarker.SEVERITY_INFO) } }; p = createTab(tabFolder, "Unused"); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_IMPORT, "Unused import", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_WILD_IMPORT, "Unused wild import", 3, values, p, true)); addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_IGNORE_UNUSED_IMPORT, "Don't report unused imports in modules named: (comma separated)", p)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_PARAMETER, "Unused parameter", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNUSED_VARIABLE, "Unused variable", 3, values, p, true)); addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_IGNORE_UNUSED_VARIABLE, "Don't report unused variable if name starts with: (comma separated)", p) { @Override public int getNumberOfControls() { return 1; } }); p = createTab(tabFolder, "Undefined"); addField(new StringFieldEditor(AnalysisPreferenceInitializer.NAMES_TO_CONSIDER_GLOBALS, "Consider the following names as globals: (comma separated)", p)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNDEFINED_VARIABLE, "Undefined variable", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNDEFINED_IMPORT_VARIABLE, "Undefined variable from import", 3, values, p, true)); p = createTab(tabFolder, "Imports"); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_REIMPORT, "Import redefinition", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_UNRESOLVED_IMPORT, "Import not found", 3, values, p, true)); p = createTab(tabFolder, "Others"); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_DUPLICATED_SIGNATURE, "Duplicated signature", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_NO_SELF, "'self' not specified in class method", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_NO_EFFECT_STMT, "Statement has no effect", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_INDENTATION_PROBLEM, "Indentation problems and mixing of tabs/spaces", 3, values, p, true)); addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_ASSIGNMENT_TO_BUILT_IN_SYMBOL, "Redefinition of builtin symbols", 3, values, p, true)); //TODO: Add ARGUMENTS_MISMATCH again later on //addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_ARGUMENTS_MISMATCH, "Arguments mismatch", 3,values,p, true)); p = createTab(tabFolder, "pep8.py"); String[][] pep8values = new String[][] { { "Error", String.valueOf(IMarker.SEVERITY_ERROR) }, { "Warning", String.valueOf(IMarker.SEVERITY_WARNING) }, { "Don't run", String.valueOf(IMarker.SEVERITY_INFO) } }; addField(new RadioGroupFieldEditor(AnalysisPreferenceInitializer.SEVERITY_PEP8, "Pep8", 3, pep8values, p, true) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, 3); adjustForNumColumns(3); } }); if (SHOW_IN_PEP8_FEATURE_ENABLED) { addField(new BooleanFieldEditor(USE_PEP8_CONSOLE, "Redirect pep8 output to console?", p) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, 3); adjustForNumColumns(3); } }); } addField(new BooleanFieldEditor(PEP8_USE_SYSTEM, "Use system interpreter", p) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, 3); adjustForNumColumns(3); } }); addField(new LinkFieldEditor(PEP8_COMMAND_LINE, "Additional command line arguments (i.e.: --ignore=E5,W391). See <a>pep8 docs</a> for details.", p, new SelectionListener() { public void widgetSelected(SelectionEvent e) { Program.launch("http://pypi.python.org/pypi/pep8"); } public void widgetDefaultSelected(SelectionEvent e) { } }) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { numColumns = 3; Link linkControl = getLinkControl(parent); Object layoutData = linkControl.getLayoutData(); if (layoutData == null) { layoutData = new GridData(); linkControl.setLayoutData(layoutData); } ((GridData) layoutData).horizontalSpan = numColumns; adjustForNumColumns(3); } }); addField(new StringFieldEditor(PEP8_COMMAND_LINE, "Arguments: ", p) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, 3); adjustForNumColumns(3); } }); addField(new ScopedPreferencesFieldEditor(initialParent, PyAnalysisScopedPreferences.ANALYSIS_SCOPE, this)); }
From source file:com.safi.workshop.sqlexplorer.preferences.GeneralPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { IntegerFieldEditor iEdit;// w w w. j a v a 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: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);//from w w w .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);/* w ww . ja v a 2 s . c om*/ 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:com.siemens.ct.mp3m.ui.wizards.AlbumRenamePage.java
License:Open Source License
public void createControl(Composite parent) { // create the composite to hold the widgets Composite composite = new Composite(parent, SWT.NONE); // create the desired layout for this wizard page GridLayout gl = new GridLayout(2, false); composite.setLayout(gl);/*from ww w . ja v a 2 s . c o m*/ // artist artist = new StringFieldEditor("Artist", Messages.getString("AlbumRenamePage.artist"), composite);//$NON-NLS-1$ artist.setEnabled(false, composite); // old name oldName = new StringFieldEditor("Old Name", Messages.getString("AlbumRenamePage.oldName"), composite);//$NON-NLS-1$ oldName.setEnabled(false, composite); // new name newName = new StringFieldEditor("New Name", Messages.getString("AlbumRenamePage.newName"), composite);//$NON-NLS-1$ newName.getTextControl(composite).addKeyListener(this); // set the composite as the control for this page setControl(composite); }
From source file:com.softberries.klerk.preferences.CompanyDetailsPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(IPreferencesKeys.COMPANY_NAME, "Company Name:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_VATID, "Vat ID:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_COUNTRY, "Country:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_CITY, "City:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_STREET, "Street:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_HOUSENR, "House Nr:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_FLATNR, "Flat Nr:", getFieldEditorParent())); addField(new StringFieldEditor(IPreferencesKeys.COMPANY_POSTCODE, "Post Code:", getFieldEditorParent())); }
From source file:com.softberries.klerk.preferences.DatabasePreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor("DB_URL", Messages.DatabasePreferencePage_database_url, //$NON-NLS-1$ getFieldEditorParent()));// w w w .j a v a 2s. c om addField(new StringFieldEditor("DB_NAME", Messages.DatabasePreferencePage_database_name, //$NON-NLS-1$ getFieldEditorParent())); addField(new StringFieldEditor("DB_USERNAME", Messages.DatabasePreferencePage_database_username, //$NON-NLS-1$ getFieldEditorParent())); sfePass = new StringFieldEditor("DB_PASSWORD", Messages.DatabasePreferencePage_database_password, //$NON-NLS-1$ getFieldEditorParent()); sfePass.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(sfePass); }