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:edu.uchicago.cs.hao.texdojo.latexeditor.preferences.LaTeXEditorPreferencePage.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  ava2s . co  m
public void createFieldEditors() {
    // addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
    // "&Directory preference:", getFieldEditorParent()));
    // addField(new BooleanFieldEditor(PreferenceConstants.P_PRESERVE_CASE,
    // "&Preserve letter case in article titles",
    // 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_LATEX_EXE, "Path for pdflatex executable",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_LATEX_EXE_OPT, "Options for pdflatex executable",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_BIBTEX_EXE, "Path for bibtex executable",
            getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.P_COMPILE_DOC,
            "Compile all .tex files containing \\begin{document}", getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_MAIN_TEX, "Main tex file (when above is unselected)",
            getFieldEditorParent()));

}

From source file:edu.uchicago.cs.hao.texdojo.latexeditor.preferences.SpellCheckerPreference.java

License:Open Source License

@Override
protected void createFieldEditors() {
    addField(new ComboFieldEditor(PreferenceConstants.P_SPELLCHECKER, "Choose Spell Checker",
            new String[][] { new String[] { "ASpell", "aspell" }, new String[] { "No spell checker", "" } },
            getFieldEditorParent()));//w w  w.  j a  v a 2s .c om
    addField(new StringFieldEditor(PreferenceConstants.P_SPELLCHECKER_EXE, "Spell Checker Path",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_SPELLCHECKER_OPTION, "Spell Checker Options",
            getFieldEditorParent()));
}

From source file:edu.uci.lighthouse.core.preferences.UserPreferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    SVNUsername = new StringFieldEditor(USERNAME, "Nickname:", getFieldEditorParent());
    addField(SVNUsername);//from  w  w  w.ja  va  2s  . c  om
}

From source file:edu.washington.cs.cupid.jdt.preferences.JdtPreferencePage.java

License:Open Source License

@Override
public void createFieldEditors() {
    addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH, "&Directory preference:",
            getFieldEditorParent()));//from   ww  w .j  a  v  a2 s  .c  o  m
    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()));
}

From source file:es.cv.gvcase.ide.redmine.preferences.MOSKittRedminePreferencePage.java

License:Open Source License

public void createFieldEditors() {
    RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor(
            MOSKittRedminePreferenceConstants.RedmineAutentication, "Select autentication type on Redmine:", 1,
            new String[][] { { "Anonymous", MOSKittRedminePreferenceConstants.RedmineAutenticationAnonymous },
                    { "Personal API Access Key", MOSKittRedminePreferenceConstants.RedmineAutenticationUser } },
            getFieldEditorParent());//w ww. jav a  2s .c  o  m
    addField(rgfe);

    StringFieldEditor sfe = new StringFieldEditor(MOSKittRedminePreferenceConstants.APIAccessKeyUser,
            "API Access Key", getFieldEditorParent());
    sfe.setTextLimit(40);
    addField(sfe);
}

From source file:eu.aniketos.wp1.ststool.threats.preferences.SVRSPreferencePage.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 a2 s  . c  om*/
public void createFieldEditors() {

    addField(new StringFieldEditor(PreferenceConstants.SVRS_EMAIL, "E-mail:", getFieldEditorParent()));

    StringFieldEditor passf = new StringFieldEditor(PreferenceConstants.SVRS_PASSWORD, "Password:",
            getFieldEditorParent());
    passf.getTextControl(getFieldEditorParent()).setEchoChar('*');
    addField(passf);

    addField(new BooleanFieldEditor(PreferenceConstants.PROXY_ENABLED, "Enable proxy for HTTPS",
            getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.PROXY_ADDRESS, "Host:", getFieldEditorParent()));

    IntegerFieldEditor port = new IntegerFieldEditor(PreferenceConstants.PROXY_PORT, "Port:",
            getFieldEditorParent());
    port.setValidRange(0, 49151); // http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
    addField(port);

    addField(new BooleanFieldEditor(PreferenceConstants.PROXY_AUTHENTICATION, "Proxy requires authentication:",
            getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.PROXY_USERNAME, "User:", getFieldEditorParent()));

    StringFieldEditor passf2 = new StringFieldEditor(PreferenceConstants.PROXY_PASSWORD, "Password:",
            getFieldEditorParent());
    passf2.getTextControl(getFieldEditorParent()).setEchoChar('*');
    addField(passf2);
    // TODO: Store securely:
    // http://wiki.eclipse.org/Storage/Retrieval_of_IDs,_IContainers_using_Equinox_Secure_Preferences

}

