List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:org.eclipse.ui.internal.ide.dialogs.IDEWorkspacePreferencePage.java
License:Open Source License
/** * Create a composite that contains entry fields specifying the workspace name * preference./*from w w w . j a va 2 s . c o m*/ * * @param composite the Composite the group is created in. */ private void createWindowTitleGroup(Composite composite) { Composite groupComposite = new Composite(composite, SWT.LEFT); GridLayout layout = new GridLayout(); layout.numColumns = 2; groupComposite.setLayout(layout); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; groupComposite.setLayoutData(gd); workspaceName = new StringFieldEditor(IDEInternalPreferences.WORKSPACE_NAME, IDEWorkbenchMessages.IDEWorkspacePreference_workspaceName, groupComposite); workspaceName.setPreferenceStore(getIDEPreferenceStore()); workspaceName.load(); workspaceName.setPage(this); }
From source file:org.eclipse.ui.tests.dialogs.EnableTestPreferencePage.java
License:Open Source License
/** * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() *///from w ww . ja v a2 s. c o m protected void createFieldEditors() { String[][] labelsAndValues = new String[][] { { "Label 1", "Value 1" }, { "Label 2", "Value 2" } }; beParent = getFieldEditorParent(); be = new BooleanFieldEditor("BooleanValue", "BooleanTest", beParent); addField(be); ceParent = getFieldEditorParent(); ce = new ColorFieldEditor("ColorValue", "Color Test", ceParent); addField(ce); feParent = getFieldEditorParent(); fe = new FontFieldEditor("FontValue", "Font Test", feParent); addField(fe); peParent = getFieldEditorParent(); pe = new PathEditor("PathValue", "Path Test", "C:\temp", peParent); addField(pe); rgParent = getFieldEditorParent(); rg = new RadioGroupFieldEditor("Radio Value", "Radio Test", 2, labelsAndValues, rgParent); addField(rg); seParent = getFieldEditorParent(); se = new StringFieldEditor("String Value", "String Editor", seParent); addField(se); }
From source file:org.eclipse.umlgen.gen.c.ui.UML2CPropertyPage.java
License:Open Source License
/** * Creates the string button field editor for selecting one model element among a set. * * @param parent//from ww w . j a v a 2s.c o m * The parent composite hosting this field editor. * @param key * The key to retrieve value inside the preference store. * @param label * The label to display before the text field. * @return The string button field editor. */ protected StringFieldEditor createStringFieldEditor(Composite parent, String key, String label) { StringFieldEditor fieldEditor = new StringFieldEditor(key, label, parent); fieldEditor.setPage(this); fieldEditor.setPreferenceStore(getPreferenceStore()); return fieldEditor; }
From source file:org.eclipse.vorto.repository.preferences.RemoteRepositoryPreferencePage.java
License:Open Source License
public void createFieldEditors() { addField(new StringFieldEditor(ConnectionInfoPreferences.P_REMOTE_REPO_URL, "&URL:", getFieldEditorParent()));//from w w w . j a v a2 s . c o m addField(new StringFieldEditor(ConnectionInfoPreferences.P_USER_REPO, "&User:", getFieldEditorParent())); addField(new StringFieldEditor(ConnectionInfoPreferences.P_PASS_REPO, "&Password", getFieldEditorParent()) { @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); getTextControl().setEchoChar('*'); } }); }
From source file:org.eclipse.wb.internal.core.preferences.ParsingPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { m_hideBeginEditor = new StringFieldEditor(P_CODE_HIDE_BEGIN, UiMessages.ParsingPreferencePage_hideBlockBegin, getFieldEditorParent()); m_hideEndEditor = new StringFieldEditor(P_CODE_HIDE_END, UiMessages.ParsingPreferencePage_hideBlockEnd, getFieldEditorParent());/* w w w.j a va 2s. co m*/ m_hideLineEditor = new StringFieldEditor(P_CODE_HIDE_LINE, UiMessages.ParsingPreferencePage_hideSingle, getFieldEditorParent()); m_hideBeginEditor.setEmptyStringAllowed(false); m_hideEndEditor.setEmptyStringAllowed(false); m_hideLineEditor.setEmptyStringAllowed(false); addField(m_hideBeginEditor); addField(m_hideEndEditor); addField(m_hideLineEditor); // evaluation addField(new BooleanFieldEditor(P_CODE_STRICT_EVALUATE, UiMessages.ParsingPreferencePage_strictEvaluate, getFieldEditorParent())); // highlight visited/executed lines addField(new BooleanFieldEditor(P_HIGHLIGHT_VISITED, UiMessages.ParsingPreferencePage_highlightVisitedLines, getFieldEditorParent())); addField(new ColorFieldEditor(P_HIGHLIGHT_VISITED_COLOR, UiMessages.ParsingPreferencePage_highlightVisitedLinesColor, getFieldEditorParent())); }
From source file:org.eclipse.wst.jsdt.bower.ide.ui.internal.preferences.BowerPreferencesPage.java
License:Open Source License
/** * {@inheritDoc}/*w w w .j a v a 2 s .c o m*/ * * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ @Override public void createFieldEditors() { addField(new StringFieldEditor(IPreferenceConstants.BOWER_SERVER_URL, I18n.getString(I18nKeys.BOWER_PREFERENCES_SERVER_URL_LABEL), getFieldEditorParent())); }
From source file:org.eclipse.wst.jsdt.debug.internal.ui.launching.JavaScriptConnectTab.java
License:Open Source License
/** * Handles creating the UI for the connector selected *//*from ww w . ja va2s . c om*/ void handleConnectorSelected() { Connector connect = getSelectedConnector(); if (connect == null || connect.equals(this.selectedconnector)) { //nothing changed return; } this.selectedconnector = connect; String desc = this.selectedconnector.description(); if (desc != null) { this.description.setText(desc); } else { this.description.setText(Messages.no_description_provided); } this.editormap.clear(); //get rid of the old controls Control[] children = this.argumentsgroup.getChildren(); for (int i = 0; i < children.length; i++) { children[i].dispose(); } PreferenceStore store = new PreferenceStore(); Entry entry = null; Argument argument = null; FieldEditor editor = null; String key = null; for (Iterator iter = this.selectedconnector.defaultArguments().entrySet().iterator(); iter.hasNext();) { entry = (Entry) iter.next(); key = (String) entry.getKey(); argument = (Argument) entry.getValue(); if (argument instanceof IntegerArgument) { //create an int editor store.setDefault(argument.name(), ((IntegerArgument) argument).intValue()); editor = new IntegerFieldEditor(argument.name(), argument.label(), this.argumentsgroup); } else if (argument instanceof BooleanArgument) { //create boolean editor store.setDefault(argument.name(), ((BooleanArgument) argument).booleanValue()); editor = new BooleanFieldEditor(argument.name(), argument.label(), this.argumentsgroup); editor.fillIntoGrid(argumentsgroup, 2); } else if (argument instanceof StringArgument) { //create String editor store.setDefault(argument.name(), argument.value()); editor = new StringFieldEditor(argument.name(), argument.label(), this.argumentsgroup); } else if (argument instanceof SelectedArgument) { //create list selection editor List choices = ((SelectedArgument) argument).choices(); String[][] namesAndValues = new String[choices.size()][2]; int count = 0; for (Iterator iter2 = choices.iterator(); iter2.hasNext();) { String choice = (String) iter2.next(); namesAndValues[count][0] = choice; namesAndValues[count][1] = choice; count++; } store.setDefault(argument.name(), argument.value()); editor = new ComboFieldEditor(argument.name(), argument.label(), namesAndValues, this.argumentsgroup); } if (editor != null) { editor.setPreferenceStore(store); editor.loadDefault(); editor.setPropertyChangeListener(this); this.editormap.put(key, editor); editor = null; } } //reset margins to undo FieldEditor bogosity GridLayout gd = (GridLayout) this.argumentsgroup.getLayout(); gd.marginHeight = 5; gd.marginWidth = 5; this.argumentsgroup.getParent().layout(true); this.argumentsgroup.setVisible(true); this.argumentsgroup.layout(true); updateLaunchConfigurationDialog(); }
From source file:org.eclipse.wst.wsdl.ui.internal.WSDLPreferencePage.java
License:Open Source License
protected void createFieldEditors() { Composite parent = getFieldEditorParent(); GridLayout parentLayout = new GridLayout(); parentLayout.marginWidth = 0;//from w w w. j a va 2 s . co m parent.setLayout(parentLayout); // WorkbenchHelp.setHelp(getControl(), some context id here); Group group = new Group(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.numColumns = 2; group.setLayout(layout); group.setText(Messages._UI_PREF_PAGE_CREATING_FILES); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; group.setLayoutData(data); Composite composite = new Composite(group, SWT.NULL); GridData data1 = new GridData(); data1.verticalAlignment = GridData.FILL; data1.horizontalAlignment = GridData.FILL; data1.grabExcessHorizontalSpace = true; composite.setLayoutData(data1); GridLayout compositeLayout = new GridLayout(); compositeLayout.marginWidth = 5; // Default value compositeLayout.numColumns = 2; composite.setLayout(compositeLayout); String prefixLabel = Messages._UI_PREF_PAGE_DEFAULT_PREFIX; StringFieldEditor prefix = new StringFieldEditor( WSDLEditorPlugin.DEFAULT_TARGET_NAMESPACE_PREFIX_PREFERENCE_ID, prefixLabel, composite); addField(prefix); String namespaceLabel = Messages._UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE; StringFieldEditor targetNamespace = new StringFieldEditor(WSDLEditorPlugin.DEFAULT_TARGET_NAMESPACE_ID, namespaceLabel, composite); addField(targetNamespace); PlatformUI.getWorkbench().getHelpSystem().setHelp(targetNamespace.getTextControl(composite), ASDEditorCSHelpIds.WSDL_PREF_DEFAULT_TNS); Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; gridData.verticalIndent = 5; separator.setLayoutData(gridData); String generateSeparateIntfLabel = Messages._UI_PREF_GENERATE_SEPARATE_INTERFACE; Composite oneColumnComposite = new Composite(composite, SWT.None); oneColumnComposite.setLayout(new GridLayout()); GridData intfGridData = new GridData(GridData.FILL_BOTH); intfGridData.horizontalSpan = 2; intfGridData.horizontalIndent = 0; intfGridData.verticalIndent = 0; oneColumnComposite.setLayoutData(intfGridData); generateSeparateIntfFieldEditor = new BooleanFieldEditor( WSDLEditorPlugin.GENERATE_SEPARATE_INTERFACE_PREFERENCE_ID, generateSeparateIntfLabel, oneColumnComposite); addField(generateSeparateIntfFieldEditor); interfacePreferencesComposite = new Composite(composite, SWT.None); layout = new GridLayout(); layout.numColumns = 2; interfacePreferencesComposite.setLayout(layout); GridData compositeGridData = new GridData(GridData.FILL_BOTH); compositeGridData.horizontalSpan = 2; compositeGridData.horizontalIndent = 15; compositeGridData.verticalIndent = 0; interfacePreferencesComposite.setLayoutData(compositeGridData); String interfacePrefixLabel = Messages._UI_PREF_PAGE_INTERFACE_DEFAULT_PREFIX; StringFieldEditor interfacePrefix = new StringFieldEditor(WSDLEditorPlugin.INTERFACE_PREFIX_PREFERENCE_ID, interfacePrefixLabel, interfacePreferencesComposite); addField(interfacePrefix); String interfaceNamespaceLabel = Messages._UI_PREF_PAGE_INTERFACE_DEFAULT_TARGET_NAMESPACE; StringFieldEditor interfaceNamespace = new StringFieldEditor( WSDLEditorPlugin.INTERFACE_DEFAULT_TARGET_NAMESPACE_PREFERENCE_ID, interfaceNamespaceLabel, interfacePreferencesComposite); addField(interfaceNamespace); String portTypeFilenameSuffixLabel = Messages._UI_PREF_PAGE_INTERFACE_FILE_SUFFIX; StringFieldEditor interfaceSuffix = new StringFieldEditor( WSDLEditorPlugin.INTERFACE_FILE_SUFFIX_PREFERENCE_ID, portTypeFilenameSuffixLabel, interfacePreferencesComposite); addField(interfaceSuffix); String generateLabel = Messages._UI_PREF_PAGE_AUTO_REGENERATE_BINDING; BooleanFieldEditor generateBindingOnSave = new BooleanFieldEditor( WSDLEditorPlugin.AUTO_REGENERATE_BINDING_ON_SAVE_ID, generateLabel, parent); addField(generateBindingOnSave); String showGenerateDialogLabel = Messages._UI_PREF_PAGE_PROMPT_REGEN_BINDING_ON_SAVE; BooleanFieldEditor showGenerateDialog = new BooleanFieldEditor( WSDLEditorPlugin.PROMPT_REGEN_BINDING_ON_SAVE_ID, showGenerateDialogLabel, parent); addField(showGenerateDialog); String unusedImportLabel = Messages._UI_PREF_PAGE_ENABLE_AUTO_IMPORT_CLEANUP; BooleanFieldEditor removeUnusedImports = new BooleanFieldEditor(WSDLEditorPlugin.AUTO_IMPORT_CLEANUP_ID, unusedImportLabel, parent); addField(removeUnusedImports); String openImportDialogLabel = Messages._UI_PREF_PAGE_ENABLE_AUTO_OPEN_IMPORT_DIALOG; BooleanFieldEditor openImportDialog = new BooleanFieldEditor(WSDLEditorPlugin.AUTO_OPEN_IMPORT_DIALOG_ID, openImportDialogLabel, parent); addField(openImportDialog); boolean enabled = WSDLEditorPlugin.getInstance().getPreferenceStore() .getBoolean(WSDLEditorPlugin.GENERATE_SEPARATE_INTERFACE_PREFERENCE_ID); setChildrenEnabled(interfacePreferencesComposite, enabled); applyDialogFont(parent); }
From source file:org.eclipselabs.stlipse.preference.StlipsePreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor("tagPrefixes", "Tag prefixes", getFieldEditorParent())); }
From source file:org.eclipseplugins.impexeditor.core.editor.preferences.GeneralPreferencePage.java
License:Apache License
/** * Creates the field editors. Field editors are abstractions of * the common GUI blocks needed to manipulate various types * of preferences. Each field editor knows how to save and * restore itself.//w ww. j a v a2 s.c o m */ public void createFieldEditors() { addField(new StringFieldEditor(PreferenceConstants.P_HOST_ENDPOINT_STRING, "Host Name :", getFieldEditorParent())); addField(new StringFieldEditor(PreferenceConstants.P_HOST_USER_NAME_STRING, "User Name :", getFieldEditorParent())); addField( new StringFieldEditor(PreferenceConstants.P_HOST_PWD_STRING, "Password :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_TEXT_COLOR, "Main Text Content :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_COMMAND_COLOR, "Command (INSERT,INSERT_UPDATE,..) :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_ATOMIC_COLOR, "Atomic (true,false,mode,..) :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_HEADER_TYPE_COLOR, "Header Type (Product, Promotion,..) :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_MODIFIER_COLOR, "Modifier (allownull,batchmode,..) :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_VARIABLE_COLOR, "Variable :", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.IMPEX_COMMENTS_COLOR, "Comments :", getFieldEditorParent())); }