org.eclipse.jface.preference.IntegerFieldEditor Java Examples

The following examples show how to use org.eclipse.jface.preference.IntegerFieldEditor. 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: Ablauf.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors(){
	addField(new RadioGroupFieldEditor(Preferences.ABL_LANGUAGE, Messages.Ablauf_preferredLang,
		1, new String[][] {
			{
				Messages.Ablauf_german, "d" //$NON-NLS-1$
			}, {
				Messages.Ablauf_french, "f" //$NON-NLS-1$
			}, {
				Messages.Ablauf_italian, Messages.Ablauf_24
			}
		}, getFieldEditorParent()));
		
	addField(new IntegerFieldEditor(Preferences.ABL_CACHELIFETIME,
		Messages.Ablauf_cachelifetime, getFieldEditorParent()));
	
	addField(new IntegerFieldEditor(Preferences.ABL_HEARTRATE, Messages.Ablauf_heartrate,
		getFieldEditorParent()));
	
}
 
Example #2
Source File: FoldingPreferences.java    From solidity-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void createFieldEditors() {
	Composite parent = getFieldEditorParent();
	
	RadioGroupFieldEditor autoFoldCommentChoice = new RadioGroupFieldEditor(
			ISolidityPreferencesConstants.FOLDING_COMMENT_AUTOFOLD
			, "Auto-fold comments"
			, 1
			, new String[][] {
				 {"None", ISolidityPreferencesConstants.FOLDING_COMMENT_AUTOFOLD_NONE}
				,{"Only header comment", ISolidityPreferencesConstants.FOLDING_COMMENT_AUTOFOLD_HEADER}
				,{"All", ISolidityPreferencesConstants.FOLDING_COMMENT_AUTOFOLD_ALL}
			}
			, parent);
	addField(autoFoldCommentChoice);
	
	IntegerFieldEditor longCommentLineCount = new IntegerFieldEditor(
			ISolidityPreferencesConstants.FOLDING_COMMENT_LINECOUNT
			, "Enable folding for comments exceeding line count"
			, parent);
	addField(longCommentLineCount);
}
 
Example #3
Source File: PreferencePage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
public void createFieldEditors() {
  addField(new BooleanFieldEditor(P_JCAS, "&Automatically run JCasGen when Types change",
          getFieldEditorParent()));

  addField(new BooleanFieldEditor(P_JCAS_LIMIT_TO_PROJECT_SCOPE, "&Limit JCasGen to types defined in this project",
      getFieldEditorParent()));

  addField(new BooleanFieldEditor(P_SHOW_FULLY_QUALIFIED_NAMES, "&Show fully qualified names",
          getFieldEditorParent()));

  addField(new IntegerFieldEditor(P_XML_TAB_SPACES, "&XML indentation", getFieldEditorParent()));

  addField(new StringFieldEditor(P_VNS_HOST, "&Vinci Name Service Host IP address",
          getFieldEditorParent()));

  addField(new StringFieldEditor(P_VNS_PORT, "Vinci NameService &Port number",
          getFieldEditorParent()));
}
 
Example #4
Source File: AnnotationEditorPreferencePage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
protected void createFieldEditors() {
  // editor line length hint
  mEditorLineLengthHint = new IntegerFieldEditor(
          AnnotationEditorPreferenceConstants.EDITOR_LINE_LENGTH_HINT,
          "Line Length Hint", getFieldEditorParent());
  addField(mEditorLineLengthHint);
  
  // editor text size
  mEditorTextSize = new IntegerFieldEditor(
          AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_TEXT_SIZE,
          "Editor Text Size", getFieldEditorParent());
  addField(mEditorTextSize);
  
  // load CAS with partial type system
  BooleanFieldEditor editorPartialTypesystem = new BooleanFieldEditor(
      AnnotationEditorPreferenceConstants.ANNOTATION_EDITOR_PARTIAL_TYPESYSTEM,
      "Load CAS leniently (WARNING: only for experienced users)", getFieldEditorParent());
  addField(editorPartialTypesystem);
  
}
 
