Example usage for org.eclipse.jface.preference StringFieldEditor StringFieldEditor

List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor

Introduction

In this page you can find the example usage for org.eclipse.jface.preference StringFieldEditor StringFieldEditor.

Prototype

public StringFieldEditor(String name, String labelText, Composite parent) 

Source Link

Document

Creates a string field editor of unlimited width.

Usage

From source file:com.aptana.ide.editor.css.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * 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.
 *///w w w .j ava  2  s . c  o m
public void createFieldEditors() {
    super.createFieldEditors();

    addField(new BooleanFieldEditor(IPreferenceConstants.SHOW_CSS_TOOLBAR,
            Messages.GeneralPreferencePage_DisplayCSSToolbar, getFieldEditorParent()));

    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.GeneralPreferencePage_DefaultContent);
    GridData gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    group.setLayoutData(gdLabel);
    Composite comp = new Composite(group, SWT.NONE);
    comp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.CSSEDITOR_INITIAL_FILE_NAME,
            Messages.GeneralPreferencePage_DefaultFileName, comp));

    TextFieldEditor contents = new TextFieldEditor(IPreferenceConstants.CSSEDITOR_INITIAL_CONTENTS,
            Messages.GeneralPreferencePage_InitialFileContents, TextFieldEditor.UNLIMITED,
            TextFieldEditor.VALIDATE_ON_KEY_STROKE, comp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    addField(contents);
}

From source file:com.aptana.ide.editor.erb.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * 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.
 *//*from ww w .ja v a 2  s  .  c  om*/
public void createFieldEditors() {
    super.createFieldEditors();
    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.GeneralPreferencePage_DefaultContent);
    GridData gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    group.setLayoutData(gdLabel);
    Composite comp = new Composite(group, SWT.NONE);
    comp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.ERBEDITOR_INITIAL_FILE_NAME,
            Messages.GeneralPreferencePage_DefaultFileName, comp));

    TextFieldEditor contents = new TextFieldEditor(IPreferenceConstants.ERBEDITOR_INITIAL_CONTENTS,
            Messages.GeneralPreferencePage_InitialFileContents, TextFieldEditor.UNLIMITED,
            TextFieldEditor.VALIDATE_ON_KEY_STROKE, comp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    addField(contents);

    addField(new BooleanFieldEditor(IPreferenceConstants.CONTENT_ASSIST_DEBUG,
            "Log debug level messages during content assist", comp));
}

From source file:com.aptana.ide.editor.js.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * 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.
 *///from www.  j ava 2s  . c  o  m
public void createFieldEditors() {
    super.createFieldEditors();

    addField(new BooleanFieldEditor(IPreferenceConstants.SHOW_JS_TOOLBAR,
            Messages.GeneralPreferencePage_DisplayJSToolbar, getFieldEditorParent()));

    Group outlineGroup = new Group(getFieldEditorParent(), SWT.NONE);
    outlineGroup.setLayout(new GridLayout(1, true));
    outlineGroup.setText(Messages.GeneralPreferencePage_Outline);
    GridData gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    outlineGroup.setLayoutData(gdLabel);
    Composite outlineComp = new Composite(outlineGroup, SWT.NONE);
    outlineComp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.PREFERENCE_PRIVATE_FIELD_INDICATOR,
            Messages.GeneralPreferencePage_PrivateFieldIndicator, outlineComp));
    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.GeneralPreferencePage_DefaultContent);
    gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    group.setLayoutData(gdLabel);
    Composite comp = new Composite(group, SWT.NONE);
    comp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.JSEDITOR_INITIAL_FILE_NAME,
            Messages.GeneralPreferencePage_DefaultFileName, comp));

    TextFieldEditor contents = new TextFieldEditor(IPreferenceConstants.JSEDITOR_INITIAL_CONTENTS,
            Messages.GeneralPreferencePage_InitialFileContents, TextFieldEditor.UNLIMITED,
            TextFieldEditor.VALIDATE_ON_KEY_STROKE, comp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    addField(contents);
}

From source file:com.aptana.ide.editor.scriptdoc.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * @see com.aptana.ide.editors.preferences.CoreEditorPreferencePage#createFieldEditors()
 *//*  w w  w .  ja  v a  2s  . com*/
public void createFieldEditors() {
    createEditorDescriptorArea();
    addField(new StringFieldEditor(IPreferenceConstants.SCRIPTDOCEDITOR_INITIAL_FILE_NAME,
            com.aptana.ide.editor.scriptdoc.preferences.Messages.GeneralPreferencePage_DefaultScriptDocFileName,
            getFieldEditorParent()));
}

