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:com.arc.cdt.debug.seecode.internal.ui.SeeCodePreferencePage.java
License:Open Source License
private SCIntegerFieldEditor createIntField(String preference, String name, String label, String tooltip, Composite parent, int lowValue, int highValue) { SCIntegerFieldEditor toText = new SCIntegerFieldEditor(preference, label, parent); if (tooltip != null) toText.setToolTipText(tooltip);/* w w w . ja v a2s . c o m*/ GridData data = new GridData(); data.widthHint = convertWidthInCharsToPixels(10); toText.getTextControl(parent).setLayoutData(data); toText.setPreferenceStore(getSCCorePreferenceStore()); toText.setPage(this); toText.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); toText.setValidRange(lowValue, highValue); String minValue = Integer.toString(lowValue); String maxValue = Integer.toString(highValue); toText.setErrorMessage(MessageFormat.format("The {2} value range is [{0},{1}]", minValue, maxValue, name)); //$NON-NLS-1$ toText.load(); return toText; }
From source file:com.ebmwebsourcing.petals.services.preferences.MavenPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout);// w ww . ja va 2 s .c om container.setLayoutData(new GridData(GridData.FILL_BOTH)); // Petals Maven plug-in Group group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(3, false)); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 4; group.setLayoutData(layoutData); group.setText("Petals Maven plug-in"); Composite subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.pluginVersionField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_PLUGIN_VERSION, "Plugin Version:", StringFieldEditor.UNLIMITED, subContainer); this.pluginVersionField.fillIntoGrid(subContainer, 3); this.pluginVersionField.setPage(this); this.pluginVersionField.setPreferenceStore(getPreferenceStore()); this.pluginVersionField.load(); this.groupIdField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_GROUP_ID, "Group ID:", StringFieldEditor.UNLIMITED, subContainer); this.groupIdField.fillIntoGrid(subContainer, 3); this.groupIdField.setPage(this); this.groupIdField.setPreferenceStore(getPreferenceStore()); this.groupIdField.load(); this.pomParentField = new FileUrlFieldEditor(PreferencesManager.PREFS_MAVEN_POM_PARENT, "POM Parent:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, subContainer); this.pomParentField.setFileExtensions(new String[] { "*.xml" }); this.pomParentField.setPage(this); this.pomParentField.setPreferenceStore(getPreferenceStore()); this.pomParentField.load(); // Work with customized POM group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(4, false)); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM customization"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.defaultButton = new Button(subContainer, SWT.RADIO); this.defaultButton.setText("Use default POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.defaultButton.setLayoutData(layoutData); this.customizedButton = new Button(subContainer, SWT.RADIO); this.customizedButton.setText("Use customized POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.customizedButton.setLayoutData(layoutData); // The next field must only validate the location if it is enabled this.customizedPomLocationField = new DirectoryFieldEditor(PreferencesManager.PREFS_CUSTOMIZED_POM_LOCATION, "POM templates:", subContainer) { @Override protected boolean checkState() { boolean result = true; if (MavenPreferencePage.this.useCustomizedPom) result = super.checkState(); else clearErrorMessage(); return result; } @Override public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); valueChanged(); } }; this.customizedPomLocationField.setErrorMessage("The POM templates location is not a valid directory."); this.customizedPomLocationField.setPage(this); this.customizedPomLocationField.setPreferenceStore(getPreferenceStore()); this.customizedPomLocationField.load(); // Add a hyper link to generate the default POM final Link hyperlink = new Link(subContainer, SWT.NONE); hyperlink.setText("<A>Generate the default POM templates</A>"); layoutData = new GridData(SWT.TRAIL, SWT.DEFAULT, true, false); layoutData.horizontalSpan = 2; hyperlink.setLayoutData(layoutData); // Add the listeners this.customizedPomLocationField.setPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (FieldEditor.VALUE.equals(event.getProperty())) { boolean valid = MavenPreferencePage.this.customizedPomLocationField.isValid(); hyperlink.setEnabled(valid); setValid(valid); } } }); SelectionListener selectionListener = new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { MavenPreferencePage.this.useCustomizedPom = MavenPreferencePage.this.customizedButton .getSelection(); MavenPreferencePage.this.customizedPomLocationField.setEnabled( MavenPreferencePage.this.useCustomizedPom, MavenPreferencePage.this.customizedButton.getParent()); if (MavenPreferencePage.this.useCustomizedPom) hyperlink.setEnabled(MavenPreferencePage.this.customizedPomLocationField.isValid()); else hyperlink.setEnabled(false); } }; this.defaultButton.addSelectionListener(selectionListener); this.customizedButton.addSelectionListener(selectionListener); this.defaultButton.setSelection(!this.useCustomizedPom); this.customizedButton.setSelection(this.useCustomizedPom); this.customizedButton.notifyListeners(SWT.Selection, new Event()); hyperlink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Get the situation File rootDirectory = new File(MavenPreferencePage.this.customizedPomLocationField.getStringValue()); File suPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SU_POM); File saPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SA_POM); boolean overwrite = false; if (suPom.exists() || saPom.exists()) { String msg = "Some of the default POM templates already exist.\nDo you want to overwrite them?"; overwrite = MessageDialog.openQuestion(hyperlink.getShell(), "Overwrite Templates", msg); } // Create the SU template boolean ok = true; if (!suPom.exists() || overwrite) { File tpl = getBundledTemplateFile(true); try { IoUtils.copyStream(tpl, suPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Create the SA template if (!saPom.exists() || overwrite) { File tpl = getBundledTemplateFile(false); try { IoUtils.copyStream(tpl, saPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Report the result if (ok) { MessageDialog.openInformation(hyperlink.getShell(), "Successful Creation", "The default POM templates were successfully created."); } else { MessageDialog.openError(hyperlink.getShell(), "Error during the Creation", "The default POM templates could not be created correctly.\nCheck the log for more details."); } } }); // Update POM dependencies automatically group = new Group(container, SWT.NONE); group.setLayout(new GridLayout()); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM dependencies"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); this.autoPomUpdateField = new BooleanFieldEditor(PreferencesManager.PREFS_UPDATE_MAVEN_POM, "Update POM dependencies automatically (SA projects)", subContainer); this.autoPomUpdateField.setPage(this); this.autoPomUpdateField.setPreferenceStore(getPreferenceStore()); this.autoPomUpdateField.load(); return container; }
From source file:com.liferay.ide.debug.ui.DebugPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Group group = SWTUtil.createGroup(getFieldEditorParent(), "FreeMarker Debugger", 1); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd);/*from w w w.j a v a 2s . com*/ Composite composite = SWTUtil.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL); StringFieldEditor passwordEditor = new StringFieldEditor(LiferayDebugCore.PREF_FM_DEBUG_PASSWORD, "Password:", composite); //$NON-NLS-1$ passwordEditor.setPreferenceStore(getPreferenceStore()); addField(passwordEditor); IntegerFieldEditor portEditor = new IntegerFieldEditor(LiferayDebugCore.PREF_FM_DEBUG_PORT, "Port:", //$NON-NLS-1$ composite); portEditor.setPreferenceStore(getPreferenceStore()); portEditor.setErrorMessage("Port value must be an integer."); //$NON-NLS-1$ portEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); addField(portEditor); }
From source file:com.liferay.ide.portal.ui.debug.DebugPreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { Group group = SWTUtil.createGroup(getFieldEditorParent(), "FreeMarker Debugger", 1); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd);//from w ww . jav a 2 s .com Composite composite = SWTUtil.createComposite(group, 2, 2, GridData.FILL_HORIZONTAL); passwordEditor = new MyStringFieldEditor(PortalCore.PREF_FM_DEBUG_PASSWORD, "Password:", composite); passwordEditor.setEmptyStringAllowed(false); passwordEditor.setErrorMessage("Password is invalid."); passwordEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); passwordEditor.setPreferenceStore(getPreferenceStore()); addField(passwordEditor); portEditor = new MyIntegerFieldEditor(PortalCore.PREF_FM_DEBUG_PORT, "Port:", composite); //$NON-NLS-1$ portEditor.setValidRange(1025, 65535); portEditor.setEmptyStringAllowed(false); portEditor.setErrorMessage("Port value ranges from integer 1025 to 65535."); //$NON-NLS-1$ portEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); portEditor.setPreferenceStore(getPreferenceStore()); addField(portEditor); }
From source file:com.nokia.cdt.debug.cw.symbian.ui.GlobalSettings.java
License:Open Source License
protected Control createContents(Composite parent) { // The main composite Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;// w ww . ja va2 s . c o m layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.horizontalAlignment = GridData.FILL; composite.setLayoutData(gridData); createSpacer(composite, 1); Composite icomp = null; // we use this variable for intermediate // composites ( // checkbox: show dynamic runtime type ? icomp = new Composite(composite, SWT.NULL); gridData = new GridData(SWT.HORIZONTAL); gridData.horizontalSpan = 2; icomp.setLayoutData(gridData); m_showRTTI = new BooleanFieldEditor2(PreferenceConstants.J_PN_ShowRuntimeType, DebuggerUIMessages.GlobalSettings_attempt_show_dynamic, icomp); m_showRTTI.setPage(this); m_showRTTI.setPreferenceStore(m_prefStore); m_showRTTI.load(); m_showRTTI.setPropertyChangeListener(this); m_showRTTI.setToolTipText(icomp, DebuggerUIMessages.GlobalSettings_rtti_tooltip); // checkbox: do not step into runtime code ? icomp = new Composite(composite, SWT.NULL); gridData = new GridData(SWT.HORIZONTAL); gridData.horizontalSpan = 2; icomp.setLayoutData(gridData); m_notStepInRuntimeCode = new BooleanFieldEditor2(PreferenceConstants.J_PN_NotStepInRuntimeCode, DebuggerUIMessages.GlobalSettings_do_not_step_into_rt_support, icomp); m_notStepInRuntimeCode.setPage(this); m_notStepInRuntimeCode.setPreferenceStore(m_prefStore); m_notStepInRuntimeCode.load(); m_notStepInRuntimeCode.setPropertyChangeListener(this); m_notStepInRuntimeCode.setToolTipText(icomp, DebuggerUIMessages.GlobalSettings_step_in_runtime_tooltip); // entry field: default size for unbounded arrays m_arraySize_parent = new Composite(composite, SWT.NULL); m_arraySize = new IntegerFieldEditor(PreferenceConstants.J_PN_DefaultArraySize, DebuggerUIMessages.GlobalSettings_default_size_for_unbounded_arrays, m_arraySize_parent); m_arraySize.setPage(this); m_arraySize.setPreferenceStore(m_prefStore); m_arraySize.load(); m_arraySize.setPropertyChangeListener(this); gridData = new GridData(); gridData.widthHint = convertWidthInCharsToPixels(8); m_arraySize.getTextControl(m_arraySize_parent).setLayoutData(gridData); m_arraySize.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); m_arraySize.setValidRange(0, Integer.MAX_VALUE); m_arraySize.setErrorMessage(DebuggerUIMessages.GlobalSettings_invalid_array_size); m_arraySize.getLabelControl(m_arraySize_parent) .setToolTipText(DebuggerUIMessages.GlobalSettings_default_array_tooltip); m_arraySize.load(); // checkbox: show dynamic runtime type ? icomp = new Composite(composite, SWT.NULL); gridData = new GridData(SWT.HORIZONTAL); gridData.horizontalSpan = 2; icomp.setLayoutData(gridData); m_findSourceOutsideSDK = new BooleanFieldEditor2(CWPlugin.PSC_FindSourceOutsideWorkspace, DebuggerUIMessages.GlobalSettings_findOutside, icomp); m_findSourceOutsideSDK.setPage(this); m_findSourceOutsideSDK.setPreferenceStore(m_prefStore); m_findSourceOutsideSDK.load(); m_findSourceOutsideSDK.setPropertyChangeListener(this); m_findSourceOutsideSDK.setToolTipText(icomp, DebuggerUIMessages.GlobalSettings_foundOutsideTooltip); // entry field: interval for auto-refreshing of data in OS View. icomp = new Composite(composite, SWT.NULL); m_osViewRefreshInterval = new IntegerFieldEditor(PreferenceConstants.J_PN_OSViewAutoRefreshInterval, DebuggerUIMessages.GlobalSettings_refresh_time_interval, icomp); m_osViewRefreshInterval.setPage(this); m_osViewRefreshInterval.setPreferenceStore(m_prefStore); m_osViewRefreshInterval.setPropertyChangeListener(this); gridData = new GridData(); gridData.widthHint = convertWidthInCharsToPixels(8); m_osViewRefreshInterval.getTextControl(icomp).setLayoutData(gridData); m_osViewRefreshInterval.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); m_osViewRefreshInterval.setValidRange(3, 600); m_osViewRefreshInterval.setErrorMessage(DebuggerUIMessages.GlobalSettings_invalid_time_interval); m_osViewRefreshInterval.getLabelControl(icomp) .setToolTipText(DebuggerUIMessages.GlobalSettings_refresh_interval); m_osViewRefreshInterval.load(); Group group = ControlFactory.createGroup(composite, DebuggerUIMessages.GlobalSettings_debug_engine, 2); // Hide the DE launch settings in a production build (unless overriden with a property) group.setVisible( m_corePlugin.isDebugEnvironment() || System.getProperty("cw.showDeGlobalSettings") != null); // $NON-NLS-1$ //$NON-NLS-1$ // Auto Launch DE checkbox icomp = new Composite(group, SWT.NULL); gridData = new GridData(SWT.HORIZONTAL); gridData.horizontalSpan = 2; icomp.setLayoutData(gridData); m_autoLaunchDE = new BooleanFieldEditor2(PreferenceConstants.J_PN_AutoLaunchDE, DebuggerUIMessages.GlobalSettings_automatic_launch_de_server, icomp); m_autoLaunchDE.setPage(this); m_autoLaunchDE.setPreferenceStore(m_prefStore); m_autoLaunchDE.load(); m_autoLaunchDE.setPropertyChangeListener(this); m_autoLaunchDE.setToolTipText(icomp, "Launch the Debugger Engine, otherwise assume it is already running."); //$NON-NLS-1$ // DE Launch Timeout text edit field m_deTimeout_parent = new Composite(group, SWT.NULL); m_deTimeout = new IntegerFieldEditor(PreferenceConstants.J_PN_DELaunchTimeout, DebuggerUIMessages.GlobalSettings_timeout_secs, m_deTimeout_parent); m_deTimeout.setPage(this); m_deTimeout.setPreferenceStore(m_prefStore); m_deTimeout.load(); m_deTimeout.setPropertyChangeListener(this); gridData = new GridData(); gridData.widthHint = convertWidthInCharsToPixels(8); m_deTimeout.getTextControl(m_deTimeout_parent).setLayoutData(gridData); m_deTimeout.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); m_deTimeout.setValidRange(0, Integer.MAX_VALUE); m_deTimeout.setErrorMessage(DebuggerUIMessages.GlobalSettings_invalid_timeout_range); m_deTimeout.load(); updateControlState(); String helpContextID = CWDebugUIPlugin.getPluginId() + "." + contextHelpID; //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), helpContextID); return composite; }
From source file:com.skratchdot.electribe.model.esx.preferences.EsxPreferencePageExport.java
License:Open Source License
/** * Create contents of the preference page. */// w w w. ja v a2s . c om @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:de.anbos.eclipse.logviewer.plugin.preferences.LogViewerPreferences.java
License:Apache License
private void createBacklogField(Composite composite) { backlogEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_BACKLOG, LogViewerPlugin.getResourceString("preferences.backlog.label.text"), composite); //$NON-NLS-1$ backlogEditor.setPreferenceStore(doGetPreferenceStore()); backlogEditor.setPage(this); backlogEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_BACKLOG).length()); backlogEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.backlog.label.errortext", //$NON-NLS-1$ new Object[] { new Integer(ILogViewerConstants.MAX_BACKLOG) })); backlogEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); backlogEditor.setValidRange(0, ILogViewerConstants.MAX_BACKLOG); backlogEditor.load();//from w w w. java 2 s .c o m backlogEditor.setPropertyChangeListener(validityChangeListener); }
From source file:de.anbos.eclipse.logviewer.plugin.preferences.LogViewerPreferences.java
License:Apache License
private void createReadBufferField(Composite composite) { bufferEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_BUFFER, LogViewerPlugin.getResourceString("preferences.buffer.label.text"), composite); //$NON-NLS-1$ bufferEditor.setPreferenceStore(doGetPreferenceStore()); bufferEditor.setPage(this); bufferEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_TAIL_BUFFER_SIZE).length()); bufferEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.buffer.label.errortext", //$NON-NLS-1$ new Object[] { new Integer(ILogViewerConstants.MAX_TAIL_BUFFER_SIZE) })); bufferEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); bufferEditor.setValidRange(0, ILogViewerConstants.MAX_TAIL_BUFFER_SIZE); bufferEditor.load();/* w w w.j a va 2s . co m*/ bufferEditor.setPropertyChangeListener(validityChangeListener); }
From source file:de.anbos.eclipse.logviewer.plugin.preferences.LogViewerPreferences.java
License:Apache License
private void createReadWaitField(Composite composite) { readWaitEditor = new IntegerFieldEditor(ILogViewerConstants.PREF_READWAIT, LogViewerPlugin.getResourceString("preferences.readwait.label.text"), composite); //$NON-NLS-1$ readWaitEditor.setPreferenceStore(doGetPreferenceStore()); readWaitEditor.setPage(this); readWaitEditor.setTextLimit(Integer.toString(ILogViewerConstants.MAX_READWAIT_SIZE).length()); readWaitEditor.setErrorMessage(LogViewerPlugin.getResourceString("preferences.readwait.label.errortext", //$NON-NLS-1$ new Object[] { new Integer(ILogViewerConstants.MAX_READWAIT_SIZE) })); readWaitEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); readWaitEditor.setValidRange(0, ILogViewerConstants.MAX_READWAIT_SIZE); readWaitEditor.load();//from ww w. ja v a2s . c om readWaitEditor.setPropertyChangeListener(validityChangeListener); }
From source file:de.fhg.igd.mapviewer.server.wms.wizard.pages.WMSLocationFieldEditor.java
License:Open Source License
/** * Default constructor/* w w w. ja va2 s . co m*/ * * @param display the display */ public WMSLocationFieldEditor(Display display) { super(); setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); validator = new ConcurrentValidator(new SwtCallback<Boolean>(display) { @Override protected void error(Throwable e) { setErrorMessage(e.getLocalizedMessage()); updateState(); } @Override protected void finished(Boolean result) { updateState(); } }, false); }