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:eu.hydrologis.jgrass.geonotes.preferences.pages.GeonotesPreferencePage.java

License:Open Source License

public void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.SMTP_SERVER, PreferenceConstants.SMTP_SERVER,
            getFieldEditorParent()));//w  ww. ja va2 s.  c om
    addField(new StringFieldEditor(PreferenceConstants.SMTP_PORT, PreferenceConstants.SMTP_PORT,
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.SMTP_USERNAME, PreferenceConstants.SMTP_USERNAME,
            getFieldEditorParent()));
    StringFieldEditor pasField = new StringFieldEditor(PreferenceConstants.SMTP_PASSWORD,
            PreferenceConstants.SMTP_PASSWORD, getFieldEditorParent());
    pasField.getTextControl(getFieldEditorParent()).setEchoChar('*');
    addField(pasField);
    addField(new StringFieldEditor(PreferenceConstants.GEONOTES_DESTINATION_ADDRESS,
            PreferenceConstants.GEONOTES_DESTINATION_ADDRESS, getFieldEditorParent()));
    addField(new BooleanFieldEditor(PreferenceConstants.SMTP_AUTH, PreferenceConstants.SMTP_AUTH,
            getFieldEditorParent()));
}

From source file:eu.hydrologis.jgrass.gpsnmea.preferences.pages.AdvancedGpsPreferencePage.java

License:Open Source License

protected void createFieldEditors() {
    addField(new StringFieldEditor(PreferenceConstants.MAXWAIT, PreferenceConstants.MAXWAIT + ":",
            getFieldEditorParent()));//from ww  w.ja v  a2  s . c  om
    addField(new StringFieldEditor(PreferenceConstants.BAUDRATE, PreferenceConstants.BAUDRATE + ":",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.DATABIT, PreferenceConstants.DATABIT + ":",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.STOPBIT, PreferenceConstants.STOPBIT + ":",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.PARITYBIT, PreferenceConstants.PARITYBIT + ":",
            getFieldEditorParent()));
}

From source file:eu.hydrologis.jgrass.gpsnmea.preferences.pages.GpsCorrectionPreferencePage.java

License:Open Source License

protected void createFieldEditors() {

    deltaXEditor = new StringFieldEditor(DELTAX, DELTAX, getFieldEditorParent());
    addField(deltaXEditor);//from  w  ww  .  ja  va  2s .c om
    deltaYEditor = new StringFieldEditor(DELTAY, DELTAY, getFieldEditorParent());
    addField(deltaYEditor);
}

From source file:eu.numberfour.n4js.ui.preferences.ComponentPreferencesDetailsPart.java

License:Open Source License

@Override
protected void createFieldEditors() {

    for (IComponentProperties<?> prop : componentPropertiesValues) {
        if (prop.isVisibleInPreferencePage()) {
            FieldEditor field = null;//from ww w  .j  a  va 2 s .  c  om
            if (prop.getType() == Boolean.class) {
                field = new BooleanFieldEditor(prop.getKey(), prop.getLabel(), getFieldEditorParent());
            } else if (prop.getType() == File.class) {
                field = new FileFieldEditor(prop.getKey(), prop.getLabel(), getFieldEditorParent());
            } else {
                field = new StringFieldEditor(prop.getKey(), prop.getLabel(), getFieldEditorParent());
            }
            fields.add(field);
            addField(field);
        }
    }
}

