List of usage examples for org.eclipse.jface.preference StringFieldEditor setEmptyStringAllowed
public void setEmptyStringAllowed(boolean b)
From source file:br.com.tecsinapse.glimpse.preferences.GlimpsePreferencePage.java
License:Apache License
@Override protected void createFieldEditors() { StringFieldEditor urlEditor = new StringFieldEditor(GlimpsePreferenceConstants.URL, "Url", getFieldEditorParent());//from ww w . j ava 2 s . c o m urlEditor.setEmptyStringAllowed(false); urlText = urlEditor.getTextControl(getFieldEditorParent()); urlText.setToolTipText("Use the arrow keys (UP and DOWN) to get previous urls"); urlText.addListener(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { switch (e.keyCode) { case SWT.ARROW_DOWN: urlText.setText(selectNextUrl(urlText.getText())); break; case SWT.ARROW_UP: urlText.setText(selectPreviousUrl(urlText.getText())); break; } } }); addField(urlEditor); addField(new StringFieldEditor(GlimpsePreferenceConstants.USERNAME, "User name", getFieldEditorParent())); addField(new StringFieldEditor(GlimpsePreferenceConstants.PASSWORD, "Password", getFieldEditorParent())); addField(new ComboFieldEditor(GlimpsePreferenceConstants.CONSOLE_TYPE, "Console type", new String[][] { { "Glimpse", "GLIMPSE" }, { "Eclipse", "ECLIPSE" } }, getFieldEditorParent())); }
From source file:ch.uzh.ifi.seal.permo.lib.ui.swt.builder.StringFieldEditorBuilder.java
License:Apache License
public StringFieldEditor create() { final StringFieldEditor stringFieldEditor = optionalValidation.isPresent() ? createWithValidation() : createWihtoutValidation(); stringFieldEditor.setEmptyStringAllowed(emptyStringAllowed); return stringFieldEditor; }
From source file:com.google.devtools.depan.maven.eclipse.preferences.AnalysisPreferencesPage.java
License:Apache License
@Override protected void createFieldEditors() { Composite parent = getFieldEditorParent(); FileFieldEditor executable = new FileFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EXECUTABLE, "Maven Executable", true, parent); executable.setEmptyStringAllowed(false); BooleanFieldEditor systemjava = new BooleanFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA, "Use System JAVA_HOME", BooleanFieldEditor.SEPARATE_LABEL, parent); final DirectoryFieldEditor javahome = new DirectoryFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME, "JAVA_HOME", parent); StringFieldEditor effectivepom = new StringFieldEditor(AnalysisPreferenceIds.MVN_ANALYSIS_EFFECTIVEPOM, "Maven Effective POM command", parent); effectivepom.setEmptyStringAllowed(false); addField(executable);// ww w .j a v a 2 s. co m addField(systemjava); addField(javahome); addField(effectivepom); }
From source file:com.prodyna.bamboo.status.preferences.BambooPreferencePage.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 ava2 s . c om*/ */ public void createFieldEditors() { StringFieldEditor host = new StringFieldEditor(PreferenceConstants.P_BAMBOO_BASE_URL, "Bamboo Host:", getFieldEditorParent()); StringFieldEditor username = new StringFieldEditor(PreferenceConstants.P_BAMBOO_USERNAME, "Benutzername:", getFieldEditorParent()); StringFieldEditor password = new StringFieldEditor(PreferenceConstants.P_BAMBOO_PASSWORD, "Passwort:", getFieldEditorParent()); host.setEmptyStringAllowed(false); username.setEmptyStringAllowed(false); password.setEmptyStringAllowed(false); password.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(host); addField(username); addField(password); addField(new ProjectFieldEditor(PreferenceConstants.P_BAMBOO_PROJECTS, "Status relevant Projects:", getFieldEditorParent(), host, username, password)); addField(new StringFieldEditor(PreferenceConstants.P_BAMBOO_EXCLUDE_PLANS, "Exclude Plans (,):", getFieldEditorParent())); }
From source file:com.safi.workshop.sqlexplorer.preferences.GeneralPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { IntegerFieldEditor iEdit;//from w w w. java2 s .c o 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.ultimatetech.cim.preferences.CIMPreferencePage.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 www . java 2 s .c om */ public void createFieldEditors() { StringFieldEditor sfe = new StringFieldEditor(PreferenceConstants.P_STRING, "CIM &Host:", getFieldEditorParent()); sfe.setEmptyStringAllowed(false); sfe.setPreferenceName(PreferenceNames.CIM_HOST); addField(sfe); sfe = new StringFieldEditor(PreferenceConstants.P_STRING, "CIM &Port:", getFieldEditorParent()); sfe.setEmptyStringAllowed(false); sfe.setPreferenceName(PreferenceNames.CIM_PORT); addField(sfe); sfe = new StringFieldEditor(PreferenceConstants.P_STRING, "CIM &Name Space:", getFieldEditorParent()); sfe.setEmptyStringAllowed(false); sfe.setPreferenceName(PreferenceNames.CIM_NAMESPACE); addField(sfe); RadioGroupFieldEditor rfe = new RadioGroupFieldEditor( PreferenceConstants.P_CHOICE, "Protocol", 1, new String[][] { { "http/XML", "http" }, { "https/XML", "https" }, { CIMClient.CIM_RMI, CIMClient.CIM_RMI } }, getFieldEditorParent()); rfe.setPreferenceName(PreferenceNames.IS_SECURE); addField(rfe); sfe = new StringFieldEditor(PreferenceConstants.P_STRING, "CIM Class Name &Filter:", getFieldEditorParent()); sfe.setEmptyStringAllowed(true); sfe.setPreferenceName(PreferenceNames.CIM_FILTER); addField(sfe); }
From source file:net.sf.gted.editor.preferences.EditorPreferencePage.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 w w.j a va 2 s . co m @Override public void createFieldEditors() { RadioGroupFieldEditor orientationPref = new RadioGroupFieldEditor(PreferenceConstants.P_ORIENTATION, "Editor orientation", 2, new String[][] { { "&Horizontal", PreferenceConstants.P_ORIENTATION_HORIZONTAL }, { "&Vertical", PreferenceConstants.P_ORIENTATION_VERTICAL } }, this.getFieldEditorParent(), true); this.addField(orientationPref); RadioGroupFieldEditor editorPref = new RadioGroupFieldEditor(PreferenceConstants.P_EDITOR_VIEW, "Inital editor view", 2, new String[][] { { "&Rich user interface", PreferenceConstants.P_EDITOR_VIEW_UI }, { "&Source editor", PreferenceConstants.P_EDITOR_VIEW_SOURCE } }, this.getFieldEditorParent(), true); this.addField(editorPref); ComboFieldEditor untranslatedPref = new ComboFieldEditor(PreferenceConstants.P_UNTRANSLATED, "If PO file contains untranslated entries ", namesAndValues, this.getFieldEditorParent()); this.addField(untranslatedPref); ComboFieldEditor fuzzyPref = new ComboFieldEditor(PreferenceConstants.P_FUZZY, "If PO file contains fuzzy entries ", namesAndValues, this.getFieldEditorParent()); this.addField(fuzzyPref); StringFieldEditor sourceRefPrefixPref = new StringFieldEditor(PreferenceConstants.P_SOURCE_REFERENCE_PREFIX, "Source reference prefix\ne.g. src/main, (use forward slashes)", this.getFieldEditorParent()); sourceRefPrefixPref.setEmptyStringAllowed(true); this.addField(sourceRefPrefixPref); }
From source file:net.sourceforge.sqlexplorer.preferences.GeneralPreferencePage.java
License:Open Source License
protected void createFieldEditors() { IntegerFieldEditor iEdit;//from ww w.java 2 s . c o 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() { 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.amanzi.neo.loader.ui.preferences.internal.AbstractDatasetSynonymsPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { for (Entry<INodeType, List<Synonyms>> entry : SynonymsManager.getInstance().getSynonyms(getDatasetType()) .entrySet()) {/*from w ww . j a v a 2 s .c o m*/ INodeType nodeType = entry.getKey(); Group group = new Group(getFieldEditorParent(), SWT.NONE); group.setText(nodeType.getId()); group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); for (Synonyms synonym : entry.getValue()) { StringFieldEditor synonymsEditor = new StringFieldEditor( getSynonymsKey(nodeType, synonym.getPropertyName()), synonym.getPropertyName(), group); synonymsEditor.setEmptyStringAllowed(false); addField(synonymsEditor); } } }
From source file:org.eclipse.linuxtools.systemtap.ui.logging.preferences.LoggingPreferencePage.java
License:Open Source License
public void createFieldEditors() { BooleanFieldEditor logging = new BooleanFieldEditor(PreferenceConstants.P_LOG_ENABLED, Localization.getString("LoggingPreferencePage.EnableLogging"), getFieldEditorParent()); String[] debugLevel = { Localization.getString("LoggingPreferencePage.Debug"), "" + LogManager.DEBUG }; String[] infoLevel = { Localization.getString("LoggingPreferencePage.Info"), "" + LogManager.INFO }; String[] criticalLevel = { Localization.getString("LoggingPreferencePage.Critical"), "" + LogManager.CRITICAL }; String[] fatalLevel = { Localization.getString("LoggingPreferencePage.Fatal"), "" + LogManager.FATAL }; String[][] levels = { debugLevel, infoLevel, criticalLevel, fatalLevel }; ComboFieldEditor level = new ComboFieldEditor(PreferenceConstants.P_LOG_LEVEL, Localization.getString("LoggingPreferencePage.LoggingLevel"), levels, getFieldEditorParent()); RadioGroupFieldEditor loggingType = new RadioGroupFieldEditor(PreferenceConstants.P_LOG_TYPE, Localization.getString("LoggingPreferencePage.LogTo"), 1, new String[][] { { Localization.getString("LoggingPreferencePage.Console"), "" + LogManager.CONSOLE }, { Localization.getString("LoggingPreferencePage.File"), "" + LogManager.FILE } }, getFieldEditorParent());//from www. j av a 2 s . c o m StringFieldEditor file = new StringFieldEditor(PreferenceConstants.P_LOG_FILE, Localization.getString("LoggingPreferencePage.File"), getFieldEditorParent()); file.setEmptyStringAllowed(true); this.addField(logging); this.addField(level); this.addField(loggingType); this.addField(file); }