From source file:eu.cloudwave.wp5.feedback.eclipse.base.ui.preferences.FeedbackMainPreferencePage.java

License:Apache License

private void addStringField(final String name, final String labelText) {
    addField(new StringFieldEditor(name, labelText, getFieldEditorParent()));
}

From source file:eu.esdihumboldt.hale.io.gml.ui.InspireDatasetFeedConfigurationPage.java

License:Open Source License

@Override
protected void createContent(Composite page) {
    parent = page;//from  w w w. j av  a2  s . co  m
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).spacing(6, 12).applyTo(page);

    // TODO "intro" explanation

    FieldDecoration fieldDec = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    Image infoImage = fieldDec.getImage();

    create = new BooleanFieldEditor("create", "Create feed", BooleanFieldEditor.SEPARATE_LABEL, page);
    create.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            updateStatus();
        }
    });
    title = new StringFieldEditor("title", "Feed title", page);
    subTitle = new StringFieldEditor("subtitle", "Feed sub title", page);
    rights = new StringFieldEditor("rights", "Rights", page); // e
    ControlDecoration rightsExplanation = new ControlDecoration(rights.getTextControl(page),
            SWT.LEFT | SWT.TOP);
    rightsExplanation.setImage(infoImage);
    rightsExplanation.setDescriptionText("Any information about rights or restrictions to the dataset.");
    authorName = new StringFieldEditor("name", "Author name", page);
    authorMail = new StringFieldEditor("mail", "Author mail", page);
    selfLink = new StringFieldEditor("self", "Feed URI", page); // e
    ControlDecoration selfLinkExplanation = new ControlDecoration(selfLink.getTextControl(page),
            SWT.LEFT | SWT.TOP);
    selfLinkExplanation.setImage(infoImage);
    selfLinkExplanation.setDescriptionText("The address under which the feed will be accessible.\n"
            + "Changes do not affect the location of the created file.");
    gmlLink = new StringFieldEditor("gml", "GML URI", page);// e
    ControlDecoration gmlLinkExplanation = new ControlDecoration(gmlLink.getTextControl(page),
            SWT.LEFT | SWT.TOP);
    gmlLinkExplanation.setImage(infoImage);
    gmlLinkExplanation.setDescriptionText("The address under which the gml data will be accessible.\n"
            + "Changes do not affect the location of the created file.");
    updateStatus();
}

From source file:eu.esdihumboldt.hale.io.haleconnect.ui.preferences.HaleConnectExtendedPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 *//*  w  ww . java2 s  .co m*/
@Override
protected void createFieldEditors() {
    addField(defaults = new BooleanFieldEditor(PreferenceConstants.HALE_CONNECT_BASEPATH_USE_DEFAULTS,
            "Use defaults for haleconnect.com?", getFieldEditorParent()) {

        /**
         * @see org.eclipse.jface.preference.FieldEditor#createControl(org.eclipse.swt.widgets.Composite)
         */
        @Override
        protected void createControl(Composite parent) {
            super.createControl(parent);

            getChangeControl(parent).addSelectionListener(new SelectionAdapter() {

                /**
                 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
                 */
                @Override
                public void widgetSelected(SelectionEvent e) {
                    boolean enable = !getChangeControl(getFieldEditorParent()).getSelection();
                    updateBasepathControls(enable);
                }

            });
        }

    });

    addField(clientBasepath = new StringFieldEditor(PreferenceConstants.HALE_CONNECT_BASEPATH_CLIENT,
            "Web client base path (URL):", getFieldEditorParent()));
    addField(usersBasepath = new StringFieldEditor(PreferenceConstants.HALE_CONNECT_BASEPATH_USERS,
            "User service base path (URL):", getFieldEditorParent()));
    addField(dataBasepath = new StringFieldEditor(PreferenceConstants.HALE_CONNECT_BASEPATH_DATA,
            "Bucket service base path (URL):", getFieldEditorParent()));
    addField(projectsBasepath = new StringFieldEditor(PreferenceConstants.HALE_CONNECT_BASEPATH_PROJECTS,
            "Project store base path (URL):", getFieldEditorParent()));

    updateBasepathControls(!HaleConnectUIPlugin.getDefault().getPreferenceStore()
            .getBoolean(PreferenceConstants.HALE_CONNECT_BASEPATH_USE_DEFAULTS));
}

