List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:com.agynamix.platform.frontend.preferences.GlobalPreferencePageNetwork.java
License:Open Source License
protected void createFieldEditors() { groupName = new StringFieldEditor(IPreferenceConstants.NODE_GROUP_NAME, "Name of the group you want to join", getFieldEditorParent()); groupPassword = new PasswordFieldEditor(IPreferenceConstants.NODE_GROUP_PWD, "Password for the group you want to join", getFieldEditorParent()); helloPort = new IntegerFieldEditor(IPreferenceConstants.HELLO_PORT, "The Port where Broadcasts are sent to", getFieldEditorParent());/* ww w . j a v a 2s . c om*/ helloPort.setValidRange(IPreferenceConstants.MIN_ALLOWED_PORT, IPreferenceConstants.MAX_ALLOWED_PORT); helloPort.setErrorMessage("The value for this port must be between " + IPreferenceConstants.MIN_ALLOWED_PORT + " and " + IPreferenceConstants.MAX_ALLOWED_PORT); serverPort = new IntegerFieldEditor(IPreferenceConstants.SERVER_PORT, "The communication port", getFieldEditorParent()); serverPort.setValidRange(IPreferenceConstants.MIN_ALLOWED_PORT, IPreferenceConstants.MAX_ALLOWED_PORT); serverPort.setErrorMessage("The value for this port must be between " + IPreferenceConstants.MIN_ALLOWED_PORT + " and " + IPreferenceConstants.MAX_ALLOWED_PORT); startHttpServer = new BooleanFieldEditor(IPreferenceConstants.START_HTTP_SERVER, "Access Simidude via Browser", getFieldEditorParent()); httpServerPort = new IntegerFieldEditor(IPreferenceConstants.HTTP_SERVER_PORT, "The Port used by the HTTP server", getFieldEditorParent()); httpServerPort.setValidRange(IPreferenceConstants.MIN_ALLOWED_PORT, IPreferenceConstants.MAX_ALLOWED_PORT); httpServerPort.setErrorMessage("The value for this port must be between " + IPreferenceConstants.MIN_ALLOWED_PORT + " and " + IPreferenceConstants.MAX_ALLOWED_PORT); myOwnIPAddress = new StringFieldEditor(IPreferenceConstants.OWN_IP_ADRESS, "This machine's IP address. Leave empty for auto detect.", getFieldEditorParent()); networkAddrList = new NetworkAddressListFieldEditor(IPreferenceConstants.PERMANENT_NETWORK_ADDRESSES, "Add permanent IP addresses or network names here:", "Enter IP address or name", getFieldEditorParent()); ignoreAddrList = new NetworkAddressListFieldEditor(IPreferenceConstants.IGNORE_NETWORK_ADDRESSES, "Ignore these IP addresses or network names:", "Enter IP address or name", getFieldEditorParent()); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(groupName); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(groupPassword); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(helloPort); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(serverPort); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(startHttpServer); addField(httpServerPort); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(myOwnIPAddress); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(networkAddrList); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(ignoreAddrList); addPropertyChangeListener(startHttpServer, new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { httpServerPort.setEnabled(startHttpServer.getBooleanValue(), getFieldEditorParent()); } }); addPropertyChangeListener(helloPort, new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { setValid(checkPortsUnique()); } }); addPropertyChangeListener(serverPort, new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { setValid(checkPortsUnique()); } }); addPropertyChangeListener(httpServerPort, new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { setValid(checkPortsUnique()); } }); }
From source file:com.amazonaws.eclipse.ec2.preferences.ExternalToolsPreferencePage.java
License:Apache License
@Override protected Control createContents(Composite parent) { Composite top = new Composite(parent, SWT.LEFT); // Sets the layout data for the top composite's // place in its parent's layout. top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); top.setLayout(new GridLayout()); Group sshClientGroup = new Group(top, SWT.LEFT); sshClientGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); sshClientGroup.setText("SSH Client:"); PlatformUtils platformUtils = new PlatformUtils(); if (platformUtils.isWindows()) { String puttyUrl = "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html"; WebLinkListener webLinkListener = new WebLinkListener(); Link l = new Link(sshClientGroup, SWT.NONE); l.setText("PuTTY is required for remote shell connections " + "to EC2 instances from Windows. \nYou can download it for free " + "from <a href=\"" + puttyUrl + "\">" + puttyUrl + "</a>."); l.addListener(SWT.Selection, webLinkListener); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = MAX_FIELD_EDITOR_COLUMNS; l.setLayoutData(data);//from w ww . j a v a 2 s.co m puttyExecutable = newFileFieldEditor(PreferenceConstants.P_PUTTY_EXECUTABLE, "PuTTY Executable:", sshClientGroup); } else { // For the Mac, we use a custom AppleScript script that we ship with the // plugin so we don't need a seperate terminal exectuable. if (!platformUtils.isMac()) { terminalExecutable = newFileFieldEditor(PreferenceConstants.P_TERMINAL_EXECUTABLE, "Terminal:", sshClientGroup); } sshClient = newFileFieldEditor(PreferenceConstants.P_SSH_CLIENT, "SSH Client:", sshClientGroup); sshOptions = new StringFieldEditor(PreferenceConstants.P_SSH_OPTIONS, "SSH Options: ", sshClientGroup); sshOptions.setPage(this); sshOptions.setPreferenceStore(this.getPreferenceStore()); sshOptions.load(); sshOptions.fillIntoGrid(sshClientGroup, MAX_FIELD_EDITOR_COLUMNS); } sshUser = new StringFieldEditor(PreferenceConstants.P_SSH_USER, "SSH User: ", sshClientGroup); sshUser.setPage(this); sshUser.setPreferenceStore(this.getPreferenceStore()); sshUser.load(); sshUser.fillIntoGrid(sshClientGroup, MAX_FIELD_EDITOR_COLUMNS); // Reset the layout to three columns after the FieldEditors have mucked with it GridLayout layout = (GridLayout) (sshClientGroup.getLayout()); layout.numColumns = MAX_FIELD_EDITOR_COLUMNS; layout.marginWidth = 10; layout.marginHeight = 8; return top; }
From source file:com.android.ide.eclipse.adt.internal.preferences.LaunchPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(AdtPrefs.PREFS_EMU_OPTIONS, Messages.LaunchPreferencePage_Default_Emu_Options, getFieldEditorParent())); addField(new StringFieldEditor(AdtPrefs.PREFS_HOME_PACKAGE, Messages.LaunchPreferencePage_Default_HOME_Package, getFieldEditorParent())); }
From source file:com.android.ide.eclipse.adt.preferences.LaunchPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(AdtPlugin.PREFS_EMU_OPTIONS, Messages.LaunchPreferencePage_Default_Emu_Options, getFieldEditorParent())); addField(new StringFieldEditor(AdtPlugin.PREFS_HOME_PACKAGE, Messages.LaunchPreferencePage_Default_HOME_Package, getFieldEditorParent())); }
From source file:com.android.ide.eclipse.ddms.preferences.PreferencePage.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 w w . j av a 2 s . c o m @Override public void createFieldEditors() { IntegerFieldEditor ife; ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_DEBUG_PORT_BASE, Messages.PreferencePage_Base_Local_Debugger_Port, getFieldEditorParent()); ife.setValidRange(1024, 32767); addField(ife); BooleanFieldEditor bfe; bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_THREAD_UPDATE, Messages.PreferencePage_Thread_Updates_Enabled_By_Default, getFieldEditorParent()); addField(bfe); bfe = new BooleanFieldEditor(PreferenceInitializer.ATTR_DEFAULT_HEAP_UPDATE, Messages.PreferencePage_Heap_Updates_Enabled_Default, getFieldEditorParent()); addField(bfe); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_THREAD_INTERVAL, Messages.PreferencePage_Thread_Status_Refresh_Interval, getFieldEditorParent()); ife.setValidRange(1, 60); addField(ife); if (InstallDetails.isAdtInstalled()) { ComboFieldEditor cfe = new ComboFieldEditor(PreferenceInitializer.ATTR_HPROF_ACTION, Messages.PreferencePage_HPROF_Action, new String[][] { { Messages.PreferencePage_Save_Disk, HProfHandler.ACTION_SAVE }, { Messages.PreferencePage_Open_Eclipse, HProfHandler.ACTION_OPEN }, }, getFieldEditorParent()); addField(cfe); } mProfilerBufsize = new IntegerFieldEditor(PreferenceInitializer.ATTR_PROFILER_BUFSIZE_MB, "Method Profiler buffer size (MB):", getFieldEditorParent()); addField(mProfilerBufsize); ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_TIME_OUT, Messages.PreferencePage_ADB_Connection_Time_Out, getFieldEditorParent()); addField(ife); RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor(PreferenceInitializer.ATTR_LOG_LEVEL, Messages.PreferencePage_Logging_Level, 1, new String[][] { { Messages.PreferencePage_Verbose, LogLevel.VERBOSE.getStringValue() }, { Messages.PreferencePage_Debug, LogLevel.DEBUG.getStringValue() }, { Messages.PreferencePage_Info, LogLevel.INFO.getStringValue() }, { Messages.PreferencePage_Warning, LogLevel.WARN.getStringValue() }, { Messages.PreferencePage_Error, LogLevel.ERROR.getStringValue() }, { Messages.PreferencePage_Assert, LogLevel.ASSERT.getStringValue() } }, getFieldEditorParent(), true); addField(rgfe); mUseAdbHost = new BooleanFieldEditor(PreferenceInitializer.ATTR_USE_ADBHOST, Messages.PreferencePage_Use_Adbhost, getFieldEditorParent()); addField(mUseAdbHost); mAdbHostValue = new StringFieldEditor(PreferenceInitializer.ATTR_ADBHOST_VALUE, Messages.PreferencePage_Adbhost_value, getFieldEditorParent()); mAdbHostValue.setEnabled(getPreferenceStore().getBoolean(PreferenceInitializer.ATTR_USE_ADBHOST), getFieldEditorParent()); addField(mAdbHostValue); }
From source file:com.appnativa.studio.preferences.MainPreferencePage.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 a2 s.c om */ public void createFieldEditors() { DirectoryFieldEditor df; StringFieldEditor sf; addField(df = new DirectoryFieldEditorEx(PreferenceConstants.APPNATIVA_PATH, Studio.getResourceAsString("Studio.text.wizard.chooseAppNativaSDK") + ":", getFieldEditorParent())); df.setEmptyStringAllowed(false); df.setErrorMessage(Studio.getResourceAsString("Studio.text.wizard.help.directoryAppnativa")); addField(df = new DirectoryFieldEditorEx(PreferenceConstants.ANDROID_PATH, string("Studio.text.wizard.chooseAndroidSDK") + ":", getFieldEditorParent())); df.setErrorMessage(string("Studio.text.wizard.help.directoryAndroid")); df.setErrorMessage(string("Studio.text.wizard.help.directoryXCode")); addField(sf = new StringFieldEditor(PreferenceConstants.SMALL_SCREEN_SIZE, string("Studio.text.wizard.smallPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreen")); addField(sf = new StringFieldEditor(PreferenceConstants.SMALL_SCREEN_SIZE_WITH_MEDIUM, string("Studio.text.wizard.smallMedPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreenMedium")); addField(sf = new StringFieldEditor(PreferenceConstants.MEDIUM_SCREEN_SIZE, string("Studio.text.wizard.mediumPointSize") + ":", getFieldEditorParent())); sf.setErrorMessage(string("Studio.text.wizard.help.smallScreenMedium")); addField(sf = new StringFieldEditor(PreferenceConstants.ORGANIZATION_NAME, string("Studio.text.wizard.organizationName") + ":", getFieldEditorParent())); addField(sf = new StringFieldEditor(PreferenceConstants.PACKAGE_NAME, string("Studio.text.wizard.packageName") + ":", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.CANVAS_COLOR, "Canvas Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.GRID_COLOR, "Grid Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.SELECTION_COLOR, "Selection Color", getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.TRACKING_COLOR, "Cell Tracking Color", getFieldEditorParent())); setValid(getAppNativaSDKDirectory() != null); }
From source file:com.aptana.editor.common.preferences.CommonEditorPreferencePage.java
License:Open Source License
/** * Create the Content Assist group and options if there are any for this language/editor. * /*from w w w .ja v a2 s . c o m*/ * @param parent */ protected Composite createContentAssistOptions(Composite parent) { IPreferenceStore s = getChainedEditorPreferenceStore(); Label label = new Label(parent, SWT.NONE); label.setText(Messages.CommonEditorPreferencePage_OnTypingCharacters); label.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); if (s.contains( com.aptana.editor.common.contentassist.IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS)) { addField(new StringFieldEditor( com.aptana.editor.common.contentassist.IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS, Messages.CommonEditorPreferencePage_DisplayProposals, parent)); } if (s.contains( com.aptana.editor.common.contentassist.IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS)) { addField(new StringFieldEditor( com.aptana.editor.common.contentassist.IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS, Messages.CommonEditorPreferencePage_DisplayContextualInfo, parent)); } if (s.contains(com.aptana.editor.common.contentassist.IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS)) { addField(new StringFieldEditor( com.aptana.editor.common.contentassist.IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS, Messages.CommonEditorPreferencePage_InsertProposal, parent)); } return parent; }
From source file:com.aptana.editor.html.preferences.HTMLPreferencePage.java
License:Open Source License
private void createOutlineOptions(Composite outlineGroup) { addField(new StringFieldEditor(IPreferenceConstants.HTML_OUTLINE_TAG_ATTRIBUTES_TO_SHOW, Messages.HTMLPreferencePage_LBL_TagAttributes, outlineGroup)); }
From source file:com.aptana.editor.js.preferences.NodePreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { // Node Executable location FileFieldEditor fileEditor = new FileFieldEditor(IPreferenceConstants.NODEJS_EXECUTABLE_PATH, StringUtil.makeFormLabel(Messages.NodePreferencePage_LocationLabel), true, FileFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()) { @Override/* w w w. java 2s .co m*/ protected boolean doCheckState() { // Now check that the executable is ok String text = getTextControl().getText(); if (!StringUtil.isEmpty(text)) { IStatus status = getNodeService().acceptBinary(Path.fromOSString(text)); if (!status.isOK()) { setErrorMessage(status.getMessage()); return false; } } return true; } }; addField(fileEditor); sfe = new StringFieldEditor("some_non_existent_pref_key", //$NON-NLS-1$ StringUtil.makeFormLabel(Messages.NodePreferencePage_DetectedPathLabel), fep = getFieldEditorParent()); addField(sfe); // Node Source location sourceEditor = new DirectoryFieldEditor(IPreferenceConstants.NODEJS_SOURCE_PATH, StringUtil.makeFormLabel(Messages.NodePreferencePage_SourceLocationLabel), getFieldEditorParent()) { @Override public int getNumberOfControls() { return super.getNumberOfControls() + 1; } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns - 1); createDownloadButton(parent); Text textControl = getTextControl(); ((GridData) textControl.getLayoutData()).widthHint = convertHorizontalDLUsToPixels(textControl, 180); } @Override protected void adjustForNumColumns(int numColumns) { super.adjustForNumColumns(numColumns - 1); } @Override protected boolean doCheckState() { // Now check that the dir is ok String text = getTextControl().getText(); if (!StringUtil.isEmpty(text)) { IPath path = Path.fromOSString(text); IStatus status = getNodeService().validateSourcePath(path); if (!status.isOK()) { setErrorMessage(status.getMessage()); return false; } } return true; } // Create the NodeJS download button private Button createDownloadButton(Composite parent) { Button downloadBt = new Button(parent, SWT.PUSH); downloadBt.setText(Messages.NodePreferencePage_downloadButtonText); downloadBt.setFont(parent.getFont()); GridData gd = GridDataFactory.fillDefaults().create(); int widthHint = convertHorizontalDLUsToPixels(downloadBt, IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, downloadBt.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); downloadBt.setLayoutData(gd); downloadBt.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { downloadNodeJS(); } }); return downloadBt; } }; addField(sourceEditor); }
From source file:com.aptana.ide.core.ui.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 ww . j a v a 2s. c o m*/ public void createFieldEditors() { Composite c = createGroup(getFieldEditorParent(), Messages.GeneralPreferencePage_UserPreferences); addField(new StringFieldEditor(IPreferenceConstants.PREF_USER_NAME, Messages.GeneralPreferencePage_EmailAddressForBugReports, c)); }