Java Code Examples for org.eclipse.jface.preference.IntegerFieldEditor#setValidRange()

The following examples show how to use org.eclipse.jface.preference.IntegerFieldEditor#setValidRange() . 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: PydevVerticalIndentGuidePreferencesPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    showVerticalindentGuideFieldEditor = new BooleanFieldEditor(PyDevEditorPreferences.USE_VERTICAL_INDENT_GUIDE,
            "Show vertical indent guide?", p);
    addField(showVerticalindentGuideFieldEditor);

    useEditorForegroundAsColorFieldEditor = new BooleanFieldEditor(
            PyDevEditorPreferences.USE_VERTICAL_INDENT_COLOR_EDITOR_FOREGROUND,
            "Use the editor foreground as the color?", p);
    addField(useEditorForegroundAsColorFieldEditor);

    selectionColorFieldEditor = new ColorFieldEditor(PyDevEditorPreferences.VERTICAL_INDENT_COLOR,
            "Vertical indent guide color.", p);
    addField(selectionColorFieldEditor);

    transparencyFieldEditor = new IntegerFieldEditor(PyDevEditorPreferences.VERTICAL_INDENT_TRANSPARENCY,
            "Vertical indent guide transparency\n(0 = transparent, 255 = opaque).", p);
    transparencyFieldEditor.setValidRange(0, 255);
    addField(transparencyFieldEditor);

    updateInitialState();
}
 
Example 2
Source File: ViewerSettingsPreferencePage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
    * 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 3
Source File: IndentationPreferencePage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
    * 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 4
Source File: GeneralPreferencePage.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * 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()
{
    /*
    addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, "&Directory preference:", getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN, "&An example of a boolean preference",
            getFieldEditorParent()));

    addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE, "An example of a multiple-choice preference",
            1, new String[][] { { "&Choice 1", "choice1" }, { "C&hoice 2", "choice2" } }, getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_STRING, "A &text preference:", getFieldEditorParent()));
    */
    addField(new BooleanFieldEditor(IPreferenceConstants.I_RESTORE_LAST_SPEC,
            "&Continue Previous Session on Restart", getFieldEditorParent()));
    
    IntegerFieldEditor minStorageSizeEditor = 
         new IntegerFieldEditor(IPreferenceConstants.I_MIN_DISPLAYED_SIZE, 
            "&Minimum spec storage displayed (in kilobytes)", getFieldEditorParent());
    addField(minStorageSizeEditor);
    minStorageSizeEditor.setValidRange(0, 2000000);
}
 
Example 5
Source File: MechanicPreferencePage.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
private IntegerFieldEditor newMinimumRangeFieldEditor(String name, String labelText,
    int minimumValue, String errorMessagePrefix, Composite parent) {

  IntegerFieldEditor editor = new IntegerFieldEditor(name, labelText, parent);
  editor.setValidRange(minimumValue, Integer.MAX_VALUE);
  // Overriding the error message defined by "setValidRange, ".
  editor.setErrorMessage(errorMessagePrefix + " must be no less than " + minimumValue);

  return editor;
}
 