From source file:fable.framework.navigator.preferences.SampleNavigatorPreferences.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    this.composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(GridData.FILL));

    useFabio = new Button(composite, SWT.CHECK);
    useFabio.setText("Use Fabio");
    useFabio.setSelection(preferencesStore.getBoolean(FabioPreferenceConstants.USE_FABIO));
    useFabio.setToolTipText("Requires installation of python and setting PYTHONPATH and LD_PRELOAD variables.");

    final Label installLabel = new Label(composite, SWT.WRAP);
    installLabel.setText(getPythonMessage());

    GridData gd = new GridData();
    gd.horizontalSpan = 2;//from w ww  .j  av  a  2 s.  c o m
    useFabio.setLayoutData(gd);

    useFabio.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            updateEnabled();
        }
    });

    packColumn = new Button(composite, SWT.CHECK);

    packColumn.setText("Fix column size in Image Navigator ?");
    packColumn.setLayoutData(gd);
    packColumn.setSelection(preferencesStore.getBoolean(FabioPreferenceConstants.FIX_COLUMN_SIZE));

    stem = new StringFieldEditor(FabioPreferenceConstants.STEM_NAME, "File name filter", composite);

    stem.setStringValue(preferencesStore.getString(FabioPreferenceConstants.STEM_NAME));
    stem.getTextControl(composite).setToolTipText(
            "Enter a filter on the file name to display your favorites files in the table list.");

    Group grpExtension = new Group(composite, SWT.NONE);
    grpExtension.setText("Favorites file extensions");
    grpExtension.setToolTipText(
            "Set your list of your favorites image files extensions to load in the table here.");
    grpExtension.setLayout(new GridLayout(2, false));
    GridData gdForgrp = new GridData(GridData.FILL, GridData.FILL, true, true);
    gdForgrp.horizontalSpan = 2;
    gdForgrp.verticalSpan = 6;
    grpExtension.setLayoutData(gdForgrp);
    texttoAdd = new Text(grpExtension, SWT.BORDER);
    texttoAdd.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR || e.keyCode == SWT.KEYPAD_ADD) {
                addText();
            }
        }
    });
    this.buttonAdd = new Button(grpExtension, SWT.PUSH);
    texttoAdd.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    buttonAdd.setText("Add to list");
    final Image imageAdd = addDescriptor.createImage();
    buttonAdd.setImage(imageAdd);
    buttonAdd.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (imageAdd != null && !imageAdd.isDisposed()) {
                imageAdd.dispose();
            }

        }
    });
    buttonAdd.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            addText();

        }
    });

    table = new Table(grpExtension, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
    table.setToolTipText("List of filter file types (fabio files) for navigator");
    final GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, false, false);
    tableLayoutData.widthHint = 100;
    tableLayoutData.heightHint = 200;
    table.setLayoutData(tableLayoutData);

    ((GridData) table.getLayoutData()).horizontalSpan = 2;
    TableColumn fabioColumn = new TableColumn(table, SWT.LEFT, 0);
    fabioColumn.setText("Name");
    new TableColumn(table, SWT.LEFT, 0); // fabioType

    table.setHeaderVisible(true);

    String list = preferencesStore.getString(FabioPreferenceConstants.FILE_TYPE);
    populateList(list);
    table.setRedraw(true);

    this.buttonRemove = new Button(grpExtension, SWT.PUSH);
    GridData removeGd = new GridData(GridData.END, GridData.CENTER, false, false);
    removeGd.horizontalSpan = 2;
    buttonRemove.setLayoutData(removeGd);
    buttonRemove.setText("Remove from list");
    final Image imageRemove = removeDescriptor.createImage();
    buttonRemove.setImage(imageRemove);
    buttonRemove.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (imageRemove != null && !imageRemove.isDisposed()) {
                imageRemove.dispose();
            }

        }
    });
    buttonRemove.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            int[] indices = table.getSelectionIndices();
            if (indices != null && indices.length > 0) {
                table.remove(indices);
            }

        }
    });

    updateEnabled();

    return composite;
}

From source file:fable.framework.toolboxpreferences.ImagePrintPreferencesPage.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.  jav  a2  s .  c  o m
public void createFieldEditors() {
    // Rely on the field editor parent being a Composite with a GridData
    // layout. Set the span to be 2 columns. Will have to be modified if
    // there are field editors with more than 2 columns.
    Composite parent = getFieldEditorParent();

    addField(new ComboFieldEditor(PreferenceConstants.P_IMAGE_PRINT_UNITS, "Default units :",
            imagePrinterUnitsOpts, parent));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGE_PRINT_LEFT, "Left margin :", parent));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGE_PRINT_RIGHT, "Right margin :", parent));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGE_PRINT_TOP, "Top margin :", parent));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGE_PRINT_BOTTOM, "Bottom margin :", parent));
    Label label = new Label(parent, SWT.WRAP);
    label.setText("Note: The margins may be given as a number and a unit, for\n"
            + "example \"1.234 cm\".  The unit must be one of the default units.\n"
            + "If given as a number only, then the default unit will be used.");
    GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(label);
    addField(new ComboFieldEditor(PreferenceConstants.P_IMAGE_PRINT_HALIGN, "Horizontal alignment :",
            imagePrinterHAlignOpts, parent));
    addField(new ComboFieldEditor(PreferenceConstants.P_IMAGE_PRINT_VALIGN, "Vertical alignment :",
            imagePrinterVAlignOpts, parent));
    addField(new ComboFieldEditor(PreferenceConstants.P_IMAGE_PRINT_ORIENT, "Orientation :",
            imagePrinterOrientOpts, parent));

    label = new Label(parent, SWT.WRAP);
    label.setText("Note: The orientation is for the preview.  " + "The printer orientation\n"
            + "will still have to be set for the printer when you print.");
    GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(label);
}

From source file:fable.framework.ui.preferences.ColumnFilePlotPreferences.java

License:Open Source License

@Override
protected void createFieldEditors() {
    Composite composite = getFieldEditorParent();
    pref_x = new StringFieldEditor(X_LABEL, "X label", composite);
    addField(pref_x);/* w  w  w.j  a v a 2 s  .c  o  m*/
    pref_y = new StringFieldEditor(Y_LABEL, "Y label", composite);
    addField(pref_y);
}

