List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, int width, int strategy, Composite parent)
From source file:com.skratchdot.electribe.model.esx.preferences.EsxPreferencePageExport.java
License:Open Source License
/** * Create contents of the preference page. *///from ww w .ja va 2 s . c o m @Override protected void createFieldEditors() { // Create the field editors addField(new StringFieldEditor(EsxPreferenceNames.EXPORT_FILENAME_FORMAT, "Exported Filename Format:", -1, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent())); }
From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.preferences.RPackagesPreferencePage.java
License:Open Source License
/** * Create contents of the preference page */// ww w .ja va2 s . com @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 www. ja va2 s . c o 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:org.eclipse.egit.ui.internal.preferences.DateFormatPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { String[][] values = new String[DATA.size()][2]; int i = 0;//w w w . j a v a 2s . c om for (Map.Entry<GitDateFormatter.Format, FormatInfo> entry : DATA.entrySet()) { values[i][0] = entry.getValue().name; values[i][1] = entry.getKey() == null ? UIPreferences.DATE_FORMAT_CUSTOM : entry.getKey().name(); i++; } final Composite pane = getFieldEditorParent(); formatChooser = new ComboFieldEditor(UIPreferences.DATE_FORMAT_CHOICE, UIText.DateFormatPreferencePage_formatChooser_label, values, pane); addField(formatChooser); dateFormat = new StringFieldEditor(UIPreferences.DATE_FORMAT, UIText.DateFormatPreferencePage_formatInput_label, StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, pane) { @Override protected boolean doCheckState() { // Validate the contents. If we're disabled, we're showing some // built-in format string, which we always consider as valid. if (!getTextControl(pane).isEnabled()) { return true; } try { updatePreview(new SimpleDateFormat(getStringValue().trim())); return true; } catch (IllegalArgumentException e) { dateFormatPreview.setText(""); //$NON-NLS-1$ return false; } } @Override protected void doLoad() { // Set explicitly below } @Override protected void doStore() { // Never store invalid values, or built-in values if (getTextControl(pane).isEnabled() && doCheckState()) { super.doStore(); } } @Override public void setStringValue(String value) { super.setStringValue(value); refreshValidState(); } }; dateFormat.setEmptyStringAllowed(false); dateFormat.setErrorMessage(UIText.DateFormatPreferencePage_invalidDateFormat_message); addField(dateFormat); // We know that the layout will have two columns Label dpLabel = SWTUtils.createLabel(pane, UIText.DateFormatPreferencePage_datePreview_label); dpLabel.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); dateFormatPreview = SWTUtils.createLabel(pane, null, 1); Label dummyLabel = SWTUtils.createLabel(pane, ""); //$NON-NLS-1$ dummyLabel.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); formatExplanation = new Label(pane, SWT.LEFT | SWT.WRAP); GridData layout = SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, true); formatExplanation.setLayoutData(layout); // Setup based on initial values. We don't get any events by the editors // on initial load! lastCustomValue = getPreferenceStore().getString(UIPreferences.DATE_FORMAT); String initialValue = getPreferenceStore().getString(UIPreferences.DATE_FORMAT_CHOICE); updateFields(initialValue); }
From source file:org.objectstyle.wolips.ui.preferences.WOLipsPropertiesPreferencesPage.java
License:Open Source License
public void createFieldEditors() { int widthInChars = 50; // MS: WOLips Properties is set in a different preferences store, so we want to hijack this one field editor to use the primary preferences store _wolipsPropertiesFieldEditor = new StringFieldEditor(Preferences.PREF_WOLIPS_PROPERTIES_FILE, "WOLips Properties File", widthInChars, StringFieldEditor.VALIDATE_ON_FOCUS_LOST, getFieldEditorParent()) {//www . j av a2 s. c om @Override public void setPreferenceStore(IPreferenceStore store) { super.setPreferenceStore(store == null ? null : Preferences.getPreferenceStore()); } public void loadDefault() { super.loadDefault(); // MS: I have no idea why this isn't resetting ... getTextControl().setText(getPreferenceStore().getDefaultString(getPreferenceName())); } }; addField(_wolipsPropertiesFieldEditor); addField(new WOLipsDirectoryFieldEditor(WOVariables.NETWORK_FRAMEWORKS, "Network Frameworks", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.SYSTEM_FRAMEWORKS, "System Frameworks", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.LOCAL_FRAMEWORKS, "Local Frameworks", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.USER_FRAMEWORKS, "User Frameworks", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.NETWORK_ROOT, "Network Root", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.SYSTEM_ROOT, "System Root", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.LOCAL_ROOT, "Local Root", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.USER_ROOT, "User Root", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.WEBOBJECTS_EXTENSIONS, "WebObjects Extensions", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.APPS_ROOT, "Installed Applications", widthInChars, getFieldEditorParent())); addField(new WOLipsDirectoryFieldEditor(WOVariables.API_ROOT_KEY, "WebObjects Javadoc", widthInChars, getFieldEditorParent())); }
From source file:org.rdkit.knime.extensions.aggregration.RDKitMcsAggregationPreferencePage.java
License:Open Source License
/** {@inheritDoc} */ @Override// w ww .j a v a2 s.c o m protected void createFieldEditors() { m_editorThreshold = new StringFieldEditor(PREF_KEY_THRESHOLD, "Threshold (0.0 < t <= 1.0): ", StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, getFieldEditorParent()); addField(m_editorThreshold); m_editorRingMatchesRingOnlyOption = new BooleanFieldEditor(PREF_KEY_RING_MATCHES_RING_ONLY_OPTION, "Ring matches ring only", getFieldEditorParent()); addField(m_editorRingMatchesRingOnlyOption); m_editorCompleteRingsOnlyOption = new BooleanFieldEditor(PREF_KEY_COMPLETE_RINGS_ONLY_OPTION, "Complete rings only", getFieldEditorParent()); addField(m_editorCompleteRingsOnlyOption); m_editorMatchValencesOption = new BooleanFieldEditor(PREF_KEY_MATCH_VALENCES_OPTION, "Match valences", getFieldEditorParent()); addField(m_editorMatchValencesOption); final String[][] arrAtomComparisons = new String[AtomComparison.values().length][2]; int i = 0; for (final AtomComparison comp : AtomComparison.values()) { arrAtomComparisons[i][0] = comp.toString(); arrAtomComparisons[i][1] = comp.name(); i++; } m_editorAtomComparison = new ComboFieldEditor(PREF_KEY_ATOM_COMPARISON, "Atom comparison: ", arrAtomComparisons, getFieldEditorParent()); addField(m_editorAtomComparison); final String[][] arrBondComparisons = new String[BondComparison.values().length][2]; i = 0; for (final BondComparison comp : BondComparison.values()) { arrBondComparisons[i][0] = comp.toString(); arrBondComparisons[i][1] = comp.name(); i++; } m_editorBondComparison = new ComboFieldEditor(PREF_KEY_BOND_COMPARISON, "Bond comparison: ", arrBondComparisons, getFieldEditorParent()); addField(m_editorBondComparison); m_editorTimeout = new IntegerFieldEditor(PREF_KEY_TIMEOUT, "Timeout (in seconds): ", getFieldEditorParent()); m_editorTimeout.setValidRange(1, Integer.MAX_VALUE); ; addField(m_editorTimeout); }
From source file:org.soyatec.tooling.gef.properties.ViewPropertyTab.java
License:Open Source License
private FieldEditor createFieldEditor(final Composite parent, final EStructuralFeature feature) { final String name = feature.getName(); final String label = getFeatureLabel(feature); if (ES_BACKGROUND == feature || ES_FOREGROUND == feature || ES_GRADIENT_COLOR == feature || ES_LINE_COLOR == feature) { return new ColorFieldEditor(name, label, parent); } else if (ES_GRADIENT_VERTICAL == feature) { return new ComboFieldEditor(name, label, new String[][] { { ResourcesFactory.getString("properties_vertical"), "true" }, //$NON-NLS-1$//$NON-NLS-2$ { ResourcesFactory.getString("properties_horizontal"), "false" } }, //$NON-NLS-1$//$NON-NLS-2$ parent);// w w w . j a va 2s.c om } else { final Class<?> instanceClass = feature.getEType().getInstanceClass(); if (boolean.class == instanceClass) { return new BooleanFieldEditor(name, label, parent); } else if (int.class == instanceClass) { return new SpinnerFieldEditor(name, label, parent, 1, 10, 1, 1); } } return new StringFieldEditor(name, label, StringFieldEditor.UNLIMITED, StringFieldEditor.VALIDATE_ON_KEY_STROKE, parent); }