List of usage examples for org.eclipse.jface.preference StringFieldEditor VALIDATE_ON_KEY_STROKE
int VALIDATE_ON_KEY_STROKE
To view the source code for org.eclipse.jface.preference StringFieldEditor VALIDATE_ON_KEY_STROKE.
Click Source Link
0
) indicating that the editor should perform validation after every key stroke. From source file:gov.nasa.ensemble.common.ui.preferences.time.MissionTimePreferencePage.java
License:Open Source License
private IntegerFieldEditor createIntegerFieldEditor(String propertyName, String label, Composite parent) { IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor(propertyName, label, parent, 2); integerFieldEditor.setPreferenceStore(PREFERENCE_STORE); integerFieldEditor.load();//from ww w. java 2 s . c om integerFieldEditor.setValidRange(0, 23); integerFieldEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); return integerFieldEditor; }
From source file:hu.bme.mit.massif.simulink.importer.ui.dialogs.AbstractSimulinkSettingsDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override//ww w. j a v a 2 s .c om public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @Override protected void createFieldEditors() { Composite fieldEditorParent = getFieldEditorParent(); targetDirectoryEditor = new ContainerFieldEditor("", "Target directory:", fieldEditorParent); targetDirectoryEditor.setEmptyStringAllowed(false); targetDirectoryEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); targetDirectoryEditor.setStringValue(targetDirectory.getPath()); addField(targetDirectoryEditor); List<? extends FieldEditor> additionalFields = additionalFields(fieldEditorParent); for (FieldEditor fieldEditor : additionalFields) { addField(fieldEditor); } } @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; page.createControl(composite); Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:io.usethesource.impulse.preferences.fields.DirectoryListFieldEditor.java
License:Open Source License
/** * Creates an IMP directory-list field editor. * Use the method <code>setTextLimit</code> to limit the text. * /* ww w . ja v a 2s .com*/ * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param width the width of the text input field in characters, * or <code>UNLIMITED</code> for no limit * @param parent the parent of the field editor's control */ public DirectoryListFieldEditor(PreferencePage page, PreferencesTab tab, IPreferencesService service, String level, String name, String labelText, int width, Composite parent) { super(page, tab, service, level, name, labelText, width, StringFieldEditor.VALIDATE_ON_KEY_STROKE, parent); prefPage = page; prefTab = tab; this.getChangeControl(parent).setText(PreferenceDialogConstants.BROWSE_LABEL); }
From source file:io.usethesource.impulse.preferences.fields.FileFieldEditor.java
License:Open Source License
/** * Creates an IMP file field editor./*w ww . ja va 2 s. c om*/ * Use the method <code>setTextLimit</code> to limit the text. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param width the width of the text input field in characters, * or <code>UNLIMITED</code> for no limit * @param parent the parent of the field editor's control */ public FileFieldEditor(PreferencePage page, PreferencesTab tab, IPreferencesService service, String level, String name, String labelText, int width, Composite parent) { super(page, tab, service, level, name, labelText, width, StringFieldEditor.VALIDATE_ON_KEY_STROKE, parent); this.getChangeControl(parent).setText(PreferenceDialogConstants.BROWSE_LABEL); }
From source file:net.bioclipse.opentox.prefs.NetworkPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { System.out.println("Creating controls for the OT Network prefs page..."); timeout = new IntegerFieldEditor("HTTPTimeOut", "HTTP Time Out (in s)", parent); timeout.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); timeout.setValidRange(2, 100);// w ww .j a v a 2 s. co m timeout.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (timeout.isValid()) { setErrorMessage(null); setValid(true); return; } setErrorMessage(timeout.getErrorMessage()); setValid(false); } }); shortestTime = new IntegerFieldEditor("ShortestWaitTime", "Shortest Waiting Time (in s)", parent); shortestTime.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); shortestTime.setValidRange(2, 100); shortestTime.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (shortestTime.isValid()) { setErrorMessage(null); setValid(true); return; } setErrorMessage(shortestTime.getErrorMessage()); setValid(false); } }); longestTime = new IntegerFieldEditor("LongestWaitTime", "Longest Waiting Time (in s)", parent); longestTime.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); longestTime.setValidRange(2, 100); longestTime.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (longestTime.isValid()) { setErrorMessage(null); setValid(true); return; } setErrorMessage(longestTime.getErrorMessage()); setValid(false); } }); initializeValues(); return parent; }
From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.RPackagesPreferencePage.java
License:Open Source License
/** * Create contents of the preference page */// w w w .j a v a 2 s .c om @Override protected void createFieldEditors() { addField(new LabelFieldEditor("Built Package Options:", getFieldEditorParent())); addField(new StringFieldEditor("rcmdcheck", "R CMD check", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); addField(new StringFieldEditor("rcmdinstall", "R CMD INSTALL", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); addField(new StringFieldEditor("rcmdbuild", "R CMD build", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new LabelFieldEditor("Knitr Options HTML:", getFieldEditorParent())); addField(new StringFieldEditor("knitroptions", "Knitr Options", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new BooleanFieldEditor("javafxbrowser", "Open HTML in JavaFX browser", StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); }
From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.RServePlotPrefs.java
License:Open Source License
public void createFieldEditors() { addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new LabelFieldEditor("Plot:", getFieldEditorParent())); addField(new BooleanFieldEditor("USE_CUSTOM_DEVICE", "Use Custom Device", BooleanFieldEditor.DEFAULT, getFieldEditorParent()));/*from w ww.ja va 2s . co m*/ selectionDevice = new RadioGroupFieldEditor("PLOT_DEVICE_SELECTION", "Select Device:\nPlease use action \"Apply \" to see changes and after using action \"Restore Defaults\".\nValues in the Device Definition can be changed and will be stored!", 3, new String[][] { { "Image Default", "PLOT_IMAGE" }, { "Image Cairo", "PLOT_CAIRO" }, { "Image Print", "PLOT_PRINT" }, { "PDF", "PLOT_PDF" }, { "SVG", "PLOT_SVG" }, { "PostScript", "PLOT_POSTSCRIPT" }, { "ImageJ View Display Size", "PLOT_IMAGEJ_DISPLAYSIZE" }, { "ImageJ View Display Size Cairo", "PLOT_IMAGEJ_DISPLAYSIZE_CAIRO" }, { "ImageJ Image", "PLOT_IMAGEJ_IMAGESIZE" }, { "ImageJ Image Cairo", "PLOT_IMAGEJ_IMAGESIZE_CAIRO" } }, getFieldEditorParent(), false); addField(selectionDevice); // addField(new StringFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); mult = new MultiLineTextFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); addField(mult); deviceFilename = new StringFieldEditor("DEVICE_FILENAME", "Filename", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); addField(deviceFilename); deviceFilename.setEnabled(false, getFieldEditorParent()); selectPDFReader = new RadioGroupFieldEditor( "PDF_READER", "PDF Reader (Linux):", 4, new String[][] { { "Acrobat", "ACROBAT" }, { "Evince", "EVINCE" }, { "Kpdf", "KPDF" }, { "Xpdf", "XPDF" } }, getFieldEditorParent(), false); addField(selectPDFReader); }
From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.RServePrefs.java
License:Open Source License
public void createFieldEditors() { addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new DirectoryFieldEditor(PreferenceConstants.P_TEMP_R, "Path to temporary R Folder", getFieldEditorParent()));/*from ww w. jav a 2 s.c o m*/ addField(new BooleanFieldEditor("RSERVE_NATIVE_START", "Start Rserve in native R", getFieldEditorParent())); addField(new BooleanFieldEditor("RSERVE_AUTOSTART", "Start Rserve automatically after Plugin start (Not available in native mode connection!)", getFieldEditorParent())); addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN, "Install path at startup", getFieldEditorParent())); addField(new BooleanFieldEditor(PreferenceConstants.R_START_SHELL, "Start with shell", getFieldEditorParent())); selectLinuxShell = new RadioGroupFieldEditor("LINUX_SHELL", "Select Shell (Linux, Mac):", 2, new String[][] { { "xterm (Linux, Mac)", "XTERM" }, { "Gnome (Linux)", "GNOME" } }, getFieldEditorParent(), false); addField(selectLinuxShell); // addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new StringFieldEditor("RSERVE_ARGS", "Rserve startup arguments", getFieldEditorParent())); addField(new MultiLineTextFieldEditor("R_STARTUP_ARGS", "R startup commands", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); addField(new SpacerFieldEditor(getFieldEditorParent())); /* * addField(new LabelFieldEditor("Plot:", getFieldEditorParent())); * addField(new BooleanFieldEditor("USE_CUSTOM_DEVICE", "Use Custom Device", BooleanFieldEditor.DEFAULT, getFieldEditorParent())); * selectionDevice=new RadioGroupFieldEditor("PLOT_DEVICE_SELECTION", "Select Device:\nPlease use action \"Apply \" to see changes and after using action \"Restore Defaults\".\nValues in the Device Definition can be changed and will be stored!", 3, new String[][] { { "Image Default", "PLOT_IMAGE" },{ "Image Cairo", "PLOT_CAIRO" },{ "Image Print", "PLOT_PRINT" }, { "PDF", "PLOT_PDF" },{ "SVG", "PLOT_SVG" },{ "PostScript", "PLOT_POSTSCRIPT" } }, getFieldEditorParent(), false); * addField(selectionDevice); * //addField(new StringFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); * mult=new MultiLineTextFieldEditor("DEVICE_DEFINITION", "Device Definiton", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); * addField(mult); * deviceFilename=new StringFieldEditor("DEVICE_FILENAME", "Filename", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); * addField(deviceFilename); * deviceFilename.setEnabled(false, getFieldEditorParent()); * selectPDFReader=new RadioGroupFieldEditor("PDF_READER", "PDF Reader (Linux):", 4, new String[][] { { "Acrobat", "ACROBAT" },{ "Evince", "EVINCE" },{ "Kpdf", "KPDF" },{ "Xpdf", "XPDF" } }, getFieldEditorParent(), false); * addField(selectPDFReader); * addField(new SpacerFieldEditor(getFieldEditorParent())); */ addField(new LabelFieldEditor("Packages:", getFieldEditorParent())); PackageServer = new StringFieldEditor(PreferenceConstants.PACKAGE_R_SERVER, "Package Server", getFieldEditorParent()); PackageServer.setErrorMessage("Please enter a valid address!"); PackageServer.setEmptyStringAllowed(false); PackageServer.setStringValue("http://cran.r-project.org"); addField(PackageServer); { Composite fieldEditorParent = getFieldEditorParent(); final ComboFieldEditor comboFieldEditor = new ComboFieldEditor("Server", "Select Server", new String[][] { new String[] { "", "" } }, fieldEditorParent); final Combo combo = comboFieldEditor.getComboBoxControl(fieldEditorParent); combo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { PackageServer.setStringValue(webAdresses[combo.getSelectionIndex()]); } }); combo.setItems(new String[] { "Argentina", "Australia", "Austria", "Belgium", "Brazil (PR)", "Brazil (RJ)", "Brazil (SP 1)", "Brazil (SP 2)", "Canada (BC)", "Canada (ON)", "Chile (Santiago)", "Croatia", "Czech Republic", "Denmark", "France (Toulouse)", "France (Paris)", "Germany (Goettingen)", "Germany (Muenchen)", "India", "Ireland", "Italy (Milano)", "Italy (Padua)", "Italy (Palermo)", "Japan (Aizu)", "Japan (Tokyo)", "Japan (Tsukuba)", "Korea", "Mexico", "Netherlands (Amsterdam 2)", "Netherlands (Amsterdam)", "Netherlands (Utrecht)", "New Zealand", "Norway", "Poland (Oswiecim)", "Poland (Wroclaw)", "Portugal", "Slovenia (Ljubljana)", "South Africa", "Spain (Madrid)", "Sweden", "Switzerland (Zuerich)", "Switzerland (Bern)", "Taiwan (Taichung)", "Taiwan (Taipeh)", "Thailand", "UK (Bristol)", "USA (CA 1)", "USA (CA 3)", "USA (IA)", "USA (MI)", "USA (MO)", "USA (NC)", "USA (PA 2)", "USA (PA)", "USA (WA)" }); combo.select(1); addField(comboFieldEditor); } { addField(new DirectoryFieldEditor("InstallLocation", "Package install location", getFieldEditorParent())); addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new LabelFieldEditor("Rserve Remote:", getFieldEditorParent())); addField(new BooleanFieldEditor("REMOTE", "Remote enabled", getFieldEditorParent())); addField(new StringFieldEditor("HOST", "Host name/IP", getFieldEditorParent())); addField(new IntegerFieldEditor("TCP", "TCP port", getFieldEditorParent())); addField(new StringFieldEditor("USERNAME", "Username", getFieldEditorParent())); StringFieldEditor sf = new StringFieldEditor("PASSWORD", "Password", getFieldEditorParent()); sf.getTextControl(getFieldEditorParent()).setEchoChar('*'); addField(sf); } addField(new SpacerFieldEditor(getFieldEditorParent())); { addField(new LabelFieldEditor("Transfer to Table options:", getFieldEditorParent())); addField(new BooleanFieldEditor("TRANSFER_METHOD", "Transfer with \"format\" to Table (default is method \"as.character\")", getFieldEditorParent())); final IntegerFieldEditor integerFieldEditor = new IntegerFieldEditor("DEFAULT_DIGITS", "Digits", getFieldEditorParent()); // integerFieldEditor.setErrorMessage("Please select an integer value!"); integerFieldEditor.setValidRange(1, 100); addField(integerFieldEditor); } addField(new SpacerFieldEditor(getFieldEditorParent())); { addField(new LabelFieldEditor("Sweave/TeX options:", getFieldEditorParent())); addField(new DirectoryFieldEditor("SweaveScriptLocation", "Sweave File Location", getFieldEditorParent())); addField(new DirectoryFieldEditor("pdfLatex", "pdflatex Path", getFieldEditorParent())); } addField(new SpacerFieldEditor(getFieldEditorParent())); }
From source file:net.ostis.scpdev.preferences.ScpEnviromentPreferencePage.java
License:Open Source License
protected void createFieldEditors() { useScCoreHomeField = new BooleanFieldEditor(PreferenceConstants.P_USE_SC_CORE_HOME, "Use enviroment variable SC_CORE_HOME for searching sc-core", getFieldEditorParent()); sccoreDirField = new DirectoryFieldEditorOnKeyStroke(PreferenceConstants.P_SC_CORE_PATH, "SC-core root directory:", getFieldEditorParent()); systemUIStartFileField = new FileFieldEditor(PreferenceConstants.P_SYSTEM_UI_PATH, "UI system path to start script:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent());//from ww w . j ava 2s. co m pythonExecutableField = new FileFieldEditor(PreferenceConstants.P_PYTHON_EXECUTABLE, "Path to python executable:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); addField(useScCoreHomeField); addField(sccoreDirField); addField(systemUIStartFileField); addField(pythonExecutableField); }
From source file:net.refractions.udig.project.ui.internal.wizard.NewProjectWizardPage.java
License:Open Source License
/** * Set up this page for use./* www. ja v a2 s .c om*/ * * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) * @param parent */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); projectNameEditor = new StringFieldEditor("newproject.name", Messages.NewProjectWizardPage_label_projectName, composite) { protected boolean doCheckState() { return validate(); } }; projectNameEditor.setPage(this); projectNameEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); Text textControl = projectNameEditor.getTextControl(composite); GridData gd = new GridData(SWT.LEFT, SWT.NONE, false, false); gd.widthHint = 100; gd.horizontalSpan = 2; textControl.setLayoutData(gd); projectDirectoryEditor = new DirectoryFieldEditor("newproject.directory", Messages.NewProjectWizardPage_label_projectDir, composite) { protected boolean doCheckState() { return validate(); } }; projectDirectoryEditor.setPage(this); projectDirectoryEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); projectDirectoryEditor.fillIntoGrid(composite, 3); String defaultProjectName = Messages.NewProjectWizardPage_default_name; final IPath homepath = Platform.getLocation(); String projectPath = new File(homepath.toString()).getAbsolutePath(); projectNameEditor.setStringValue(defaultProjectName); projectDirectoryEditor.setStringValue(projectPath); composite.pack(); setControl(composite); setPageComplete(true); }