List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:com.sonatype.buildserver.eclipse.ui.prefs.PreferencePage.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 v a2 s . c om*/ */ public void createFieldEditors() { ed = new BooleanFieldEditor(PreferenceConstants.PREF_TRIGGERED_BY_USER_ONLY, "&Only notify incoming builds triggered by current user", getFieldEditorParent()); addField(ed); subEd = new StringFieldEditor(PreferenceConstants.PREF_SCM_USERNAMES, "Comma-separated list of scm user names to match:", getFieldEditorParent()) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { // TODO Auto-generated method stub super.doFillIntoGrid(parent, numColumns); Label lbl = this.getLabelControl(); GridData gd = new GridData(); gd.horizontalIndent = 24; lbl.setLayoutData(gd); } }; subEd.setEnabled(HudsonUIActivator.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.PREF_TRIGGERED_BY_USER_ONLY), getFieldEditorParent()); addField(subEd); addField(new BooleanFieldEditor(PreferenceConstants.PREF_SHOW_MESSAGE, "&Show a messagebox for incoming builds when IDE not active", getFieldEditorParent()) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); Button lbl = this.getChangeControl(parent); GridData gd = (GridData) lbl.getLayoutData(); gd.verticalIndent = 24; } }); }
From source file:com.subgraph.vega.application.preferences.VegaSocksPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { enableField = new BooleanFieldEditor(P_SOCKS_ENABLED, "Enable SOCKS proxy", getFieldEditorParent()); addField(enableField);//w w w .j a v a 2 s .co m addressField = new StringFieldEditor(P_SOCKS_ADDRESS, "SOCKS Proxy Address", getFieldEditorParent()); addressField.setEmptyStringAllowed(false); addField(addressField); portField = new IntegerFieldEditor(P_SOCKS_PORT, "Socks Proxy Port", getFieldEditorParent()); portField.setValidRange(1, 65535); portField.setTextLimit(5); addField(portField); setEnableState(getPreferenceStore().getBoolean(P_SOCKS_ENABLED)); }
From source file:com.symbian.genericEditorUtils.preferences.GenericEditorsPreferencePage.java
License:Open Source License
@Override public void createFieldEditors() { Composite lParent = getFieldEditorParent(); lParent.setLayout(new GridLayout(1, false)); lParent.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite lStringComposite = new Composite(lParent, SWT.NONE); lStringComposite.setLayout(new GridLayout(2, false)); lStringComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new StringFieldEditor(PreferenceConstants.TEST_DATA, "Test Data on Device", lStringComposite); new BooleanFieldEditor(PreferenceConstants.COMMENT_ABOVE, "Comments attached to above element", lParent); lParent.pack();/*from w w w . j a va 2s. co m*/ }
From source file:com.symbian.tdep.templates.carbide.preferences.PatternPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { classNamePattern = new StringFieldEditor(PreferenceConstants.CLASS_WRAPPER_PATTERN, "Wrapper Class Name Template", getFieldEditorParent()) { protected boolean doCheckState() { String className = getTextControl().getText(); if (!className.contains("${className}")) { setErrorMessage("Wrapper Class Name Template should include \"${className}\"."); return false; }//from w ww . j ava 2 s . c o m if (!className.replace("${className}", "A").matches("^[A-Za-z]+[\\w]*$")) { setErrorMessage("Illegal character contained."); return false; } return true; } }; methodNamePattern = new StringFieldEditor(PreferenceConstants.METHOD_WRAPPER_PATTERN, "Wrapper Method Name Template", getFieldEditorParent()) { protected boolean doCheckState() { String methodName = getTextControl().getText(); if (!methodName.contains("${methodName}")) { setErrorMessage("Wrapper Method Name Template should include \"${methodName}\"."); return false; } if (!methodName.replace("${methodName}", "M").matches("^[A-Za-z]+[\\w]*$")) { setErrorMessage("Illegal character contained."); return false; } return true; } }; classNamePattern.setEmptyStringAllowed(false); methodNamePattern.setEmptyStringAllowed(false); addField(classNamePattern); addField(methodNamePattern); }
From source file:com.tetrade.eclipse.plugins.easyshell.preferences.EasyShellPreferencePage.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 .ja v a 2 s.c om */ protected Control createContents(Composite parent) { IPreferenceStore store = getPreferenceStore(); Composite mainColumn = new Composite(parent, SWT.NONE); GridLayout mainLayout = new GridLayout(1, false); mainColumn.setFont(parent.getFont()); mainColumn.setLayout(mainLayout); Composite targetColumn = new Composite(mainColumn, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; layout.marginHeight = 0; targetColumn.setFont(parent.getFont()); targetColumn.setLayout(layout); Label label = new Label(targetColumn, 0); label.setText("Presets"); targetCombo = new Combo(targetColumn, SWT.READ_ONLY | SWT.DROP_DOWN); for (int i = 0; i < cmdLabels.length; i++) { targetCombo.add(cmdLabels[i]); } targetCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { refreshTarget(); } }); targetCombo.select(store.getInt(P_LIST)); targetOpenEditor = new StringFieldEditor(P_TARGET, "&Shell Open command:", targetColumn); if (debug) System.out.println("Value: " + store.getString(P_TARGET)); if (debug) System.out.println("Default: " + store.getDefaultString(P_TARGET)); targetOpenEditor.setStringValue(store.getString(P_TARGET)); targetRunEditor = new StringFieldEditor(P_TARGET_RUN, "&Shell Run command:", targetColumn); if (debug) System.out.println("Value: " + store.getString(P_TARGET_RUN)); if (debug) System.out.println("Default: " + store.getDefaultString(P_TARGET_RUN)); targetRunEditor.setStringValue(store.getString(P_TARGET_RUN)); targetExploreEditor = new StringFieldEditor(P_TARGET_EXPLORE, "&Explore command:", targetColumn); if (debug) System.out.println("Value: " + store.getString(P_TARGET_EXPLORE)); if (debug) System.out.println("Default: " + store.getDefaultString(P_TARGET_EXPLORE)); targetExploreEditor.setStringValue(store.getString(P_TARGET_EXPLORE)); targetCopyPathEditor = new StringFieldEditor(P_TARGET_COPYPATH, "Copy Path string:", targetColumn); if (debug) System.out.println("Value: " + store.getString(P_TARGET_COPYPATH)); if (debug) System.out.println("Default: " + store.getDefaultString(P_TARGET_COPYPATH)); targetCopyPathEditor.setStringValue(store.getString(P_TARGET_COPYPATH)); label = new Label(mainColumn, 0); label.setText("Argument {0} is the drive letter on Win32."); label = new Label(mainColumn, 0); label.setText("Argument {1} is the parent path."); label = new Label(mainColumn, 0); label.setText("Argument {2} is the full path."); label = new Label(mainColumn, 0); label.setText("Argument {3} is the file name."); label = new Label(mainColumn, 0); label.setText("Argument {4} is the project name."); label = new Label(mainColumn, 0); label.setText("Argument {5} is the line separator."); return mainColumn; }
From source file:com.twinsoft.convertigo.eclipse.preferences.StudioPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { Composite top = new Composite(parent, SWT.NONE); top.setLayout(new GridLayout(1, false)); // General options Group groupGeneral = new Group(top, SWT.SHADOW_IN); groupGeneral.setText("General options"); groupGeneral.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); intTracePlayerPort = new IntegerFieldEditor(ConvertigoPlugin.PREFERENCE_TRACEPLAYER_PORT, "Trace player listening port", groupGeneral); intTracePlayerPort.setPage(this); intTracePlayerPort.setPreferenceStore(getPreferenceStore()); intTracePlayerPort.load();//from w w w . ja v a2s . c o m cbHighlight = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_TREE_HIGHLIGHT_DETECTED, "Highlight detected objects in tree", groupGeneral); cbHighlight.setPage(this); cbHighlight.setPreferenceStore(getPreferenceStore()); cbHighlight.load(); cbIgnoreNews = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_IGNORE_NEWS, "Automatically dismiss the splashscreen", groupGeneral); cbIgnoreNews.setPage(this); cbIgnoreNews.setPreferenceStore(getPreferenceStore()); cbIgnoreNews.load(); cbShowEngineOnConsole = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_SHOW_ENGINE_INTO_CONSOLE, "Show Engine logs into Console view", groupGeneral); cbShowEngineOnConsole.setPage(this); cbShowEngineOnConsole.setPreferenceStore(getPreferenceStore()); cbShowEngineOnConsole.load(); cbEngineLoadAllProjects = new BooleanFieldEditor(ConvertigoPlugin.PREFERENCE_ENGINE_LOAD_ALL_PROJECTS, "Engine loads all projects even if closed", groupGeneral); cbEngineLoadAllProjects.setPage(this); cbEngineLoadAllProjects.setPreferenceStore(getPreferenceStore()); cbEngineLoadAllProjects.load(); // Diagnostics Group groupDiagnostics = new Group(top, SWT.SHADOW_IN); groupDiagnostics.setText("Diagnostics"); comboLevel = new ComboFieldEditor(ConvertigoPlugin.PREFERENCE_LOG_LEVEL, "Trace level", new String[][] { { "Errors", "0" }, { "Exceptions", "1" }, { "Warnings", "2" }, { "Messages", "3" }, { "Debug", "4" }, { "Debug+", "5" }, { "Debug++", "6" } }, groupDiagnostics); comboLevel.setPage(this); comboLevel.setPreferenceStore(getPreferenceStore()); comboLevel.load(); Group groupLocalBuild = new Group(top, SWT.SHADOW_IN); groupLocalBuild.setText("Local Build"); groupLocalBuild.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); localBuildAdditionalPath = new StringFieldEditor(ConvertigoPlugin.PREFERENCE_LOCAL_BUILD_ADDITIONAL_PATH, "Additional PATH (folders separated by '" + File.pathSeparator + "')", groupLocalBuild); localBuildAdditionalPath.setPage(this); localBuildAdditionalPath.setPreferenceStore(getPreferenceStore()); localBuildAdditionalPath.load(); BooleanFieldEditor btest = new BooleanFieldEditor("", "", groupLocalBuild); btest.getDescriptionControl(groupLocalBuild).setVisible(false); return top; }
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./* ww w . j av a 2s.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:com.vectrace.MercurialEclipse.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 w w.j av a 2 s . co m*/ @Override public void createFieldEditors() { File integratedHgExecutable = PreferenceInitializer.getIntegratedHgExecutable(); if (integratedHgExecutable != null) { addField(new BooleanFieldEditor(USE_BUILT_IN_HG_EXECUTABLE, "Use default (built-in) Mercurial executable", getFieldEditorParent()) { @Override protected void fireValueChanged(String property, Object oldValue, Object newValue) { super.fireValueChanged(property, oldValue, newValue); if (newValue instanceof Boolean) { enablePathEditor(!((Boolean) newValue).booleanValue()); } } @Override protected void doLoadDefault() { super.doLoadDefault(); enablePathEditor(!getBooleanValue()); } }); } execField = new MercurialExecutableFileFieldEditor(MERCURIAL_EXECUTABLE, Messages.getString("GeneralPreferencePage.field.hgExecutable"), getFieldEditorParent()); addField(execField); execField.setEmptyStringAllowed(false); if (!MercurialEclipsePlugin.getDefault().isHgUsable()) { execField.setErrorMessage(Messages.getString("GeneralPreferencePage.error.HgNotInstalled")); //$NON-NLS-1$ } if (integratedHgExecutable != null && getPreferenceStore().getBoolean(USE_BUILT_IN_HG_EXECUTABLE)) { execField.setEnabled(false, getFieldEditorParent()); } addField(new GpgExecutableFileFieldEditor(GPG_EXECUTABLE, Messages.getString("GeneralPreferencePage.field.gpgExecutable"), getFieldEditorParent())); //$NON-NLS-1$ addField(new StringFieldEditor(MERCURIAL_USERNAME, Messages.getString("GeneralPreferencePage.field.username"), getFieldEditorParent())); //$NON-NLS-1$ addField(new BooleanFieldEditor(PREF_USE_MERCURIAL_USERNAME, "Prefer 'username' value from .hgrc as default user name", getFieldEditorParent())); //$NON-NLS-1$ addField(new BooleanFieldEditor(PREF_DEFAULT_REBASE_KEEP_BRANCHES, "Default to 'Retain the branch name' for Rebase command", getFieldEditorParent())); //$NON-NLS-1$ addField(new BooleanFieldEditor(PREF_USE_EXTERNAL_MERGE, Messages.getString("GeneralPreferencePage.useExternalMergeTool"), getFieldEditorParent())); //$NON-NLS-1$ BooleanFieldEditor editor = new BooleanFieldEditor(PREF_PUSH_NEW_BRANCH, Messages.getString("GeneralPreferencePage.pushNewBranches"), getFieldEditorParent()); addField(editor); addField(new BooleanFieldEditor(PREF_AUTO_SHARE_PROJECTS, Messages.getString("GeneralPreferencePage.autoshare"), //$NON-NLS-1$ getFieldEditorParent())); BooleanFieldEditor cert_editor = new BooleanFieldEditor(PREF_VERIFY_SERVER_CERTIFICATE, Messages.getString("GeneralPreferencePage.verifyServerCertificate"), //$NON-NLS-1$ getFieldEditorParent()); addField(cert_editor); }
From source file:com.vectrace.MercurialEclipse.preferences.LabelDecorationsPreferencePage.java
License:Open Source License
/** * @param parent// w w w .ja v a 2 s .c o m */ private void createProjectLabelsGroup(Composite parent) { Group syntaxGroup = createGroup(parent, 1, Messages.getString("LabelDecorationsPreferencePage.syntaxGroup.description")); //$NON-NLS-1$ /* * We use this box to contain all widgets so that the horizontal indentation yields a left * alignment with controls in the radiobuttons group. */ Composite box = new Composite(syntaxGroup, SWT.NONE); GridData boxGd = new GridData(GridData.FILL_HORIZONTAL); // Recheck whether necessary. box.setLayoutData(boxGd); addField(new BooleanFieldEditor(RESOURCE_DECORATOR_SHOW_CHANGESET_IN_PROJECT_LABEL, Messages.getString("LabelDecorationsPreferencePage.showChangesetInfoOnContainer"), //$NON-NLS-1$ box)); addField(new BooleanFieldEditor(PREF_SHOW_LOGICAL_NAME_OF_REPOSITORIES, Messages.getString("LabelDecorationsPreferencePage.showLogicalNameOfRepositories"), //$NON-NLS-1$ box)); /* * Contains the label and text editor on the first row, then the preview label and text on * the second row, then the Reset button on the third one. */ Composite syntaxEditComposite = SWTWidgetHelper.createComposite(box, 2); GridData secGd = (GridData) syntaxEditComposite.getLayoutData(); secGd.grabExcessHorizontalSpace = true; syntaxField = new StringFieldEditor(PREF_DECORATE_PROJECT_LABEL_SYNTAX, Messages.getString("LabelDecorationsPreferencePage.syntaxGroup.syntax"), //$NON-NLS-1$ syntaxEditComposite) { /** * @see org.eclipse.jface.preference.FieldEditor#fireValueChanged(java.lang.String, * java.lang.Object, java.lang.Object) */ @Override protected void fireValueChanged(String property, Object oldVal, Object newVal) { super.fireValueChanged(property, oldVal, newVal); updatePreview(); } @Override protected void doLoadDefault() { super.doLoadDefault(); updatePreview(); } }; addField(syntaxField); @SuppressWarnings("unused") Label previewTitle = SWTWidgetHelper.createLabel(syntaxEditComposite, "Preview"); previewStaticField = SWTWidgetHelper.createLabel(syntaxEditComposite, "Example preview text"); Button resetBtn = SWTWidgetHelper.createPushButton(box, Messages.getString("LabelDecorationsPreferencePage.syntaxGroup.reset"), 2); //$NON-NLS-1$ resetBtn.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { syntaxField.setStringValue(HgDecoratorConstants.DEFAULT_PROJECT_SYNTAX); } public void widgetDefaultSelected(SelectionEvent e) { syntaxField.setStringValue(HgDecoratorConstants.DEFAULT_PROJECT_SYNTAX); } }); // Align the button to the right. GridData gd = (GridData) resetBtn.getLayoutData(); gd.horizontalAlignment = SWT.RIGHT; }
From source file:com.vectrace.MercurialEclipse.repository.RepoPropertiesPage.java
License:Open Source License
@Override protected void createFieldEditors() { IHgRepositoryLocation location = getLocation(); boolean editable = location != null && !location.isLocal(); StringFieldEditor locationEditor = new StringFieldEditor(KEY_LOCATION, "Location", getFieldEditorParent()); addField(locationEditor);/*from w w w .j a v a2 s . co m*/ locationEditor.getTextControl(getFieldEditorParent()).setEditable(false); StringFieldEditor logicalNameEditor = new StringFieldEditor(KEY_LNAME, "Logical Name", getFieldEditorParent()); addField(logicalNameEditor); logicalNameEditor.getTextControl(getFieldEditorParent()).setEditable(editable); StringFieldEditor nameEditor = new StringFieldEditor(KEY_LOGIN_NAME, "Login", getFieldEditorParent()); addField(nameEditor); nameEditor.getTextControl(getFieldEditorParent()).setEditable(editable); StringFieldEditor pwdEditor = new StringFieldEditor(KEY_LOGIN_PWD, "Password", getFieldEditorParent()); pwdEditor.getTextControl(getFieldEditorParent()).setEchoChar('*'); pwdEditor.getTextControl(getFieldEditorParent()).setEditable(editable); addField(pwdEditor); }