From source file:eu.esdihumboldt.hale.io.haleconnect.ui.projects.HaleConnectSource.java

License:Open Source License

/**
 * @see ImportSource#createControls(Composite)
 *///from w w  w.j  a va2  s  .c  o  m
@Override
public void createControls(Composite parent) {
    parent.setLayout(new GridLayout(3, false));

    HaleConnectService hcs = HaleUI.getServiceProvider().getService(HaleConnectService.class);

    /*
     * Login status label
     */
    loginStatusLabel = new Label(parent, SWT.NONE);
    loginStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

    loginButton = new Button(parent, SWT.PUSH);
    loginButton.setText("Login");
    loginButton.addSelectionListener(new SelectionAdapter() {

        /**
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            HaleConnectLoginDialog loginDialog = HaleConnectLoginHandler
                    .createLoginDialog(Display.getCurrent().getActiveShell());
            if (loginDialog.open() == Dialog.OK) {
                HaleConnectLoginHandler.performLogin(loginDialog);
                updateLoginStatus();
            }
        }

    });

    /*
     * Project name text field
     */
    projectName = new StringFieldEditor("project", "Project", parent) {

        // the following methods are overridden so the button
        // may appear on the same line

        @Override
        public int getNumberOfControls() {
            return super.getNumberOfControls() + 1;
        }

        @Override
        protected void doFillIntoGrid(Composite parent, int numColumns) {
            super.doFillIntoGrid(parent, numColumns - 1);
        }
    };
    projectName.setEmptyStringAllowed(false);
    projectName.setErrorMessage("Please select a project before continuing.");
    projectName.setPage(getPage());
    projectName.getTextControl(parent).setEditable(false);
    projectName.getTextControl(parent).addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            selectProject();
        }

    });

    projectName.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(FieldEditor.IS_VALID)) {
                getPage().setMessage(null);
                updateState(false);
            } else if (event.getProperty().equals(FieldEditor.VALUE)) {
                getPage().setMessage(null);
                updateState(false);
            }
        }
    });

    /*
     * Select project button
     */
    selectProjectButton = new Button(parent, SWT.PUSH);
    selectProjectButton.setText("Select");
    selectProjectButton.setToolTipText("Select project");
    selectProjectButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    selectProjectButton.setEnabled(hcs.isLoggedIn());
    selectProjectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectProject();
        }
    });

    /*
     * Supported types
     */
    supportedTypes = new HashSet<IContentType>();
    if (getConfiguration().getContentType() != null) {
        supportedTypes.add(getConfiguration().getContentType());
    } else {
        // set content types for file field
        Collection<IOProviderDescriptor> factories = getConfiguration().getFactories();
        for (IOProviderDescriptor factory : factories) {
            supportedTypes.addAll(factory.getSupportedTypes());
        }
    }

    // types combo
    Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
    group.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());

    // label
    Label providerLabel = new Label(parent, SWT.NONE);
    providerLabel.setText("Import as");

    // create provider combo
    ComboViewer providers = createProviders(parent);
    providers.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));

    updateLoginStatus();

    // initial state update
    updateState(true);
}