Example 6
Source File: EditorsPreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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()
{
	Composite appearanceComposite = getFieldEditorParent();

	// Typing
	Composite group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_Typing);
	addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_CHARACTER_PAIR_COLORING,
			Messages.EditorsPreferencePage_Colorize_Matching_Character_Pairs, group));
	addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_PEER_CHARACTER_CLOSE,
			Messages.EditorsPreferencePage_Close_Matching_Character_Pairs, group));
	addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_WRAP_SELECTION,
			Messages.EditorsPreferencePage_Wrap_Selection, group));

	// Save Actions
	group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_saveActionsGroup);
	addField(new BooleanFieldEditor(IPreferenceConstants.EDITOR_REMOVE_TRAILING_WHITESPACE,
			Messages.EditorsPreferencePage_saveActionRemoveWhitespaceCharacters, group));

	// Syntax coloring
	group = AptanaPreferencePage.createGroup(appearanceComposite, Messages.EditorsPreferencePage_SyntaxColoring);
	group.setLayout(GridLayoutFactory.swtDefaults().create());
	group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
	IntegerFieldEditor colEditor = new IntegerFieldEditor(IPreferenceConstants.EDITOR_MAX_COLORED_COLUMNS,
			StringUtil.makeFormLabel(Messages.EditorsPreferencePage_MaxColumnsLabel), group);
	colEditor.setValidRange(-1, Integer.MAX_VALUE);
	addField(colEditor);

	// Word Wrap
	addField(new BooleanFieldEditor(IPreferenceConstants.ENABLE_WORD_WRAP,
			Messages.EditorsPreferencePage_Enable_WordWrap, appearanceComposite));

	createTextEditorLink(appearanceComposite);
}
 
Example 7
Source File: LogViewerPreferences.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
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: LogViewerPreferences.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
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 9
Source File: LogViewerPreferences.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
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 10
Source File: ControlPreferencePage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {

    IntegerFieldEditor commandTimeout = new IntegerFieldEditor(TmfRemotePreferences.TRACE_CONTROL_COMMAND_TIMEOUT_PREF, Messages.TraceControl_CommandTimeout, getFieldEditorParent());
    commandTimeout.setValidRange(TmfRemotePreferences.TRACE_CONTROL_MIN_TIMEOUT_VALUE, TmfRemotePreferences.TRACE_CONTROL_MAX_TIMEOUT_VALUE);
    addField(commandTimeout);
}
 
Example 11
Source File: BibtexPreferencePage.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 12
Source File: ImportPreferencePage.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 13
Source File: SDViewerPage.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, Messages.SequenceDiagram_ShowTooltips, page);
    fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
    fTooltip.load();

    // link font with zoom pref
    fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT, Messages.SequenceDiagram_IncreaseFontSizeWhenZooming, page);
    fLink.setPreferenceStore(fPreferences.getPreferenceStore());
    fLink.load();

    fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME, Messages.SequenceDiagram_ExcludeExternalTime, page);
    fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
    fNoExternalTime.load();

    // use gradient color pref
    fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT, Messages.SequenceDiagram_UseGradientColor, page);
    fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
    fUseGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH, Messages.SequenceDiagram_LifelineWidth, prefPage);
    fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
    fLifelineWidth.setValidRange(119, 500);
    fLifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    fClassItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fClassItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        fClassItemList.add(fontList2[i]);
    }
    fClassItemList.setSelection(0);
    fClassItemList.addSelectionListener(this);
    fButtonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL/* |GridData.GRAB_HORIZONTAL */| GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fButtonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    fButtonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    fFont = new FontFieldEditor(fontList[0], "",//$NON-NLS-1$
            Messages.SequenceDiagram_AaBbYyZz, fButtonArea);
    fFont.getPreviewControl().setSize(500, 500);
    fFont.setPreferenceStore(fPreferences.getPreferenceStore());
    fFont.load();

    fBackGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, Messages.SequenceDiagram_Background, fButtonArea);
    fBackGroundColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fBackGroundColor.load();

    fLineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, Messages.SequenceDiagram_Lines, fButtonArea);
    fLineColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fLineColor.load();

    fTextColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, Messages.SequenceDiagram_Text, fButtonArea);
    fTextColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fTextColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}
 
