Example usage for org.eclipse.jface.resource JFaceResources getString

List of usage examples for org.eclipse.jface.resource JFaceResources getString

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getString.

Prototype

public static String getString(String key) 

Source Link

Document

Returns the resource object with the given key in JFace's resource bundle.

Usage

From source file:gov.nasa.ensemble.core.detail.emf.util.ButtonFieldEditor.java

License:Open Source License

public ButtonFieldEditor(String name, String labelText, Composite parent) {
    init(name, labelText, parent);/*from  ww  w.  jav a  2 s.  com*/
    setErrorMessage(JFaceResources.getString("FileFieldEditor.errorMessage"));//$NON-NLS-1$
    //      setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
    setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
    createControl(parent);
}

From source file:gov.nasa.ensemble.core.detail.emf.util.IDirectoryFieldEditor.java

License:Open Source License

/**
 * Creates a directory field editor./*from  ww  w  .j a  v  a 2s .  c o m*/
 * 
 * @param name
 *            the name of the preference this field editor works on
 * @param labelText
 *            the label text of the field editor
 * @param parent
 *            the parent of the field editor's control
 */
public IDirectoryFieldEditor(String name, String labelText, Composite parent) {
    init(name, labelText, parent);
    setErrorMessage(JFaceResources.getString("DirectoryFieldEditor.errorMessage"));//$NON-NLS-1$
    setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
    setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
    createControl(parent);
}

From source file:gov.nasa.ensemble.core.detail.emf.util.IFileFieldEditor.java

License:Open Source License

/**
 * Creates a file field editor.//from   w  w  w .ja v a 2s  .co m
 * 
 * @param name
 *            the name of the preference this field editor works on
 * @param labelText
 *            the label text of the field editor
 * @param enforceAbsolute
 *            <code>true</code> if the file path must be absolute, and <code>false</code> otherwise
 * @param validationStrategy
 *            either {@link StringButtonFieldEditor#VALIDATE_ON_KEY_STROKE} to perform on the fly checking, or {@link StringButtonFieldEditor#VALIDATE_ON_FOCUS_LOST} (the default) to perform
 *            validation only after the text has been typed in
 * @param parent
 *            the parent of the field editor's control.
 * @since 3.4
 * @see StringButtonFieldEditor#VALIDATE_ON_KEY_STROKE
 * @see StringButtonFieldEditor#VALIDATE_ON_FOCUS_LOST
 */
public IFileFieldEditor(String name, String labelText, boolean enforceAbsolute, int validationStrategy,
        Composite parent) {
    init(name, labelText, parent);
    this.enforceAbsolute = enforceAbsolute;
    setErrorMessage(JFaceResources.getString("FileFieldEditor.errorMessage"));//$NON-NLS-1$
    setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
    setValidateStrategy(validationStrategy);
    createControl(parent);
}

From source file:gov.nasa.ensemble.core.detail.emf.util.IFileFieldEditor.java

License:Open Source License

@Override
protected boolean checkState() {

    String msg = null;/*w w w  .ja  v a  2s  . c o  m*/

    String path = getTextControl().getText();
    if (path != null) {
        path = path.trim();
    } else {
        path = "";//$NON-NLS-1$
    }
    if (path.length() == 0) {
        if (!isEmptyStringAllowed()) {
            msg = getErrorMessage();
        }
    } else {
        File file = new File(path);
        if (file.isFile()) {
            if (enforceAbsolute && !file.isAbsolute()) {
                msg = JFaceResources.getString("FileFieldEditor.errorMessage2");//$NON-NLS-1$
            }
        } else {
            msg = getErrorMessage();
        }
    }

    if (msg != null) { // error
        showErrorMessage(msg);
        return false;
    }

    // OK!
    clearErrorMessage();
    return true;
}

From source file:gov.redhawk.internal.ui.preferences.DoubleFieldEditor.java

License:Open Source License

/**
 * Creates an double field editor.// w w  w . ja  va  2s. co  m
 * 
 * @param name the name of the preference this field editor works on
 * @param labelText the label text of the field editor
 * @param parent the parent of the field editor's control
 * @param textLimit the maximum number of characters in the text.
 */