From source file:com.aptana.ide.editor.xml.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * 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.
 *//* ww  w. j  ava  2  s .  c  o m*/
public void createFieldEditors() {
    super.createFieldEditors();
    Composite pmComp = new Composite(pairMatchingGroup, SWT.NONE);
    addField(new BooleanFieldEditor(IPreferenceConstants.XMLEDITOR_HIGHLIGHT_START_END_TAGS,
            Messages.GeneralPreferencePage_MarkOccurrenHighlightBothTags, pmComp));
    addField(new BooleanFieldEditor(IPreferenceConstants.SHOW_XML_TOOLBAR,
            Messages.GeneralPreferencePage_DisplayXMLToolbar, getFieldEditorParent()));
    Group outlineGroup = new Group(getFieldEditorParent(), SWT.NONE);
    outlineGroup.setLayout(new GridLayout(1, true));
    outlineGroup.setText(Messages.GeneralPreferencePage_Outline);
    GridData gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    outlineGroup.setLayoutData(gdLabel);
    Composite outlineComp = new Composite(outlineGroup, SWT.NONE);
    outlineComp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.XMLEDITOR_OUTLINER_ATTRIBUTE_LIST,
            Messages.GeneralPreferencePage_TagAttributes, outlineComp));

    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.GeneralPreferencePage_DafaultContent);
    gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    group.setLayoutData(gdLabel);
    Composite comp = new Composite(group, SWT.NONE);
    comp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.XMLEDITOR_INITIAL_FILE_NAME,
            Messages.GeneralPreferencePage_DefaultXMLFileName, comp));

    TextFieldEditor contents = new TextFieldEditor(IPreferenceConstants.XMLEDITOR_INITIAL_CONTENTS,
            Messages.GeneralPreferencePage_InitialXMLFileContents, TextFieldEditor.UNLIMITED,
            TextFieldEditor.VALIDATE_ON_KEY_STROKE, comp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    addField(contents);

}

From source file:com.aptana.ide.editor.yml.preferences.GeneralPreferencePage.java

License:Open Source License

/**
 * 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.
 *//*  ww  w . j  a v a2 s .co m*/