From source file:fable.imageviewer.preferences.ImageviewerPreferencePage.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.  ja v  a2  s  .co  m*/
public void createFieldEditors() {
    /*
     * could be used to set the starting directory
     * 
     * addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
     * "&Directory preference:", getFieldEditorParent()));
     */
    addField(new StringFieldEditor(PreferenceConstants.P_MAX_SAMPLES, "Number of &samples to open :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGES_PER_TAB, "Number of images per &tab :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_IMAGES_CACHED, "Number of images to &cache :",
            getFieldEditorParent()));

    addField(new StringFieldEditor(PreferenceConstants.P_XLABEL, "&X Label :", getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_YLABEL, "&Y Label :", getFieldEditorParent()));

    String[][] choices = new String[PaletteFactory.PALETTES.size()][2];
    int i = -1;
    for (String name : PaletteFactory.PALETTES.keySet()) {
        i++;
        choices[i] = new String[] { name, PaletteFactory.PALETTES.get(name).toString() };
    }
    addField(new ComboFieldEditor(PreferenceConstants.P_PALETTE, "Default &palette :", choices,
            getFieldEditorParent()));
    addField(new ComboFieldEditor(PreferenceConstants.P_ORIENT, "Default &orientation :", orientNameValues,
            getFieldEditorParent()));

    addField(new ComboFieldEditor(PreferenceConstants.P_COORD, "Default coordinate &system :", coordNameValues,
            getFieldEditorParent()));
    // No accelerator key for these
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_X0, "Custom coordinates x0 :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_Y0, "Custom coordinates y0 :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_PIXELWIDTH, "Custom coordinates pixel width :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_PIXELHEIGHT, "Custom coordinates pixel height :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_XNAME, "Custom coordinates x name :",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.P_COORD_YNAME, "Custom coordinates y name :",
            getFieldEditorParent()));
}

From source file:fr.labsticc.framework.constraints.ide.view.ConstraintsLanguagePreferencePage.java

License:Open Source License

@Override
protected void addFields(final Composite p_parent) {
    final Group group = new Group(p_parent, SWT.NONE);
    group.setText("Constraint Languages Defaults");
    group.setLayout(new GridLayout(1, false));
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    group.setLayoutData(gridData);/*from   w  w  w . ja  v  a 2s.c  o  m*/

    locationField = new StringFieldEditor(
            IConstraintsPreferenceConstants.DEFAULT_CONSTRAINTS_LANG_MODEL_LOCATION, "Model Location", group);
    locationField.getTextControl(group).setEditable(false);
    //         @Override
    //         protected String changePressed() {
    //            final EMFResourceSelectionDialog dialog = new EMFResourceSelectionDialog(    getShell(),
    //                                                                     "Select Constaints Languages Model",
    //                                                                     SWT.OPEN | SWT.SINGLE,
    //                                                                     null, 
    //                                                                     false,
    //                                                                     getStringValue() );
    //            
    //            if ( Window.OK == dialog.open() ) {
    //               return dialog.getURIText();
    //            }
    //
    //            return null;
    //         }
    //      };

    addField(locationField);

    final Button editButton = new Button(group, SWT.NULL);
    editButton.setText("Open Model");
    editButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent p_evt) {
            try {
                EditorUtil.openEditor(locationField.getStringValue(), resourceHandler);
                // TODO: Close automatically.
            } catch (final Throwable p_th) {
                exceptionHandler.handleException(p_th, null);
            }
        }

        @Override
        public void widgetDefaultSelected(final SelectionEvent p_evt) {
        }
    });
}

From source file:fr.labsticc.framework.settings.ide.view.SettingsPreferencePage.java

License:Open Source License

protected void addFields(final Composite p_parent) {
    final Group group = new Group(p_parent, SWT.NONE);
    group.setText("Settings Model Defaults");
    group.setLayout(new GridLayout(1, false));
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    group.setLayoutData(gridData);/*ww  w. j  a  v a  2  s  .c o m*/

    locationField = new StringFieldEditor(ISettingsPreferenceConstants.DEFAULT_SETTINGS_MODEL_LOCATION,
            "Model Location", group);// {

    //         @Override
    //         protected String changePressed() {
    //            final EMFResourceSelectionDialog dialog = new EMFResourceSelectionDialog(    getShell(),
    //                                                                     "Select Settings Model",
    //                                                                     SWT.OPEN | SWT.SINGLE,
    //                                                                     null, 
    //                                                                     false,
    //                                                                     getStringValue() );
    //            
    //            if ( Window.OK == dialog.open() ) {
    //               return dialog.getURIText();
    //            }
    //
    //            return null;
    //         }
    //      };

    locationField.getTextControl(group).setEditable(false);
    addField(locationField);

    final Button editButton = new Button(group, SWT.NULL);
    editButton.setText("Open Model");
    editButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(final SelectionEvent p_evt) {
            try {
                EditorUtil.openEditor(locationField.getStringValue(), resourceHandler);
                // TODO: Close automatically.
            } catch (final Throwable p_th) {
                exceptionHandler.handleException(p_th, null);
            }
        }

        @Override
        public void widgetDefaultSelected(final SelectionEvent p_evt) {
        }
    });
}