public DoubleFieldEditor(String name, String labelText, Composite parent, int textLimit) {
    init(name, labelText);
    setTextLimit(textLimit);
    setEmptyStringAllowed(false);
    setErrorMessage(JFaceResources.getString("Not a valid double")); //$NON-NLS-1$
    createControl(parent);
}

From source file:hu.bme.mit.massif.simulink.importer.ui.dialogs.ContainerFieldEditor.java

License:Open Source License

public ContainerFieldEditor(String name, String labelText, Composite parent) {
    init(name, labelText);//  w  ww.  java  2 s .co m
    setErrorMessage(JFaceResources.getString("ContainerFieldEditor.errorMessage"));//$NON-NLS-1$
    setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
    setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
    createControl(parent);
}

From source file:io.usethesource.impulse.preferences.fields.FileFieldEditor.java

License:Open Source License

protected boolean doCheckState(String path) { // This is the real work of the original doCheckState()
    String msg = null;//w ww . ja v a2 s  .c  om
    File file = new File(path);
    if (file.isFile()) {
        if (enforceAbsolute && !file.isAbsolute())
            msg = JFaceResources.getString("FileFieldEditor.errorMessage2");//$NON-NLS-1$
    } else {
        msg = "Path does not designate a valid file";
    }

    boolean result = true;
    if (msg != null) {
        setErrorMessage(getFieldMessagePrefix() + msg);
        result = false;
    } else {
        clearErrorMessage();
        result = true;
    }

    return result;
}

From source file:io.usethesource.impulse.preferences.fields.FontFieldEditor.java

License:Open Source License

/**
 * Creates a font field editor with an optional preview area.
 * //  w  w w  . jav  a 2s  .  c o m
 * @param name the name of the preference this field editor works on
 * @param labelText the label text of the field editor
 * @param previewAreaText the text used for the preview window. If it is
 * <code>null</code> there will be no preview area,
 * @param parent the parent of the field editor's control
 */
public FontFieldEditor(String name, String labelText, String previewAreaText, Composite parent) {
    init(name, labelText);
    previewText = previewAreaText;
    changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$
    createControl(parent);
}

From source file:io.usethesource.impulse.preferences.fields.FontFieldEditor.java

License:Open Source License

public FontFieldEditor(PreferencePage page, PreferencesTab tab, IPreferencesService service, String level,
        String name, String labelText, Composite parent) {
    init(name, labelText);/*from   www  .  j  a va 2s .  c  o  m*/
    //      Assert.isTrue(checkArray(entryNamesAndValues));

    previewText = "The quick brown fox jumped over the lazy dog";
    changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$

    preferencesService = service;
    preferencesLevel = level;
    this.parent = parent;
    prefPage = page;
    setPage(prefPage);
    prefTab = tab;

    createControl(parent);
}

From source file:io.usethesource.impulse.preferences.fields.StringButtonFieldEditor.java

License:Open Source License

/**
 * Get the change control. Create it in parent if required.
 * @param parent/*from w w  w  . jav a2 s.  c  o m*/
 * @return Button
 */
public Button getChangeControl(Composite parent) {
    if (changeButton == null) {
        // Set enabled according to the associated text
        // field, if defined
        boolean enabled = false;
        Control[] children = parent.getChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof Text) {
                enabled = children[i].isEnabled();
            }
        }

        changeButton = new Button(parent, SWT.PUSH);
        if (changeButtonText == null)
            changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$
        changeButton.setText(changeButtonText);
        changeButton.setFont(parent.getFont());
        changeButton.setEnabled(enabled); // added
        changeButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent evt) {
                String newValue = changePressed();
                if (newValue != null) {
                    // SMS 28 Nov 2006
                    // Added setting of fields where setStringValue(..) is called
                    // and (below) setting of background color
                    levelFromWhichLoaded = preferencesLevel;
                    setInherited(false);
                    setPresentsDefaultValue(false);

                    setStringValue(newValue);

                    Text text = getTextControl();
                    text.setBackground(PreferencesUtilities.colorWhite);
                }
            }
        });
        changeButton.addDisposeListener(new DisposeListener() {
            public void widgetDisposed(DisposeEvent event) {
                changeButton = null;
            }
        });
    } else {
        checkParent(changeButton, parent);
    }
    return changeButton;
}