Example 14
Source File: TexEditorPreferencePage.java    From texlipse with Eclipse Public License 1.0 4 votes vote down vote up
/**
    * 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 15
Source File: SettingsPreferencePage.java    From cppcheclipse with Apache License 2.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
	numberOfThreads = new IntegerFieldEditor(
			IPreferenceConstants.P_NUMBER_OF_THREADS,
			Messages.SettingsPreferencePage_NumberOfThreads,
			getFieldEditorParent(), 2) {

		@Override
		public void setEnabled(boolean enabled, Composite parent) {
			if (enabled) {
				enabled = !unusedFunctionsCheck.getBooleanValue();
			}
			super.setEnabled(enabled, parent);
		}

	};
	numberOfThreads.setValidRange(1, 16);
	addField(numberOfThreads);

	createCheckGroup();
	
	final BooleanFieldEditor inconclusiveChecks = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_INCONCLUSIVE,
			Messages.SettingsPreferencePage_Inconclusive,
			getFieldEditorParent());
	addField(inconclusiveChecks);
	
	BooleanFieldEditor checkEditor = new BooleanFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_POSIX,
			Messages.SettingsPreferencePage_LanguageStandard_Posix, getFieldEditorParent());
	addField(checkEditor);
	
	final ComboFieldEditor languageStandardCEditor = new ComboFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_C,
			"C Language Standard", new String[][] {
					{ "Unspecified", "" }, { "C89", "c89" },
					{ "C99", "c99" }, { "C11", "c11" }}, getFieldEditorParent());
	addField(languageStandardCEditor);
	
	final ComboFieldEditor languageStandardCppEditor = new ComboFieldEditor(
			IPreferenceConstants.P_LANGUAGE_STANDARD_CPP,
			"C++ Language Standard", new String[][] {
					{ "Unspecified", "" }, { "C++03", "c++03" },
					{ "C++11", "c++11" }}, getFieldEditorParent());
	addField(languageStandardCppEditor);

	final ComboFieldEditor platformsEditor = new ComboFieldEditor(
			IPreferenceConstants.P_TARGET_PLATFORM,
			Messages.SettingsPreferencePage_TargetPlatform, new String[][] {
					{ "Unspecified", "" }, { "Win32 (ANSI)", "win32A" },
					{ "Win32 (Unicode)", "win32W" }, { "Win64", "win64" },
					{ "Unix (32bit)", "unix32" },
					{ "Unix (64bit)", "unix64" } }, getFieldEditorParent());
	addField(platformsEditor);

	// special flags
	final BooleanFieldEditor forceCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_FORCE,
			Messages.SettingsPreferencePage_Force, getFieldEditorParent());
	addField(forceCheck);

	final BooleanFieldEditor verboseCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_VERBOSE,
			Messages.SettingsPreferencePage_Verbose, getFieldEditorParent());
	addField(verboseCheck);

	final BooleanFieldEditor useInlineSuppressions = new BooleanFieldEditor(
			IPreferenceConstants.P_USE_INLINE_SUPPRESSIONS,
			Messages.SettingsPreferencePage_InlineSuppressions,
			getFieldEditorParent());
	addField(useInlineSuppressions);

	final BooleanFieldEditor debugCheck = new BooleanFieldEditor(
			IPreferenceConstants.P_CHECK_DEBUG,
			Messages.SettingsPreferencePage_Debug, getFieldEditorParent());
	addField(debugCheck);

	final BooleanFieldEditor followSystemIncludes = new BooleanFieldEditor(
			IPreferenceConstants.P_FOLLOW_SYSTEM_INCLUDES,
			Messages.SettingsPreferencePage_FollowSystemIncludes,
			getFieldEditorParent());
	addField(followSystemIncludes);

	final BooleanFieldEditor followUserIncludes = new BooleanFieldEditor(
			IPreferenceConstants.P_FOLLOW_USER_INCLUDES,
			Messages.SettingsPreferencePage_FollowUserIncludes,
			getFieldEditorParent());
	addField(followUserIncludes);

}
 
Example 16
Source File: FieldAssistPreferencePage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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
 * 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
protected void createFieldEditors( )
{
	addField( new BooleanFieldEditor( PreferenceConstants.PREF_SHOWREQUIREDFIELDLABELINDICATOR,
			Messages.getString( "ssPreferencesShowRequiredFieldLabelIndicator" ), //$NON-NLS-1$
			getFieldEditorParent( ) ) );

	Group g = new Group( getFieldEditorParent( ), SWT.NONE );
	g.setText( Messages.getString( "ssPreferencesAssistSymbol" ) ); //$NON-NLS-1$
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	g.setLayoutData( gd );

	addField( new RadioGroupFieldEditor( PreferenceConstants.PREF_DECORATOR_VERTICALLOCATION,
			Messages.getString( "ssPreferencesDecoratorVert" ), //$NON-NLS-1$
			1,
			new String[][]{
					{
							Messages.getString( "ssPreferencesDecoratorTop" ), //$NON-NLS-1$
							PreferenceConstants.PREF_DECORATOR_VERTICALLOCATION_TOP
					},
					{
							Messages.getString( "ssPreferencesDecoratorCenter" ), //$NON-NLS-1$
							PreferenceConstants.PREF_DECORATOR_VERTICALLOCATION_CENTER
					},
					{
							Messages.getString( "ssPreferencesDecoratorBottom" ), //$NON-NLS-1$
							PreferenceConstants.PREF_DECORATOR_VERTICALLOCATION_BOTTOM
					}
			},
			g ) );

	addField( new RadioGroupFieldEditor( PreferenceConstants.PREF_DECORATOR_HORIZONTALLOCATION,
			Messages.getString( "ssPreferencesDecoratorHorz" ), //$NON-NLS-1$
			1,
			new String[][]{
					{
							Messages.getString( "ssPreferencesDecoratorLeft" ), //$NON-NLS-1$
							PreferenceConstants.PREF_DECORATOR_HORIZONTALLOCATION_LEFT
					},
					{
							Messages.getString( "ssPreferencesDecoratorRight" ), //$NON-NLS-1$
							PreferenceConstants.PREF_DECORATOR_HORIZONTALLOCATION_RIGHT
					}
			},
			g ) );

	IntegerFieldEditor editor = new IntegerFieldEditor( PreferenceConstants.PREF_DECORATOR_MARGINWIDTH,
			Messages.getString( "ssPreferencesDecoratorMargin" ), //$NON-NLS-1$
			g );
	editor.setValidRange( 0, 10 );
	addField( editor );

	g.setLayout( new GridLayout( ) );

	Dialog.applyDialogFont( getFieldEditorParent( ) );
}
 
Example 17
Source File: ContentAssistPreferencePage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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
 * 
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
protected void createFieldEditors( )
{
	CustomKeyRadioGroupFieldEditor rgfe = new CustomKeyRadioGroupFieldEditor( PreferenceConstants.PREF_CONTENTASSISTKEY,
			PreferenceConstants.PREF_CONTENTASSISTKEYCUSTOMKEY,
			Messages.getString( "ssPreferencesContentAssistKey" ), //$NON-NLS-1$
			new String[][]{
					{
							Messages.getString( "ssPreferencesContentAssistKeyCtlSpace" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTKEY1
					},
					{
							Messages.getString( "ssPreferencesContentAssistKeyAsterisk" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTKEY2
					},
					{
							Messages.getString( "ssPreferencesContentAssistKeyAnyKey" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTKEYAUTO
					},
					{
							Messages.getString( "ssPreferencesContentAssistKeyCustom" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTKEYCUSTOM
					}
			},
			getFieldEditorParent( ) );
	addField( rgfe );

	IntegerFieldEditor editor = new IntegerFieldEditor( PreferenceConstants.PREF_CONTENTASSISTDELAY,
			Messages.getString( "ssPreferencesContentAssistDelay" ), //$NON-NLS-1$
			getFieldEditorParent( ) );
	editor.setValidRange( 0, 10000 );
	addField( editor );

	addField( new BooleanFieldEditor( PreferenceConstants.PREF_CONTENTASSISTKEY_PROPAGATE,
			Messages.getString( "ssPreferencesContentAssistKeyPropagate" ), //$NON-NLS-1$
			getFieldEditorParent( ) ) );

	addField( new RadioGroupFieldEditor( PreferenceConstants.PREF_CONTENTASSISTRESULT,
			Messages.getString( "ssPreferencesContentAssistResult" ), //$NON-NLS-1$
			1,
			new String[][]{
					{
							Messages.getString( "ssPreferencesContentAssistResultReplace" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTRESULT_REPLACE
					},
					{
							Messages.getString( "ssPreferencesContentAssistResultInsert" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTRESULT_INSERT
					}
			},
			getFieldEditorParent( ) ) );

	addField( new RadioGroupFieldEditor( PreferenceConstants.PREF_CONTENTASSISTFILTER,
			Messages.getString( "ssPreferencesContentAssistFilter" ), //$NON-NLS-1$
			1,
			new String[][]{
					{
							Messages.getString( "ssPreferencesContentAssistFilterCharacter" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTFILTER_CHAR
					},
					{
							Messages.getString( "ssPreferencesContentAssistFilterCumulative" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTFILTER_CUMULATIVE
					},
					{
							Messages.getString( "ssPreferencesContentAssistFilterNone" ), //$NON-NLS-1$
							PreferenceConstants.PREF_CONTENTASSISTFILTER_NONE
					}
			},
			getFieldEditorParent( ) ) );

}
 
Example 18
Source File: ServerPreferencePage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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() {

    createTitleBar(Messages.BonitaPreferenceDialog_UserXP_Settings, Pics.getImage(PicsConstants.preferenceLogin),
            false);

    BooleanFieldEditor lazyEditor = new BooleanFieldEditor(EnginePreferenceConstants.LAZYLOAD_ENGINE,
            Messages.engineLazyLoad,
            BooleanFieldEditor.SEPARATE_LABEL,
            getFieldEditorParent());
    addField(lazyEditor);

    debugCustomPage = new BooleanFieldEditor(BonitaPreferenceConstants.CUSTOM_PAGE_DEBUG,
            Messages.debugCustomPageMode,
            BooleanFieldEditor.SEPARATE_LABEL,
            getFieldEditorParent());
    addField(debugCustomPage);
    Control descriptionControl = debugCustomPage.getDescriptionControl(getFieldEditorParent());
    ControlDecoration debugHintControlDecorator = new ControlDecoration(descriptionControl, SWT.RIGHT);
    debugHintControlDecorator.setDescriptionText(Messages.debugCustomPageModeHint);
    debugHintControlDecorator.setMarginWidth(3);
    debugHintControlDecorator.setImage(FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());

    createPreferenceEditorContributions(ACM_CONTRIBUTOR_ID);

    getContributedEditors().put(lazyEditor, EnginePlugin.getDefault().getPreferenceStore());
    port = new IntegerFieldEditor(BonitaPreferenceConstants.CONSOLE_PORT, Messages.consolePreferencePortLabel,
            getFieldEditorParent());
    port.setValidRange(PortConfigurator.MIN_PORT_NUMBER, PortConfigurator.MAX_PORT_NUMBER);
    addField(port);

    xmxOption = new IntegerFieldEditor(EnginePreferenceConstants.TOMCAT_XMX_OPTION, Messages.tomcatXmxOption,
            getFieldEditorParent());
    addField(xmxOption);
    getContributedEditors().put(xmxOption, EnginePlugin.getDefault().getPreferenceStore());

    extraParamsField = new StringFieldEditor(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS,
            Messages.tomcatExtraParams,
            getFieldEditorParent());
    addField(extraParamsField);
    getContributedEditors().put(extraParamsField, EnginePlugin.getDefault().getPreferenceStore());

    uidExtraParamsField = new StringFieldEditor(BonitaPreferenceConstants.UID_JVM_OPTS, Messages.uidExtraParams,
            getFieldEditorParent());
    addField(uidExtraParamsField);
}