List of usage examples for org.eclipse.jface.preference StringFieldEditor getTextControl
public Text getTextControl(Composite parent)
From source file:at.medevit.elexis.gdt.ui.GDTPreferencePage.java
License:Open Source License
/** * Create contents of the preference page. *///from w ww . j av a 2s . com @Override protected void createFieldEditors() { { Composite composite = getFieldEditorParent(); StringFieldEditor stringFieldEditorGDTID = new StringFieldEditor(CFG_GDT_ID, "GDT Identitt", composite); stringFieldEditorGDTID.getLabelControl(composite).setText("GDT Identitt (max 8 Zeichen)"); stringFieldEditorGDTID.getLabelControl(composite).setToolTipText( "Die GDT-ID dient zur eindeutigen Identifikation der an der Kommunikation beteiligten Komonenten."); stringFieldEditorGDTID.getTextControl(composite).setTextLimit(8); addField(stringFieldEditorGDTID); } { Composite composite = getFieldEditorParent(); StringFieldEditor exchangeKuerzel = new StringFieldEditor(CFG_GDT_FILETRANSFER_SHORTNAME, "Kommunikations-Krzel (4 Zeichen)", composite); exchangeKuerzel.getTextControl(composite).setTextLimit(4); addField(exchangeKuerzel); } { Composite composite = getFieldEditorParent(); ComboFieldEditor comboFieldEditor = new ComboFieldEditor(CFG_GDT_CHARSET, "Standard Zeichensatz", comboCharsetSelektor, composite); comboFieldEditor.getLabelControl(composite) .setToolTipText("Zeichensatz welcher zum Datenaustausch verwendet werden soll"); addField(comboFieldEditor); } { BooleanFieldEditor deleteNonGDTFiles = new BooleanFieldEditor(CFG_GDT_FILETRANSFER_DELETE_NON_GDT_FILES, "Nicht GDT Dateien aus Daten-Austausch-Verzeichnissen entfernen", getFieldEditorParent()); addField(deleteNonGDTFiles); } }
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 w w w. ja v a 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:com.amazonaws.eclipse.core.ui.preferences.AwsAccountPreferencePage.java
License:Apache License
protected void setUpFieldEditor(String currentAccount, String preferenceKey, Composite parent, StringFieldEditor fieldEditor) { fieldEditor.setPage(this); fieldEditor.setPreferenceStore(this.getPreferenceStore()); fieldEditor.load();//from ww w . ja va 2 s . com // For backwards compatibility with single-account storage if (accountNamesByIdentifier.get(currentAccount) != null && accountNamesByIdentifier.get(currentAccount).equals(PreferenceConstants.DEFAULT_ACCOUNT_NAME) && (fieldEditor.getStringValue() == null || fieldEditor.getStringValue().length() == 0)) { String currentPrefValue = getPreferenceStore().getString(preferenceKey); if (ObfuscatingStringFieldEditor.isBase64(currentPrefValue)) { currentPrefValue = ObfuscatingStringFieldEditor.decodeString(currentPrefValue); } fieldEditor.setStringValue(currentPrefValue); } fieldEditor.fillIntoGrid(parent, LAYOUT_COLUMN_WIDTH); fieldEditor.getTextControl(parent).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { updatePageValidation(); } }); }
From source file:com.cloudbees.eclipse.ui.internal.preferences.GeneralPreferencePage.java
License:Open Source License
private void createCompositeLogin() { Group group = new Group(getFieldEditorParent(), SWT.SHADOW_ETCHED_IN); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout gl = new GridLayout(1, false); gl.marginLeft = 5;//ww w .ja v a 2 s. c o m gl.marginRight = 5; gl.marginTop = 5; gl.marginBottom = 5; gl.horizontalSpacing = 5; group.setLayout(gl); Composite groupInnerComp = new Composite(group, SWT.NONE); groupInnerComp.setLayout(new GridLayout(2, false)); groupInnerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText(Messages.pref_group_login); final StringFieldEditor fieldEmail = new StringFieldEditor(PreferenceConstants.P_EMAIL, Messages.pref_email, 30, groupInnerComp); fieldEmail.getTextControl(groupInnerComp).setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addField(fieldEmail); final StringFieldEditor fieldPassword = new StringFieldEditor(PreferenceConstants.P_PASSWORD, Messages.pref_password, 30, groupInnerComp) { @Override protected void doLoad() { try { if (getTextControl() != null) { String value = CloudBeesUIPlugin.getDefault().readP(); getTextControl().setText(value); this.oldValue = value; } } catch (StorageException e) { // Ignore StorageException, very likely just // "No password provided." } } @Override protected void doStore() { try { CloudBeesUIPlugin.getDefault().storeP(getTextControl().getText()); } catch (Exception e) { CloudBeesUIPlugin.showError( "Saving password failed!\nPossible cause: Eclipse security master password is not set.", e); } } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns); getTextControl().setEchoChar('*'); } }; fieldPassword.getTextControl(groupInnerComp).setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addField(fieldPassword); Composite signupAndValidateRow = new Composite(groupInnerComp, SWT.NONE); GridData signupRowData = new GridData(GridData.FILL_HORIZONTAL); signupRowData.horizontalSpan = 2; signupAndValidateRow.setLayoutData(signupRowData); GridLayout gl2 = new GridLayout(2, false); gl2.marginWidth = 0; gl2.marginHeight = 0; gl2.marginTop = 5; signupAndValidateRow.setLayout(gl2); createSignUpLink(signupAndValidateRow); Button b = new Button(signupAndValidateRow, SWT.PUSH); GridData validateButtonLayoutData = new GridData(GridData.HORIZONTAL_ALIGN_END); validateButtonLayoutData.widthHint = 75; b.setLayoutData(validateButtonLayoutData); b.setText(Messages.pref_validate_login); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final String email = fieldEmail.getStringValue(); final String password = fieldPassword.getStringValue(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); try { dialog.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { try { monitor.beginTask("Validating CloudBees account...", 100); //TODO i18n monitor.subTask("Connecting...");//TODO i18n monitor.worked(10); GrandCentralService gcs = new GrandCentralService(); gcs.setAuthInfo(email, password); monitor.worked(20); monitor.subTask("Validating...");//TODO i18n final boolean loginValid = gcs.validateUser(monitor); monitor.worked(50); PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { if (loginValid) { MessageDialog.openInformation( CloudBeesUIPlugin.getDefault().getWorkbench().getDisplay() .getActiveShell(), "Validation result", "Validation successful!");//TODO i18n } else { MessageDialog.openError( CloudBeesUIPlugin.getDefault().getWorkbench().getDisplay() .getActiveShell(), "Validation result", "Validation was not successful!\nWrong email or password?");//TODO i18n } } }); monitor.worked(20); } catch (CloudBeesException e1) { throw new RuntimeException(e1); } finally { monitor.done(); } } }); } catch (InvocationTargetException e1) { Throwable t1 = e1.getTargetException().getCause() != null ? e1.getTargetException().getCause() : e1.getTargetException(); Throwable t2 = t1.getCause() != null ? t1.getCause() : null; CloudBeesUIPlugin.showError("Failed to validate your account.", t1.getMessage(), t2); } catch (InterruptedException e1) { CloudBeesUIPlugin.showError("Failed to validate your account.", e1); } } }); }
From source file:com.clustercontrol.repository.preference.RepositoryPreferencePage.java
License:Open Source License
/** * ????/*w ww .ja v a 2 s. com*/ */ @Override public void createFieldEditors() { Composite parent = this.getFieldEditorParent(); GridData gridData = null; // ?[] Group nodeGroup = new Group(parent, SWT.SHADOW_NONE); WidgetTestUtil.setTestId(this, null, nodeGroup); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 10; gridData.verticalSpan = 10; nodeGroup.setLayoutData(gridData); nodeGroup.setText(Messages.getString("view.repository.node")); // StringFieldEditor progExec = new StringFieldEditor(P_PROGRAM_EXECUTION, MSG_PROGRAM_EXECUTION, nodeGroup); progExec.setTextLimit(DataRangeConstant.VARCHAR_1024); String[] args = { Integer.toString(DataRangeConstant.VARCHAR_1024) }; progExec.setErrorMessage(Messages.getString("message.hinemos.7", args)); this.addField(progExec); // This setting is not available for Web Client. Disable and show message. // Note: RAP BUG? If there is no FieldEditor set, label will not be shown. if (ClusterControlPlugin.isRAP()) { progExec.getTextControl(nodeGroup).setEnabled(false); Label lblNotAvailable = new Label(parent, SWT.LEFT); lblNotAvailable.setText(Messages.getString("preferencepage.notavailable.message")); lblNotAvailable.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); WidgetTestUtil.setTestId(this, "notavailable", nodeGroup); } }
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./* w w w .j a v a 2 s . c o m*/ */ 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.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);//w w w. j a v a 2 s . c om 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);// www . java2 s. co m 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.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);/*www . j av a 2 s .c om*/ 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); }
From source file:eu.aniketos.wp1.ststool.threats.preferences.SVRSPreferencePage.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. */// w w w . j ava2 s . c o m public void createFieldEditors() { addField(new StringFieldEditor(PreferenceConstants.SVRS_EMAIL, "E-mail:", getFieldEditorParent())); StringFieldEditor passf = new StringFieldEditor(PreferenceConstants.SVRS_PASSWORD, "Password:", getFieldEditorParent()); passf.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(passf); addField(new BooleanFieldEditor(PreferenceConstants.PROXY_ENABLED, "Enable proxy for HTTPS", getFieldEditorParent())); addField(new StringFieldEditor(PreferenceConstants.PROXY_ADDRESS, "Host:", getFieldEditorParent())); IntegerFieldEditor port = new IntegerFieldEditor(PreferenceConstants.PROXY_PORT, "Port:", getFieldEditorParent()); port.setValidRange(0, 49151); // http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers addField(port); addField(new BooleanFieldEditor(PreferenceConstants.PROXY_AUTHENTICATION, "Proxy requires authentication:", getFieldEditorParent())); addField(new StringFieldEditor(PreferenceConstants.PROXY_USERNAME, "User:", getFieldEditorParent())); StringFieldEditor passf2 = new StringFieldEditor(PreferenceConstants.PROXY_PASSWORD, "Password:", getFieldEditorParent()); passf2.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(passf2); // TODO: Store securely: // http://wiki.eclipse.org/Storage/Retrieval_of_IDs,_IContainers_using_Equinox_Secure_Preferences }