Example #5
Source File: DebugPreferencesPageExt.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createFieldEditors(DebugPrefsPage page, Composite parent) {
    page.addField(new IntegerFieldEditor(DebugPluginPrefsInitializer.PYDEV_REMOTE_DEBUGGER_PORT,
            "Port for remote debugger:", parent, 10));

    ComboFieldEditor editor = new ComboFieldEditor(DebugPluginPrefsInitializer.DEBUG_SERVER_STARTUP,
            "Remote debugger server activation: ", ENTRIES_AND_VALUES_DEBUGGER_STARTUP, parent);
    page.addField(editor);
    editor.getLabelControl(parent)
            .setToolTipText(
                    "This option marks if the remote debugger should be auto-activated in some situation.");

    ComboFieldEditor comboEditor = new ComboFieldEditor(DebugPluginPrefsInitializer.FORCE_SHOW_SHELL_ON_BREAKPOINT,
            "On breakpoint hit: ", ENTRIES_AND_VALUES, parent);

    page.addField(comboEditor);
    comboEditor.getLabelControl(parent)
            .setToolTipText(
                    "Checking this option will force Eclipse to have focus when a PyDev breakpoint is hit.");

}
 
Example #6
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 #7
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 #8
Source File: HACPreferencePage.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void createFieldEditors() {
	hostname = new StringFieldEditor(HACPreferenceConstants.P_HOSTNAME_URL, PreferencePage.Label.HOSTNAME_URL_INPUT_TEXT,
			getFieldEditorParent());
	username = new StringFieldEditor(HACPreferenceConstants.P_USERNAME, PreferencePage.Label.USERNAME_INPUT_TEXT,
			getFieldEditorParent());
	password = new StringFieldEditor(HACPreferenceConstants.P_PASSWORD, PreferencePage.Label.PASSWORD_INPUT_TEXT,
			getFieldEditorParent()) {
		@Override
		protected void doFillIntoGrid(final Composite parent, final int numColumns) {
			super.doFillIntoGrid(parent, numColumns);
			getTextControl().setEchoChar('*');
		}
	};
	timeout = new IntegerFieldEditor(HACPreferenceConstants.P_TIMEOUT, PreferencePage.Label.TIMEOUT_INPUT_TEXT,
			getFieldEditorParent());

	addField(hostname);
	addField(username);
	addField(password);
	addField(timeout);
}
 
Example #9
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 #10
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 #11
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 #12
Source File: ScannerPref.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFieldEditors(){
	addField(new IntegerFieldEditor(Preferences.SCANNER_PREFIX_CODE,
		Messages.ScannerPref_ScannerPrefix, getFieldEditorParent(), 10));
	
	addField(new IntegerFieldEditor(Preferences.SCANNER_POSTFIX_CODE,
		Messages.ScannerPref_ScannerPostfix, getFieldEditorParent(), 10));
	
	addField(new IntegerFieldEditor(Preferences.BARCODE_LENGTH,
		Messages.ScannerPref_Barcodelength, getFieldEditorParent(), 50));
}
 
Example #13
Source File: PydevTypingPreferencesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void fixParensIndentEnablement(final Composite p, final BooleanFieldEditorCustom usePep8Indent,
        final BooleanFieldEditorCustom autoIndentToParLevel, final IntegerFieldEditor indentationLevelsToAddField,
        LabelFieldEditor labelPep8_1, LabelFieldEditor labelPep8_2, LabelFieldEditor labelPep8_3,
        boolean useSmartIndentBool, boolean usePep8IndentBool, boolean useAutoIndentToParLevelBool) {
    if (!useSmartIndentBool) {
        // Disable all
        usePep8Indent.setEnabled(false, p);
        labelPep8_1.setEnabled(false, p);
        labelPep8_2.setEnabled(false, p);
        labelPep8_3.setEnabled(false, p);
        autoIndentToParLevel.setEnabled(false, p);
        indentationLevelsToAddField.setEnabled(false, p);
    } else {
        usePep8Indent.setEnabled(true, p);
        labelPep8_1.setEnabled(true, p);
        labelPep8_2.setEnabled(true, p);
        labelPep8_3.setEnabled(true, p);
        // Smart indent enabled, let's see if pep-8 is enabled
        if (usePep8IndentBool) {
            autoIndentToParLevel.setEnabled(false, p);
            indentationLevelsToAddField.setEnabled(false, p);

        } else {
            autoIndentToParLevel.setEnabled(true, p);
            indentationLevelsToAddField.setEnabled(!useAutoIndentToParLevelBool, p);
        }
    }
}
 
