Java Code Examples for org.eclipse.jface.preference.IntegerFieldEditor#setValidateStrategy()
The following examples show how to use
org.eclipse.jface.preference.IntegerFieldEditor#setValidateStrategy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewerSettingsPreferencePage.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * Creates the page components. */ protected void createFieldEditors() { TexlipsePreferencePage.addSpacer(2, getFieldEditorParent()); ViewerListFieldEditor vfe = new ViewerListFieldEditor(TexlipsePlugin.getResourceString("preferenceViewerConfigsLabel"), getFieldEditorParent()); addField(vfe); PlatformUI.getWorkbench().getHelpSystem().setHelp(vfe.getListControl(getFieldEditorParent()), TexlipseHelpIds.VIEWER_LIST); TexlipsePreferencePage.addSpacer(2, getFieldEditorParent()); TexlipsePreferencePage.addSeparator(2, getFieldEditorParent()); TexlipsePreferencePage.addSpacer(2, getFieldEditorParent()); TexlipsePreferencePage.addLabelField(2, TexlipsePlugin.getResourceString("preferenceViewerPortLabel"), getFieldEditorParent()); String message = TexlipsePlugin.getResourceString("preferenceViewerConfigsPort").replaceFirst("%1", "" + MIN_PORT).replaceFirst("%2", "" + MAX_PORT); IntegerFieldEditor port = new IntegerFieldEditor(TexlipseProperties.FILE_LOCATION_PORT, message, getFieldEditorParent()); port.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); port.setValidRange(MIN_PORT, MAX_PORT); addField(port); addField(new BooleanFieldEditor(TexlipseProperties.BUILDER_FORCE_RETURN_FOCUS, TexlipsePlugin.getResourceString("forceReturnFocusOnInverseSearch"), getFieldEditorParent())); addField(new BooleanFieldEditor(TexlipseProperties.BUILDER_RETURN_FOCUS, TexlipsePlugin.getResourceString("preferenceViewerReturnFocusLabel"), getFieldEditorParent())); PlatformUI.getWorkbench().getHelpSystem().setHelp(port.getTextControl(getFieldEditorParent()), TexlipseHelpIds.VIEWER_PORT); }
Example 2
Source File: IndentationPreferencePage.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * Creates the page components. */ protected void createFieldEditors() { TexlipsePreferencePage.addSpacer(getFieldEditorParent()); addField(new BooleanFieldEditor(TexlipseProperties.INDENTATION, TexlipsePlugin.getResourceString("preferenceIndentEnabledLabel"), getFieldEditorParent())); String message = TexlipsePlugin.getResourceString("preferenceIndentLevelLabel").replaceFirst("%1", "" + MIN_INDENTATION).replaceFirst("%2", "" + MAX_INDENTATION); final IntegerFieldEditor indentationWidth = new IntegerFieldEditor(TexlipseProperties.INDENTATION_LEVEL, message, getFieldEditorParent()); indentationWidth.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); indentationWidth.setValidRange(MIN_INDENTATION, MAX_INDENTATION); if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.INDENTATION_TABS)) { indentationWidth.setEnabled(false, getFieldEditorParent()); } addField(indentationWidth); BooleanFieldEditor indentationTabs = new BooleanFieldEditor(TexlipseProperties.INDENTATION_TABS, TexlipsePlugin.getResourceString("preferenceIndentTabsLabel"), getFieldEditorParent()){ @Override protected void valueChanged(boolean oldValue, boolean newValue) { super.valueChanged(oldValue, newValue); if (newValue == true) indentationWidth.setEnabled(false, getFieldEditorParent()); else indentationWidth.setEnabled(true, getFieldEditorParent()); } }; addField(indentationTabs); TexlipsePreferencePage.addSpacer(getFieldEditorParent()); addField(new StringListFieldEditor(TexlipseProperties.INDENTATION_ENVS, TexlipsePlugin.getResourceString("preferenceIndentEnvsLabel"), getFieldEditorParent())); }
Example 3
Source File: ImportPreferencePage.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * 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. */ @Override public void createFieldEditors () { final IntegerFieldEditor fieldEditor = new IntegerFieldEditor ( PreferenceConstants.P_DEFAULT_CHUNK_SIZE, "&Default chunk size:", getFieldEditorParent () ); fieldEditor.setEmptyStringAllowed ( false ); fieldEditor.setValidRange ( 1, Integer.MAX_VALUE ); fieldEditor.setValidateStrategy ( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); addField ( fieldEditor ); }
Example 4
Source File: BibtexPreferencePage.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * 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. */ public void createFieldEditors() { TexlipsePreferencePage.addSpacer(3, getFieldEditorParent()); addField(new BooleanFieldEditor(TexlipseProperties.BIB_COMPLETION, TexlipsePlugin.getResourceString("preferenceBibCompletion"), getFieldEditorParent())); String message = TexlipsePlugin.getResourceString("preferenceBibCompletionDelay").replaceFirst("%1", "" + MIN_DELAY).replaceFirst("%2", "" + MAX_DELAY); IntegerFieldEditor delay = new IntegerFieldEditor(TexlipseProperties.BIB_COMPLETION_DELAY, message, getFieldEditorParent()); delay.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); delay.setValidRange(MIN_DELAY, MAX_DELAY); addField(delay); addField(new BooleanFieldEditor(TexlipseProperties.BIB_CODE_FOLDING, TexlipsePlugin.getResourceString("preferenceBibCodeFolding"), getFieldEditorParent())); addField(new BooleanFieldEditor(TexlipseProperties.BIB_FOLD_INITIAL, TexlipsePlugin.getResourceString("preferenceBibFoldInitial"), getFieldEditorParent())); //addField(new BooleanFieldEditor(TexlipseProperties.BIB_STRING, TexlipsePlugin.getResourceString("preferenceBibString"), getFieldEditorParent())); //addField(new BooleanFieldEditor(TexlipseProperties.BIB_FREQSORT, TexlipsePlugin.getResourceString("preferenceBibFreqSort"), getFieldEditorParent())); }
Example 5
Source File: LogViewerPreferences.java From LogViewer with Eclipse Public License 2.0 | 5 votes |
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",new Object[]{new Integer(ILogViewerConstants.MAX_BACKLOG)})); //$NON-NLS-1$ backlogEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); backlogEditor.setValidRange(0,ILogViewerConstants.MAX_BACKLOG); backlogEditor.load(); backlogEditor.setPropertyChangeListener(validityChangeListener); }
Example 6
Source File: LogViewerPreferences.java From LogViewer with Eclipse Public License 2.0 | 5 votes |
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",new Object[]{new Integer(ILogViewerConstants.MAX_TAIL_BUFFER_SIZE)})); //$NON-NLS-1$ bufferEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); bufferEditor.setValidRange(0,ILogViewerConstants.MAX_TAIL_BUFFER_SIZE); bufferEditor.load(); bufferEditor.setPropertyChangeListener(validityChangeListener); }
Example 7
Source File: LogViewerPreferences.java From LogViewer with Eclipse Public License 2.0 | 5 votes |
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",new Object[]{new Integer(ILogViewerConstants.MAX_READWAIT_SIZE)})); //$NON-NLS-1$ readWaitEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); readWaitEditor.setValidRange(0,ILogViewerConstants.MAX_READWAIT_SIZE); readWaitEditor.load(); readWaitEditor.setPropertyChangeListener(validityChangeListener); }
Example 8
Source File: TexEditorPreferencePage.java From texlipse with Eclipse Public License 1.0 | 4 votes |
/** * 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. */ public void createFieldEditors() { TexlipsePreferencePage.addSpacer(getFieldEditorParent()); addField(new BooleanFieldEditor(TexlipseProperties.TEX_COMPLETION, TexlipsePlugin.getResourceString("preferenceTexCompletion"), getFieldEditorParent())); String completionMessage = TexlipsePlugin.getResourceString("preferenceTexCompletionDelay").replaceFirst("%1", "" + MIN_COMPLETION_DELAY).replaceFirst("%2", "" + MAX_COMPLETION_DELAY); IntegerFieldEditor completionDelay = new IntegerFieldEditor(TexlipseProperties.TEX_COMPLETION_DELAY, completionMessage, getFieldEditorParent()); completionDelay.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); completionDelay.setValidRange(MIN_COMPLETION_DELAY, MAX_COMPLETION_DELAY); addField(completionDelay); //TexlipsePreferencePage.addSpacer(getFieldEditorParent()); // auto \item completion addField(new BooleanFieldEditor(TexlipseProperties.TEX_ITEM_COMPLETION, TexlipsePlugin.getResourceString("preferenceTexItemCompletion"), getFieldEditorParent())); Label itemLabel = new Label(getFieldEditorParent(), SWT.LEFT | SWT.WRAP); itemLabel.setText(TexlipsePlugin.getResourceString("preferenceTexItemCompletionText")); //TexlipsePreferencePage.addSpacer(getFieldEditorParent()); // auto parsing addField(new BooleanFieldEditor(TexlipseProperties.AUTO_PARSING, TexlipsePlugin.getResourceString("preferenceAutoParsing"), getFieldEditorParent())); String autoParsingMessage = TexlipsePlugin.getResourceString( "preferenceAutoParsingDelay").replaceFirst("%1", "" + MIN_AUTO_DELAY).replaceFirst("%2", "" + MAX_AUTO_DELAY); IntegerFieldEditor autoDelay = new IntegerFieldEditor(TexlipseProperties.AUTO_PARSING_DELAY, autoParsingMessage, getFieldEditorParent()); autoDelay.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); autoDelay.setValidRange(MIN_AUTO_DELAY, MAX_AUTO_DELAY); addField(autoDelay); // Check for missing sections addField(new BooleanFieldEditor(TexlipseProperties.SECTION_CHECK, TexlipsePlugin.getResourceString("preferenceSectionCheck"), getFieldEditorParent())); // Mark occurences (references and environments) addField(new BooleanFieldEditor(TexlipseProperties.TEX_EDITOR_ANNOTATATIONS, TexlipsePlugin.getResourceString("preferencesEditorHighlighting"), getFieldEditorParent())); TexlipsePreferencePage.addSpacer(getFieldEditorParent()); // word wrapping Group group = new Group(getFieldEditorParent(), SWT.NONE); group.setText(TexlipsePlugin.getResourceString("preferenceWrapping")); group.setLayout(new GridLayout()); GridData layData = new GridData(GridData.FILL_HORIZONTAL); layData.horizontalSpan = 2; group.setLayoutData(layData); Composite wordWrapParent = getFieldEditorParent(group); // default on/off wrapping addField(new BooleanFieldEditor(TexlipseProperties.WORDWRAP_DEFAULT, TexlipsePlugin.getResourceString("preferenceWrappingDefault"), wordWrapParent)); TexlipsePreferencePage.addSpacer(wordWrapParent); String message = TexlipsePlugin.getResourceString("preferenceWrapLineLength").replaceFirst("%1", ""+MIN_WRAP_LENGTH).replaceFirst("%2", ""+MAX_WRAP_LENGTH); IntegerFieldEditor wordWrapLength = new IntegerFieldEditor(TexlipseProperties.WORDWRAP_LENGTH, message, wordWrapParent); wordWrapLength.setValidateStrategy(IntegerFieldEditor.VALIDATE_ON_KEY_STROKE); wordWrapLength.setValidRange(MIN_WRAP_LENGTH, MAX_WRAP_LENGTH); addField(wordWrapLength); IWorkbenchHelpSystem helpsystem = workbench.getHelpSystem(); helpsystem.setHelp(wordWrapLength.getTextControl(wordWrapParent), TexlipseHelpIds.WRAP_LENGTH); //WorkbenchHelp.setHelp(wordWrapLength.getTextControl(wordWrapParent), TexlipseHelpIds.WRAP_LENGTH); TexlipsePreferencePage.addSpacer(wordWrapParent); Label label = new Label(wordWrapParent, SWT.LEFT | SWT.WRAP); label.setText(TexlipsePlugin.getResourceString("preferenceWrapSoftWarning")); GridData lgl = new GridData(GridData.FILL_HORIZONTAL); lgl.horizontalSpan = 2; label.setLayoutData(lgl); addField(new RadioGroupFieldEditor(TexlipseProperties.WORDWRAP_TYPE, TexlipsePlugin.getResourceString("preferenceWrapType"), 1, new String[][] {//{ TexlipsePlugin.getResourceString("preferenceWrapNoneLabel"), TexlipseProperties.WORDWRAP_TYPE_NONE }, { TexlipsePlugin.getResourceString("preferenceWrapSoftLabel"), TexlipseProperties.WORDWRAP_TYPE_SOFT }, { TexlipsePlugin.getResourceString("preferenceWrapHardLabel"), TexlipseProperties.WORDWRAP_TYPE_HARD }}, getFieldEditorParent(group))); }
Example 9
Source File: PreviewDataPreferencePage.java From birt with Eclipse Public License 1.0 | 4 votes |
protected Control createContents( Composite parent ) { UIUtil.bindHelp( parent, IHelpContextIds.PREFERENCE_BIRT_PREVIEW_DATA_ID ); Composite cmpTop = new Composite( parent, SWT.NONE ); GridLayout layout = new GridLayout( 1, false ); cmpTop.setLayout( layout ); GridData gd = new GridData( GridData.FILL_HORIZONTAL ); cmpTop.setLayoutData( gd ); createDispalyRowLimitGroup( cmpTop ); // txtMaxRowLevelMember = new IntegerFieldEditor( PREVIEW_MAX_ROW_LEVEL_MEMBER, // Messages.getString( "designer.preview.preference.resultset.maxrowlevelmember.description" ), cmpTop ); //$NON-NLS-1$ // txtMaxRowLevelMember.setPage( this ); // txtMaxRowLevelMember.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); // txtMaxRowLevelMember.setEmptyStringAllowed( false ); // txtMaxRowLevelMember.setPropertyChangeListener( new IPropertyChangeListener( ) { // // public void propertyChange( PropertyChangeEvent event ) // { // if ( event.getProperty( ).equals( FieldEditor.IS_VALID ) ) // setValid( txtMaxRowLevelMember.isValid( ) ); // } // } ); // // txtMaxColumnLevelMember = new IntegerFieldEditor( PREVIEW_MAX_COLUMN_LEVEL_MEMBER, // Messages.getString( "designer.preview.preference.resultset.maxcolumnlevelmember.description" ), cmpTop ); //$NON-NLS-1$ // txtMaxColumnLevelMember.setPage( this ); // txtMaxColumnLevelMember.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); // txtMaxColumnLevelMember.setEmptyStringAllowed( false ); // txtMaxColumnLevelMember.setPropertyChangeListener( new IPropertyChangeListener( ) { // // public void propertyChange( PropertyChangeEvent event ) // { // if ( event.getProperty( ).equals( FieldEditor.IS_VALID ) ) // setValid( txtMaxColumnLevelMember.isValid( ) ); // } // } ); txtMaxInMemoryCubeSize = new IntegerFieldEditor( PREVIEW_MAX_IN_MEMORY_CUBE_SIZE, Messages.getString( "designer.preview.preference.resultset.maxinmemorycubesize.description" ), cmpTop ); //$NON-NLS-1$ txtMaxInMemoryCubeSize.setPage( this ); txtMaxInMemoryCubeSize.setValidateStrategy( StringFieldEditor.VALIDATE_ON_KEY_STROKE ); txtMaxInMemoryCubeSize.setEmptyStringAllowed( false ); txtMaxInMemoryCubeSize.setPropertyChangeListener( new IPropertyChangeListener( ) { public void propertyChange( PropertyChangeEvent event ) { if ( event.getProperty( ).equals( FieldEditor.IS_VALID ) ) setValid( txtMaxInMemoryCubeSize.isValid( ) ); } } ); initControlValues( ); return cmpTop; }