public void createFieldEditors() {
    super.createFieldEditors();
    Group group = new Group(getFieldEditorParent(), SWT.NONE);
    group.setLayout(new GridLayout(1, true));
    group.setText(Messages.GeneralPreferencePage_DefaultContent);
    GridData gdLabel = new GridData(SWT.FILL, SWT.FILL, true, false);
    gdLabel.horizontalSpan = 2;
    group.setLayoutData(gdLabel);
    Composite comp = new Composite(group, SWT.NONE);
    comp.setLayoutData(gdLabel);
    addField(new StringFieldEditor(IPreferenceConstants.YMLEDITOR_INITIAL_FILE_NAME,
            Messages.GeneralPreferencePage_DefaultFileName, comp));

    TextFieldEditor contents = new TextFieldEditor(IPreferenceConstants.YMLEDITOR_INITIAL_CONTENTS,
            Messages.GeneralPreferencePage_InitialFileContents, TextFieldEditor.UNLIMITED,
            TextFieldEditor.VALIDATE_ON_KEY_STROKE, comp, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    addField(contents);
}

From source file:com.aptana.ide.editors.preferences.AdvancedPreferencePage.java

License:Open Source License

/**
 * 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.
 *///  w w w  .  j  a  v  a  2s  .co  m
public void createFieldEditors() {
    addTab(Messages.AdvancedPreferencePage_User);
    Composite appearanceComposite = getFieldEditorParent();
    addField(new StringFieldEditor(com.aptana.ide.core.ui.preferences.IPreferenceConstants.PREF_USER_NAME,
            com.aptana.ide.core.ui.preferences.Messages.GeneralPreferencePage_EmailAddressForBugReports,
            appearanceComposite));
    switchPerspectiveField = new RadioGroupFieldEditor(IPreferencesConstants2.SWITCH_TO_APTANA_PRESPECTIVE,
            Messages.AdvancedPreferencePage_switchToAptanaPerspective, 3,
            new String[][] { { Messages.AdvancedPreferencePage_Always, MessageDialogWithToggle.ALWAYS },
                    { Messages.AdvancedPreferencePage_Never, MessageDialogWithToggle.NEVER },
                    { Messages.AdvancedPreferencePage_Prompt, MessageDialogWithToggle.PROMPT } },
            appearanceComposite, true);
    addField(switchPerspectiveField);
    if (Platform.OS_WIN32.equals(Platform.getOS())) {
        Group ieGroup = new Group(appearanceComposite, SWT.NONE);
        GridData ieData = new GridData(SWT.FILL, SWT.FILL, true, true);
        ieData.horizontalSpan = 2;
        ieGroup.setLayoutData(ieData);
        ieGroup.setLayout(new GridLayout(1, true));
        ieGroup.setText(Messages.AdvancedPreferencePage_IESettings);

        notepad = new Button(ieGroup, SWT.RADIO);
        notepad.setText(Messages.AdvancedPreferencePage_AssociateWithNotepad);
        notepad.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                setErrorMessage(null);
                setValid(true);
            }

        });

        otherButton = new Button(ieGroup, SWT.RADIO);
        otherButton.setText(Messages.AdvancedPreferencePage_AssociateWithOther);

        Composite other = new Composite(ieGroup, SWT.NONE);
        GridLayout otherLayout = new GridLayout(2, false);
        otherLayout.marginHeight = 0;
        other.setLayout(otherLayout);
        other.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

        text = new Text(other, SWT.BORDER | SWT.SINGLE);
        text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        text.setEditable(false);
        text.setEnabled(false);
        browse = new Button(other, SWT.PUSH);
        browse.setEnabled(false);
        browse.setText(StringUtils.ellipsify(CoreStrings.BROWSE));
        browse.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                FileDialog dialog = new FileDialog(browse.getShell(), SWT.OPEN);
                String program = dialog.open();
                if (program != null) {
                    text.setText(program);
                    setErrorMessage(null);
                    setValid(true);
                }
            }

        });
        otherButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                boolean selection = otherButton.getSelection();
                browse.setEnabled(selection);
                text.setEnabled(selection);
                if (!selection) {
                    text.setText(""); //$NON-NLS-1$
                } else {
                    if (text.getText().length() < 1) {
                        setErrorMessage(Messages.AdvancedPreferencePage_PleaseSpecifyApplication);
                        setValid(false);
                    }
                }
            }

        });
        String current = null;
        try {
            current = PlatformUtils.queryRegestryStringValue(IE_PREVIEW_KEY, null);
        } catch (Exception e) {
            IdeLog.logError(UnifiedEditorsPlugin.getDefault(),
                    Messages.AdvancedPreferencePage_ERR_ErrorGettingRegistryValue, e);
        }
        if (current != null) {
            if (current.equalsIgnoreCase(IE_PREVIEW_NOTEPAD_VALUE)
                    || current.endsWith(IE_PREVIEW_NOTEPAD_VALUE)) {
                notepad.setSelection(true);
            } else {
                otherButton.setSelection(true);
                browse.setEnabled(true);
                text.setEnabled(true);
                text.setText(current);
            }
        }
    }
    addTab(Messages.AdvancedPreferencePage_Debugging);

    appearanceComposite = getFieldEditorParent();
    Composite group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.AdvancedPreferencePage_LBL_AdvancedFunctionality);

    addField(new BooleanFieldEditor(IPreferenceConstants.SHOW_DEBUG_HOVER,
            Messages.AdvancedPreferencePage_ShowDebugInformation, group));

    //      addField(new BooleanFieldEditor(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP,
    //            "Show live help", group));

    addField(new BooleanFieldEditor(IPreferenceConstants.PARSER_OFF_UI,
            Messages.AdvancedPreferencePage_LBL_ParserOffUI, group));

    group = com.aptana.ide.core.ui.preferences.GeneralPreferencePage.createGroup(appearanceComposite,
            Messages.AdvancedPreferencePage_LBL_DebuggingOutputLevel);

    //addField(new BooleanFieldEditor(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_ENABLE_DEBUGGING,
    //      Messages.AdvancedPreferencePage_LogDebuggingMessages, appearanceComposite));

    Composite debugComp = new Composite(group, SWT.NONE);
    GridLayout pkcLayout = new GridLayout(3, false);
    pkcLayout.marginWidth = 0;
    pkcLayout.marginHeight = 0;
    debugComp.setLayout(pkcLayout);
    debugComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label pianoKeyLabel = new Label(debugComp, SWT.LEFT);
    pianoKeyLabel.setText(Messages.AdvancedPreferencePage_LBL_ControlDebugInformationAmountHelp);
    GridData pklData = new GridData(SWT.FILL, SWT.FILL, true, false);
    pklData.horizontalSpan = 3;
    pianoKeyLabel.setLayoutData(pklData);
    Label less = new Label(debugComp, SWT.LEFT);

    less.setText(Messages.AdvancedPreferencePage_LBL_Errors);
    debugSlider = new Scale(debugComp, SWT.HORIZONTAL);
    debugSlider.setIncrement(1);
    debugSlider.setMinimum(1);
    debugSlider.setMaximum(3);

    Preferences p = AptanaCorePlugin.getDefault().getPluginPreferences();
    debugSlider.setSelection(p.getInt(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_DEBUG_LEVEL));
    Label more = new Label(debugComp, SWT.LEFT);
    more.setText(Messages.AdvancedPreferencePage_LBL_All);

    final Label currentValue = new Label(debugComp, SWT.LEFT);
    currentValue.setText(getValueLabel(debugSlider.getSelection()));
    currentValue.setFont(SWTUtils.getDefaultSmallFont());
    pklData = new GridData(SWT.FILL, SWT.FILL, true, false);
    pklData.horizontalSpan = 3;
    currentValue.setLayoutData(pklData);

    debugSlider.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent selectionevent) {
            currentValue.setText(getValueLabel(debugSlider.getSelection()));
        }

        public void widgetSelected(SelectionEvent selectionevent) {
            currentValue.setText(getValueLabel(debugSlider.getSelection()));
        }

    });
}

