List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:ch.qos.logback.beagle.preferences.BeaglePreferencesPage.java
License:Open Source License
@Override protected void createFieldEditors() { patternEditor = new StringFieldEditor(PATTERN_PREFERENCE, " ?-:", getFieldEditorParent());/*from w ww. j a va2s.c o m*/ addField(patternEditor); bufferSizeEditor = new IntegerFieldEditor(BUFFER_SIZE_PREFERENCE, " (?):", getFieldEditorParent()); addField(bufferSizeEditor); }
From source file:ch.uzh.ifi.seal.permo.lib.ui.swt.builder.StringFieldEditorBuilder.java
License:Apache License
private StringFieldEditor createWihtoutValidation() { return new StringFieldEditor(name, labelText, parent); }
From source file:ch.uzh.ifi.seal.permo.lib.ui.swt.builder.StringFieldEditorBuilder.java
License:Apache License
private StringFieldEditor createWithValidation() { final Validation validation = this.optionalValidation.get(); final StringFieldEditor stringFieldEditor = new StringFieldEditor(name, labelText, parent) { @Override//from w w w . j a va 2s .com protected boolean checkState() { if (!validation.getCondition().test(getStringValue())) { setErrorMessage(validation.getMessage()); showErrorMessage(); return false; } return super.checkState(); } }; return stringFieldEditor; }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.preferences.DockerFoundryPreferencePage.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 2s.c om public void createFieldEditors() { final StringFieldEditor serverAddressEditor = new StringFieldEditor(PreferenceConstants.P_SERVERADDRESS, "&Server Address:", getFieldEditorParent()); final StringFieldEditor userNameEditor = new StringFieldEditor(PreferenceConstants.P_USERNAME, "&User Name:", getFieldEditorParent()); final StringFieldEditor passwordEditor = new StringFieldEditor(PreferenceConstants.P_PASSWORD, "&Password:", getFieldEditorParent()); final StringFieldEditor emailEditor = new StringFieldEditor(PreferenceConstants.P_EMAIL, "&Email:", getFieldEditorParent()); addField(serverAddressEditor); addField(userNameEditor); addField(passwordEditor); addField(emailEditor); /*Button testConnection = new Button(getFieldEditorParent(), SWT.PUSH); testConnection.setText("Test Connection"); testConnection.setAlignment(SWT.RIGHT); testConnection.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { try { AuthConfig authConfig = AuthConfig.builder() .email(serverAddressEditor.getStringValue()) .username(userNameEditor.getStringValue()) .password(passwordEditor.getStringValue()).build(); final DefaultDockerClient.Builder builder = DefaultDockerClient.fromEnv(); builder.readTimeoutMillis(120000); DockerClient client = builder.build(); int status = client.auth(authConfig); StringBuilder sb = new StringBuilder(); if(status == 200) sb = new StringBuilder( "Successfully connect to Docker Registry [" + serverAddressEditor.getStringValue() +"]"); else sb = new StringBuilder( "Failed to connect to Docker Registry [" + serverAddressEditor.getStringValue() +"]"); MessageDialog.openInformation(getShell(), "Docker Connection", sb.toString()); } catch (Exception e) { e.printStackTrace(); StringBuilder sb = new StringBuilder( "Failed to connect to Docker Registry [" + serverAddressEditor.getStringValue() +"]"); sb.append(e.getLocalizedMessage()); MessageDialog.openError(getShell(), "Docker Connection", sb.toString()); } } @Override public void keyReleased(KeyEvent arg0) { keyPressed(arg0); } });*/ }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.wizards.DockerConnectionWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); composite.setLayoutData(fileSelectionData); GridLayout fileSelectionLayout = new GridLayout(); fileSelectionLayout.numColumns = 3;//from w w w . jav a2 s . c o m fileSelectionLayout.makeColumnsEqualWidth = false; fileSelectionLayout.marginWidth = 0; fileSelectionLayout.marginHeight = 0; composite.setLayout(fileSelectionLayout); setControl(composite); editor = new StringFieldEditor("connName", "Docker Connection Name: ", composite); //NON-NLS-1 //NON-NLS-2 editor.getTextControl(composite).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String connName = DockerConnectionWizardPage.this.editor.getStringValue(); System.out.println("connName:" + connName); } }); // Group group0 = new Group(composite, SWT.NULL); // GridLayout layout = new GridLayout(); // layout.numColumns = 1; // group0.setLayout(layout); connSetting = new Button(composite, SWT.CHECK); connSetting.setSelection(true); connSetting.setText("Use default connection settings"); GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; connSetting.setLayoutData(gridData); group1 = new Group(composite, SWT.NULL); group1.setText("Connection Setting"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; group1.setLayoutData(gridData); optionsButton = new Button[2]; optionsButton[0] = new Button(group1, SWT.RADIO); optionsButton[0].setText("Unix Socket"); optionsButton[0].setSelection(true); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; optionsButton[0].setLayoutData(gridData); unixSocketFileFieldEditor = new FileFieldEditor("Location", " Location: ", group1); //NON-NLS-1 //NON-NLS-2 unixSocketFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String location = DockerConnectionWizardPage.this.unixSocketFileFieldEditor.getStringValue(); System.out.println("Location:" + location); } }); optionsButton[1] = new Button(group1, SWT.RADIO); optionsButton[1].setText("HTTPS Connection"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; optionsButton[1].setLayoutData(gridData); hostEditor = new StringFieldEditor("host", " Host: ", group1); //NON-NLS-1 //NON-NLS-2 hostEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String host = DockerConnectionWizardPage.this.hostEditor.getStringValue(); System.out.println("host:" + host); } }); authenticationButton = new Button(group1, SWT.CHECK); authenticationButton.setSelection(true); authenticationButton.setText("Enable authentication"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; authenticationButton.setLayoutData(gridData); authenticationFileFieldEditor = new FileFieldEditor("Path", " Path: ", group1); //NON-NLS-1 //NON-NLS-2 authenticationFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String path = DockerConnectionWizardPage.this.authenticationFileFieldEditor.getStringValue(); System.out.println("Path:" + path); } }); testConnection = new Button(composite, SWT.PUSH); testConnection.setText("Test Connection"); testConnection.setAlignment(SWT.RIGHT); testConnection.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { try { String conn = testConnection(); StringBuilder sb = new StringBuilder( "Successfully connect to Docker with the following info:\n"); sb.append(conn); MessageDialog.openInformation(getShell(), "Docker Connection", sb.toString()); } catch (Exception e) { e.printStackTrace(); StringBuilder sb = new StringBuilder( "Failed to connect to Docker with the following reason:\n"); sb.append(e.getLocalizedMessage()); MessageDialog.openError(getShell(), "Docker Connection", sb.toString()); } } @Override public void keyReleased(KeyEvent arg0) { keyPressed(arg0); } }); composite.moveAbove(null); checkUseUnixSocket(); checkUseDefaultConnSetting(); addListener(); }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.wizards.DockerfileWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); composite.setLayoutData(fileSelectionData); GridLayout fileSelectionLayout = new GridLayout(); fileSelectionLayout.numColumns = 3;/*from w w w.j a va 2 s . co m*/ fileSelectionLayout.makeColumnsEqualWidth = false; fileSelectionLayout.marginWidth = 0; fileSelectionLayout.marginHeight = 0; composite.setLayout(fileSelectionLayout); setControl(composite); dockerfileEditor = new FileFieldEditor("dockerfile", "Dockerfile: ", composite); //NON-NLS-1 //NON-NLS-2 dockerfileEditor.getTextControl(composite).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { } }); GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 2; dockerfileEditor.getLabelControl(composite).setLayoutData(layoutData); layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 1; dockerfileEditor.getTextControl(composite).setLayoutData(layoutData); // dockerfileEditor.fillIntoGrid(composite, 4); targetImageNameEditor = new StringFieldEditor("t", "Repository name (and optionally a tag) to be applied to the resulting image in case of success: ", composite); layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 2; targetImageNameEditor.getLabelControl(composite).setLayoutData(layoutData); layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 2; targetImageNameEditor.getTextControl(composite).setLayoutData(layoutData); // targetImageNameEditor.fillIntoGrid(composite, 2); composite.moveAbove(null); addListener(); }
From source file:cn.edu.xmu.tidems.control.ui.preferences.PreferencePageTideMS.java
License:Open Source License
@Override protected void createFieldEditors() { final StringFieldEditor field = new StringFieldEditor(PreferenceSupplier.P_MZ_CALIBRATION_FACTOR, "Calibration factors (a, b, c):", getFieldEditorParent()); final double[] mzCalibrationFactor = PreferenceSupplier.getMZCalibrationFactor(); String str = Arrays.toString(mzCalibrationFactor); str = str.substring(1, str.length() - 1).replace(",", ", "); field.setStringValue(str);// w w w.ja v a 2 s .co m addField(field); }
From source file:cn.ieclipse.pde.explorer.preferences.ExplorerPreferencePage.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 w w . j av a 2 s . co m public void createFieldEditors() { addField(new StringFieldEditor(PreferenceConstants.EXPLORER_CMD, Messages.ExplorerPreferencePage_cmd, getFieldEditorParent())); addField(new MyStringFieldEditor(PreferenceConstants.EXPLORER_TIP, Messages.ExplorerPreferencePage_tip, getFieldEditorParent())); }
From source file:com.aerospike.core.preferences.AerospikePreferencePage.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 w w. j av a 2s . co m*/ */ public void createFieldEditors() { seedNodeEditor = new StringFieldEditor(PreferenceConstants.SEED_NODE, "&Seed Node:", getFieldEditorParent()); seedNodeEditor.setPreferenceStore(store); addField(seedNodeEditor); portEditor = new IntegerFieldEditor(PreferenceConstants.PORT, "&Port:", getFieldEditorParent()); portEditor.setPreferenceStore(store); addField(portEditor); timeoutEditor = new IntegerFieldEditor(PreferenceConstants.CLUSTER_CONNECTION_TIMEOUT, "Connection &Timeout:", getFieldEditorParent()); timeoutEditor.setPreferenceStore(store); addField(timeoutEditor); udfDirectoryEditor = new StringFieldEditor(PreferenceConstants.UDF_PATH, "&UDF Directory:", getFieldEditorParent()); udfDirectoryEditor.setPreferenceStore(store); addField(udfDirectoryEditor); aqlDirectoryEditor = new StringFieldEditor(PreferenceConstants.AQL_PATH, "&AQL Directory:", getFieldEditorParent()); aqlDirectoryEditor.setPreferenceStore(store); addField(aqlDirectoryEditor); genDirectoryEditor = new StringFieldEditor(PreferenceConstants.GENERATION_PATH, "&Generation Directory:", getFieldEditorParent()); genDirectoryEditor.setPreferenceStore(store); addField(genDirectoryEditor); }
From source file:com.aerospike.core.properties.ClusterPropertyPage.java
License:Apache License
/** * @see PreferencePage#createContents(Composite) *//*from ww w. ja v a2s . c o m*/ protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); GridData data = new GridData(GridData.FILL); data.grabExcessHorizontalSpace = true; composite.setLayoutData(data); Label lblNewLabel = new Label(composite, SWT.NONE); lblNewLabel.setImage(ResourceManager.getPluginImage("aerospike-core-plugin", "icons/Cluster.png")); Label lblCluster = new Label(composite, SWT.NONE); lblCluster.setFont(SWTResourceManager.getFont("Lucida Grande", 13, SWT.BOLD)); lblCluster.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1)); lblCluster.setText("Cluster"); new Label(composite, SWT.NONE); seedNodeEditor = new StringFieldEditor(PreferenceConstants.SEED_NODE, "&Seed Node:", composite); new Label(composite, SWT.NONE); portEditor = new IntegerFieldEditor(PreferenceConstants.PORT, "&Port:", composite); new Label(composite, SWT.NONE); timeoutEditor = new IntegerFieldEditor(PreferenceConstants.CLUSTER_CONNECTION_TIMEOUT, "Connection &Timeput:", composite); new Label(composite, SWT.NONE); Label lblNewLabel_1 = new Label(composite, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1)); lblNewLabel_1.setImage(ResourceManager.getPluginImage("aerospike-core-plugin", "icons/UDF.png")); Label lblUserDefinedFunctions = new Label(composite, SWT.NONE); lblUserDefinedFunctions.setFont(SWTResourceManager.getFont("Lucida Grande", 13, SWT.BOLD)); lblUserDefinedFunctions.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1)); lblUserDefinedFunctions.setText("User Defined Functions"); new Label(composite, SWT.NONE); udfDirectoryEditor = new DirectoryFieldEditor(PreferenceConstants.UDF_PATH, "&UDF Directory:", composite); Label label = new Label(composite, SWT.NONE); label.setImage(ResourceManager.getPluginImage("aerospike-core-plugin", "icons/Query.png")); Label lblAerospikeQueryLanguage = new Label(composite, SWT.NONE); lblAerospikeQueryLanguage.setFont(SWTResourceManager.getFont("Lucida Grande", 13, SWT.BOLD)); lblAerospikeQueryLanguage.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1)); lblAerospikeQueryLanguage.setText("Aerospike Query Language"); new Label(composite, SWT.NONE); genDirectoryEditor = new DirectoryFieldEditor(PreferenceConstants.GENERATION_PATH, "&Generation Directory:", composite); new Label(composite, SWT.NONE); try { IProject project = ((IProject) getElement()); if (project != null) { String seedNode = CoreActivator.getSeedHost(project); seedNodeEditor.setStringValue(seedNode); int port = CoreActivator.getPort(project); portEditor.setStringValue(Integer.toString(port)); int timeout = CoreActivator.getConnectionTimeout(project); timeoutEditor.setStringValue(Integer.toString(timeout)); String udfDirectoryString = project.getPersistentProperty(CoreActivator.UDF_DIRECTORY); if (udfDirectoryString != null) udfDirectoryEditor.setStringValue(udfDirectoryString); else udfDirectoryEditor.setStringValue(store.getString(PreferenceConstants.UDF_PATH)); String aqlOutputString = project.getPersistentProperty(CoreActivator.AQL_GENERATION_DIRECTORY); if (aqlOutputString != null) genDirectoryEditor.setStringValue(aqlOutputString); else genDirectoryEditor.setStringValue(store.getString(PreferenceConstants.GENERATION_PATH)); } } catch (CoreException e) { CoreActivator.log(Level.ERROR_INT, "failure creating Properties page", e); } return composite; }