List of usage examples for org.eclipse.jface.preference StringFieldEditor getTextControl
public Text getTextControl(Composite parent)
From source file:org.eclipse.dirigible.ide.db.preferences.DatabaseDriverPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Text text = null;//from w w w. j a va 2 s . c o m StringFieldEditor databaseDriverNameField = new StringFieldEditor(CommonParameters.DATABASE_DRIVER_NAME, "&Driver Name:", getFieldEditorParent()); text = databaseDriverNameField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText(CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_NAME) : DatabasePreferencePage.N_A); addField(databaseDriverNameField); StringFieldEditor databaseMinorVersionField = new StringFieldEditor( CommonParameters.DATABASE_DRIVER_MINOR_VERSION, "&Minor Version:", getFieldEditorParent()); text = databaseMinorVersionField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText(CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MINOR_VERSION) : DatabasePreferencePage.N_A); addField(databaseMinorVersionField); StringFieldEditor databaseMajorVersionField = new StringFieldEditor( CommonParameters.DATABASE_DRIVER_MAJOR_VERSION, "&Major Version:", getFieldEditorParent()); text = databaseMajorVersionField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText(CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION) != null ? CommonParameters.get(CommonParameters.DATABASE_DRIVER_MAJOR_VERSION) : DatabasePreferencePage.N_A); addField(databaseMajorVersionField); StringFieldEditor databaseConnectionClassNameField = new StringFieldEditor( CommonParameters.DATABASE_CONNECTION_CLASS_NAME, "&Connection Class Name:", getFieldEditorParent()); text = databaseConnectionClassNameField.getTextControl(getFieldEditorParent()); text.setEditable(false); text.setText(CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME) != null ? CommonParameters.get(CommonParameters.DATABASE_CONNECTION_CLASS_NAME) : DatabasePreferencePage.N_A); addField(databaseConnectionClassNameField); }
From source file:org.eclipse.linuxtools.systemtap.ui.consolelog.preferences.ConsoleLogPreferencePage.java
License:Open Source License
public void createFieldEditors() { addField(new StringFieldEditor(ConsoleLogPreferenceConstants.HOST_NAME, "Host Name: ", getFieldEditorParent()));//from w ww . ja v a2s . c om addField(new IntegerFieldEditor(ConsoleLogPreferenceConstants.PORT_NUMBER, "Port: ", getFieldEditorParent())); addField(new StringFieldEditor(ConsoleLogPreferenceConstants.SCP_USER, "User Name: ", getFieldEditorParent())); StringFieldEditor passwordField = new StringFieldEditor(ConsoleLogPreferenceConstants.SCP_PASSWORD, "Password: ", getFieldEditorParent()); passwordField.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(passwordField); // addField(new StringFieldEditor(ConsoleLogPreferenceConstants.SCP_PASSWORD, // "Password: ", getFieldEditorParent())); addField(new BooleanFieldEditor(ConsoleLogPreferenceConstants.REMEMBER_SERVER, "Always connect to this host.", getFieldEditorParent())); addField(new IntegerFieldEditor(ConsoleLogPreferenceConstants.SAVE_LENGTH, "Seconds to Save Data: ", getFieldEditorParent())); }
From source file:org.eclipse.ptp.remotetools.preferences.events.FollowBeginStringFieldEditorPropertyChangeListener.java
License:Open Source License
/** * /*from w w w. ja v a 2 s . c o m*/ */ public FollowBeginStringFieldEditorPropertyChangeListener(StringFieldEditor stringFieldEditor, Composite parent) { this.stringFieldEditor = stringFieldEditor; this.textControl = stringFieldEditor.getTextControl(parent); this.display = this.textControl.getDisplay(); this.preferenceStore = stringFieldEditor.getPreferenceStore(); this.preferenceName = stringFieldEditor.getPreferenceName(); }
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 ww w.j a v a 2 s. c o 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.entirej.framework.plugin.preferences.EntirejConnectionPreferencePage.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. *//*from w ww . j a v a 2 s. com*/ @Override public void createFieldEditors() { if (getElement() instanceof IProject) { addField(new LabelFieldEditor(getFieldEditorParent(), "Database Settings:")); addField(new LabelFieldEditor(getFieldEditorParent(), "")); final StringFieldEditor driver = new StringFieldEditor(EntireJFrameworkPlugin.P_DBDRIVER, " &Driver:", getFieldEditorParent()); addField(driver); final StringFieldEditor url = new StringFieldEditor(EntireJFrameworkPlugin.P_URL, " &Connection URL:", getFieldEditorParent()); addField(url); final StringFieldEditor schema = new StringFieldEditor(EntireJFrameworkPlugin.P_SCHEMA, " &Schema:", getFieldEditorParent()); addField(schema); final StringFieldEditor user = new StringFieldEditor(EntireJFrameworkPlugin.P_USERNAME, " User&name:", getFieldEditorParent()); addField(user); final StringFieldEditor password = new StringFieldEditor(EntireJFrameworkPlugin.P_PASSWORD, " P&assword:", getFieldEditorParent()); password.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(password); final IProject project = (IProject) getElement(); new Label(getFieldEditorParent(), SWT.NONE); final Button test = new Button(getFieldEditorParent(), SWT.PUSH); test.setText("Validate"); addField(new LabelFieldEditor(getFieldEditorParent(), "") { @Override public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); test.setEnabled(enabled); } @Override public int getNumberOfControls() { return 1; } }); new Label(getFieldEditorParent(), SWT.NONE); test.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent evt) { final String driverV = driver.getStringValue(); final String urlV = url.getStringValue(); final String schemaV = schema.getStringValue(); final String userV = user.getStringValue(); final String passV = password.getStringValue(); final IRunnableWithProgress activation = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { try { monitor.beginTask("Validating connection", 2); monitor.worked(1); try { validConnection(driverV, urlV, schemaV, userV, passV, project); final Display display = EJCorePlugin.getStandardDisplay(); display.asyncExec(new Runnable() { public void run() { // Validation error MessageDialog dialog = new MessageDialog(getShell(), // "Validation", // null, "Successfully validated!", MessageDialog.INFORMATION, // new String[] { IDialogConstants.OK_LABEL }, // 0); dialog.open(); } }); } catch (EJDevFrameworkException e) { final String error = e.getMessage(); final Display display = EJCorePlugin.getStandardDisplay(); display.asyncExec(new Runnable() { public void run() { // Validation error MessageDialog dialog = new MessageDialog(getShell(), // "Validation error", // null, error, MessageDialog.ERROR, // new String[] { IDialogConstants.OK_LABEL }, // 0); dialog.open(); } }); } monitor.worked(2); } finally { monitor.done(); } } }; ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); try { dialog.run(true, true, activation); } catch (InvocationTargetException e) { EJCoreLog.log(e); } catch (InterruptedException e) { EJCoreLog.log(e); } } }); } }
From source file:org.polymap.service.ui.GeneralPreferencePage.java
License:Open Source License
protected void createFieldEditors() { Composite fieldParent = getFieldEditorParent(); StringFieldEditor proxyUrlEditor = new StringFieldEditor(ServicesPlugin.PREF_PROXY_URL, Messages.get("GeneralPreferencesPage_proxyUrlLabel"), fieldParent); addField(proxyUrlEditor);// w w w.j av a 2 s .c om proxyUrlEditor.getLabelControl(fieldParent) .setToolTipText(Messages.get("GeneralPreferencesPage_proxyUrlTip")); proxyUrlEditor.getTextControl(fieldParent) .setToolTipText(Messages.get("GeneralPreferencesPage_proxyUrlTip")); }
From source file:org.polymap.service.ui.OwsPropertiesPage.java
License:Open Source License
protected void createFieldEditors() { IPreferenceStore store = new PreferenceStore() { public boolean needsSaving() { return false; }/* w w w. j a v a 2 s .c om*/ }; setPreferenceStore(store); store.setDefault("WMS", providedService.isEnabled()); store.setDefault("WFS", false); store.setDefault(IProvidedService.PROP_PATHSPEC, providedService.getPathSpec()); store.setDefault(IProvidedService.PROP_SRS, StringUtils.join(providedService.getSRS(), ", ")); Composite pathParent = getFieldEditorParent(); Composite uriParent = getFieldEditorParent(); // URI final StringFieldEditor uriField = new StringFieldEditor("URI", "URI*", uriParent); addField(uriField); uriField.setStringValue(ServicesPlugin.createServiceUrl(providedService.getPathSpec())); uriField.getTextControl(uriParent).setToolTipText("The complete URI of this service."); uriField.setEnabled(false, uriParent); // service path StringFieldEditor pathField = new StringFieldEditor(IProvidedService.PROP_PATHSPEC, "Service Name/Pfad", pathParent) { protected boolean doCheckState() { String value = getStringValue(); uriField.setStringValue(ServicesPlugin.createServiceUrl(value)); String validName = ServicesPlugin.validPathSpec(value); if (!value.equals(validName)) { setErrorMessage("Der Name darf nur Buchstaben, Zahlen oder '-', '_', '.' enthalten."); return false; } return true; } }; addField(pathField); // WMS BooleanFieldEditor wmsField = new BooleanFieldEditor("WMS", "WMS aktivieren", getFieldEditorParent()); addField(wmsField); // WFS BooleanFieldEditor wfsField = new BooleanFieldEditor("WFS", "WFS aktivieren", getFieldEditorParent()); // wfsField.setEnabled( false, getFieldEditorParent() ); // SRS // Composite parent = getFieldEditorParent(); // StringFieldEditor srsField = new StringFieldEditor( // IProvidedService.PROP_SRS, "Koordinatensysteme*", parent ); // srsField.getLabelControl( parent ) // .setToolTipText( "Komma-separierte Liste mit EPSG-Codes: EPSG:31468, EPSG:4326, ..." ); // addField( srsField ); // load default values performDefaults(); }
From source file:org.robotframework.ide.eclipse.main.plugin.preferences.ContentAssistPreferencePage.java
License:Apache License
protected void createAutoActivationEditors(final Composite parent) { final Group autoActivationGroup = new Group(parent, SWT.NONE); autoActivationGroup.setText("Auto activation"); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(autoActivationGroup); GridLayoutFactory.fillDefaults().applyTo(autoActivationGroup); final BooleanFieldEditor autoActivationEnabled = new BooleanFieldEditor( RedPreferences.ASSISTANT_AUTO_ACTIVATION_ENABLED, "Auto activation enabled", autoActivationGroup); addField(autoActivationEnabled);// ww w .ja va 2s. c o m final Button button = (Button) autoActivationEnabled.getDescriptionControl(autoActivationGroup); GridDataFactory.fillDefaults().indent(5, 10).applyTo(button); final boolean isAutoActivationEnabled = RedPlugin.getDefault().getPreferences() .isAssistantAutoActivationEnabled(); final IntegerFieldEditor autoActivationDelay = new IntegerFieldEditor( RedPreferences.ASSISTANT_AUTO_ACTIVATION_DELAY, "Auto activation delay (ms)", autoActivationGroup, 3); addField(autoActivationDelay); delayTextControl = autoActivationDelay.getTextControl(autoActivationGroup); delayTextControl.setEnabled(isAutoActivationEnabled); GridDataFactory.fillDefaults().indent(25, 2) .applyTo(autoActivationDelay.getLabelControl(autoActivationGroup)); final StringFieldEditor autoActivationChars = new StringFieldEditor( RedPreferences.ASSISTANT_AUTO_ACTIVATION_CHARS, "Auto activation triggers", autoActivationGroup); addField(autoActivationChars); charsTextControl = autoActivationChars.getTextControl(autoActivationGroup); charsTextControl.setEnabled(isAutoActivationEnabled); GridDataFactory.fillDefaults().indent(25, 2) .applyTo(autoActivationChars.getLabelControl(autoActivationGroup)); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { delayTextControl.setEnabled(button.getSelection()); charsTextControl.setEnabled(button.getSelection()); } }); }
From source file:org.springframework.ide.eclipse.boot.ui.preferences.BootPreferencePage.java
License:Open Source License
private void setTooltip(Composite parent, StringFieldEditor fe, String tooltip) { fe.getLabelControl(parent).setToolTipText(tooltip); fe.getTextControl(parent).setToolTipText(tooltip); }
From source file:org.springframework.ide.eclipse.boot.ui.preferences.InitializrPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Composite parent = getFieldEditorParent(); StringFieldEditor initializrUrl = new StringFieldEditor(PREF_INITIALIZR_URL, LABEL_INITIALIZR_URL, parent) { @Override/* w ww .j av a 2 s . co m*/ protected boolean checkState() { // Checks if string has a correct URL format Text text = getTextControl(); if (text == null) { return false; } try { new URL(text.getText()); clearErrorMessage(); return true; } catch (MalformedURLException e) { setErrorMessage(MSG_INVALID_URL_FORMAT); showErrorMessage(); return false; } } }; initializrUrl.getLabelControl(parent).setToolTipText(TOOLTIP_INITIALIZR_URL); initializrUrl.getTextControl(parent).setToolTipText(TOOLTIP_INITIALIZR_URL); addField(initializrUrl); }