From source file:com.aptana.ide.ssh.impl.preferences.SSHPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    // Folder explore command field
    StringFieldEditor sshCommand = new StringFieldEditor(SSHPreferences.SSH_COMMAND,
            Messages.getString("SSHPreferencePage.Command"), //$NON-NLS-1$
            getFieldEditorParent());/*  w  w  w  .  j  a  v a  2  s . c o  m*/
    addField(sshCommand);
}

From source file:com.aptana.js.interactive_console.console.prefs.InteractiveConsolePrefs.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Composite p = getFieldEditorParent();

    ColorFieldEditor sysout = new ColorFieldEditor(JSConsoleConstants.CONSOLE_OUTPUT_COLOR, "Stdout color", p);
    ColorFieldEditor syserr = new ColorFieldEditor(JSConsoleConstants.CONSOLE_ERROR_COLOR, "Stderr color", p);
    ColorFieldEditor sysin = new ColorFieldEditor(JSConsoleConstants.CONSOLE_INPUT_COLOR, "Stdin color", p);
    ColorFieldEditor prompt = new ColorFieldEditor(JSConsoleConstants.CONSOLE_PROMPT_COLOR, "Prompt color", p);
    ColorFieldEditor background = new ColorFieldEditor(JSConsoleConstants.CONSOLE_BACKGROUND_COLOR,
            "Background color", p);
    ColorFieldEditor debugBackground = new ColorFieldEditor(JSConsoleConstants.DEBUG_CONSOLE_BACKGROUND_COLOR,
            "Debug console background color", p);

    addField(sysout);/*from   www.  jav  a 2 s  . c  o  m*/
    addField(syserr);
    addField(sysin);
    addField(prompt);
    addField(background);
    addField(debugBackground);

    addField(new MultiStringFieldEditor(JSConsoleConstants.INITIAL_INTERPRETER_CMDS,
            "Initial\ninterpreter\ncommands:\n", p));

    addField(new StringFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_VM_ARGS,
            "Vm Args for Rhino\n(used only on external\nprocess option):", p));

    addField(new IntegerFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_MAXIMUM_CONNECTION_ATTEMPTS,
            "Maximum connection attempts\nfor initial communication:", p));

    addField(new BooleanFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_CONSOLE_START,
            "Focus console when it's started?", BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(
            JSConsoleConstants.INTERACTIVE_CONSOLE_SEND_INITIAL_COMMAND_WHEN_CREATED_FROM_EDITOR,
            "When creating console send\ncurrent selection/editor\ncontents for execution?",
            BooleanFieldEditor.SEPARATE_LABEL, p));

    addField(new BooleanFieldEditor(JSConsoleConstants.INTERACTIVE_CONSOLE_FOCUS_ON_SEND_COMMAND,
            "Focus console when an evaluate\ncommand is sent from the editor?",
            BooleanFieldEditor.SEPARATE_LABEL, p));

}

From source file:com.arc.embeddedcdt.preferences.MainPrefPage.java

License:Open Source License

public void createFieldEditors() {
    addField(new StringFieldEditor(PrefConstants.P_DEBUGGER_NAME, "&Debugger name:", getFieldEditorParent()));
    addField(new FileFieldEditor(PrefConstants.P_DEBUGGER_INIT, "Debugger &init:", getFieldEditorParent()));
}