Example #14
Source File: PyTabPreferencesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {
    final Composite p = getFieldEditorParent();

    addField(new IntegerFieldEditor(PyDevCoreEditorPreferences.TAB_WIDTH, "Tab length:", p));
    addField(new BooleanFieldEditor(PyDevCoreEditorPreferences.SUBSTITUTE_TABS, "Replace tabs with spaces when typing?", p));
    addField(new BooleanFieldEditor(PyDevCoreEditorPreferences.GUESS_TAB_SUBSTITUTION,
            "Assume tab spacing when files contain tabs?", p));
    addField(new BooleanFieldEditor(PyDevCoreEditorPreferences.TAB_STOP_IN_COMMENT, "Allow tab stops in comments?", p));

    addField(new ScopedPreferencesFieldEditor(p, SharedCorePlugin.DEFAULT_PYDEV_PREFERENCES_SCOPE, this));
}
 
Example #15
Source File: MinimapOverviewRulerPreferencesPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    BooleanFieldEditor useMinimap = new BooleanFieldEditor(USE_MINIMAP,
            "Show minimap? (applied on editor restart)", p);
    addField(useMinimap);

    BooleanFieldEditor showScrollbar = new BooleanFieldEditor(SHOW_VERTICAL_SCROLLBAR,
            "Show vertical scrollbar? (applied on editor restart)", p);
    addField(showScrollbar);

    BooleanFieldEditor showHorizontalScrollbar = new BooleanFieldEditor(SHOW_HORIZONTAL_SCROLLBAR,
            "Show horizontal scrollbar? (applied on editor restart)", p);
    addField(showHorizontalScrollbar);

    BooleanFieldEditor showContents = new BooleanFieldEditor(SHOW_MINIMAP_CONTENTS,
            "Show overview items in overview ruler? (applied on text change)", p);
    addField(showContents);

    IntegerFieldEditor minimapWidth = new IntegerFieldEditor(MINIMAP_WIDTH,
            "Minimap Width: (applied on editor resize)", p);
    addField(minimapWidth);

    ColorFieldEditor selectionColor = new ColorFieldEditor(MINIMAP_SELECTION_COLOR, "Selection color", p);
    addField(selectionColor);

}
 
Example #16
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 #17
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 #18
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 #19
Source File: PreferencePage.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 ()
{
    this.bellActivatedEditor = new BooleanFieldEditor ( PreferenceConstants.BELL_ACTIVATED_KEY, Messages.PreferencePage_activateBell, getFieldEditorParent () );
    this.numOfEventsEditor = new IntegerFieldEditor ( PreferenceConstants.NUMBER_OF_EVENTS_KEY, Messages.PreferencePage_numberOfEvents, getFieldEditorParent () );
    this.cutListAllSecondsEditor = new IntegerFieldEditor ( PreferenceConstants.CUT_LIST_ALL_SECONDS_KEY, Messages.PreferencePage_cutListEveryXSeconds, getFieldEditorParent () );
    addField ( this.bellActivatedEditor );
    addField ( this.numOfEventsEditor );
    addField ( this.cutListAllSecondsEditor );
}
 
Example #20
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 #21
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 #22
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 #23
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 #24
Source File: PreviewDataPreferencePage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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;
	}
 
Example #25
Source File: PyCodeCompletionPreferencesPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    addField(new IntegerFieldEditor(PyCodeCompletionPreferences.ATTEMPTS_CODECOMPLETION,
            "Maximum attempts to connect to shell (5 secs each):", p));

    addField(new IntegerFieldEditor(PyCodeCompletionPreferences.AUTOCOMPLETE_DELAY, "Autocompletion delay: ", p));

    String tooltip = WrapAndCaseUtils
            .wrap("Determines the number of chars in the qualifier request "
                    + "for which constructs such as 'from xxx import yyy' should be "
                    + "analyzed to get its actual token and if it maps to a method, its paramaters will be added in the completion.",
                    80);
    IntegerFieldEditor deepAnalysisFieldEditor = new IntegerFieldEditor(
            PyCodeCompletionPreferences.ARGUMENTS_DEEP_ANALYSIS_N_CHARS,
            "Minimum number of chars in qualifier for\ndeep analysis for parameters in 'from' imports:", p);
    addField(deepAnalysisFieldEditor);
    deepAnalysisFieldEditor.getLabelControl(p).setToolTipText(tooltip);
    deepAnalysisFieldEditor.getTextControl(p).setToolTipText(tooltip);

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.USE_CODECOMPLETION, "Use code completion?", p));

    addField(new IntegerFieldEditor(
            PyCodeCompletionPreferences.MAX_MILLIS_FOR_COMPLETION,
            "Maximum millis for a code-completion request to complete?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.USE_CODE_COMPLETION_ON_DEBUG_CONSOLES,
            "Use code completion on debug console sessions?", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_CODE_COMPLETION_DEBUG_CONSOLE",
            "Note: only applied for new consoles.", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_DOT, "Request completion on '.'?",
            p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_PAR, "Request completion on '('?",
            p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.AUTOCOMPLETE_ON_ALL_ASCII_CHARS,
            "Request completion on all letter chars and '_'?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.MATCH_BY_SUBSTRING_IN_CODE_COMPLETION,
            "Match substrings on code completion?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_DOT, "Apply completion on '.'?",
            p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_LPAREN,
            "Apply completion on '('?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.APPLY_COMPLETION_ON_RPAREN,
            "Apply completion on ')'?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.PUT_LOCAL_IMPORTS_IN_TOP_OF_METHOD,
            "Put local imports on top of method?", p));
    addField(new LabelFieldEditor("LABEL_PUT_LOCAL_IMPORTS_IN_TOP_OF_METHOD_ALWAYS_THERE_0",
            "Note: in a code-completion with a local auto-import.", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_a", "", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_a", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_b", "", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_0",
            "Note: ENTER will always apply the completion.", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_0a", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_0b", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_0c", "", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_1",
            "Note 2: Shift + ENTER can be used if you want a new line\n" + "without applying a completion.", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_1a", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_1b", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_1c", "", p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_2",
            "Note 3: Ctrl + ENTER can be used as a way to apply the completion\n"
                    + "erasing the next chars from the current token.",
            p));

    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_2a", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_2b", "", p));
    addField(new LabelFieldEditor("LABEL_FIELD_EDITOR_NEW_LINE_ALWAYS_THERE_2c", "", p));

}
 
Example #26
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 #27
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 #28
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 #29
Source File: CodeCompletionPreferencesPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    addField(new IntegerFieldEditor(
            PyCodeCompletionPreferences.CHARS_FOR_CTX_INSENSITIVE_MODULES_COMPLETION,
            "Number of chars for showing modules in context-insensitive completions?", p));

    addField(new IntegerFieldEditor(
            PyCodeCompletionPreferences.CHARS_FOR_CTX_INSENSITIVE_TOKENS_COMPLETION,
            "Number of chars for showing global tokens in context-insensitive completions?", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.USE_KEYWORDS_CODE_COMPLETION,
            "Use common tokens auto code completion?", p));
    addField(new LabelFieldEditor("LabelFieldEditor", "", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.ADD_SPACE_WHEN_NEEDED,
            "Add <SPACE> for common cases (e.g.: \"and \", \"assert \", etc.)?", p));
    addField(new LabelFieldEditor("LabelFieldEditor", "", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.ADD_SPACE_AND_COLON_WHEN_NEEDED,
            "Add <SPACE><COLON> for common cases (e.g.: \"class :\", \"if :\", etc.)?", p));
    addField(new LabelFieldEditor("LabelFieldEditor", "", p));

    addField(new BooleanFieldEditor(PyCodeCompletionPreferences.FORCE_PY3K_PRINT_ON_PY2,
            "Force print() function on Python 2.x projects?", p));
    addField(new LabelFieldEditor("LabelFieldEditor", "", p));

    addField(new ListEditor(PyCodeCompletionPreferences.KEYWORDS_CODE_COMPLETION, "Tokens to use:", p) {

        @Override
        protected String createList(String[] items) {
            return PyCodeCompletionPreferences.wordsAsString(items);
        }

        @Override
        protected String getNewInputObject() {
            InputDialog d = new InputDialog(getShell(), "New word", "Add the word you wish.", "",
                    new IInputValidator() {

                        @Override
                        public String isValid(String newText) {
                            if (newText.indexOf(' ') != -1) {
                                return "The input cannot have spaces";
                            }
                            return null;
                        }
                    });

            int retCode = d.open();
            if (retCode == InputDialog.OK) {
                return d.getValue();
            }
            return null;
        }

        @Override
        protected String[] parseString(String stringList) {
            return PyCodeCompletionPreferences.stringAsWords(stringList);
        }

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, numColumns);
            List listControl = getListControl(parent);
            GridData layoutData = (GridData) listControl.getLayoutData();
            layoutData.heightHint = 300;
        }
    });
}
 
Example #30
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( ) );
}