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:org.csstudio.domain.common.ui.WorkspaceDirectoryFieldEditor.java

License:Open Source License

/**
 * Creates a directory field editor.// www  .  j  a va  2 s . 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 WorkspaceDirectoryFieldEditor(final String name, final String labelText, final Composite parent) {
    _workspace = ResourcesPlugin.getWorkspace();
    init(name, labelText);
    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:org.csstudio.domain.common.ui.WorkspaceFileFieldEditor.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 WorkspaceFileFieldEditor(final String name, final String labelText, final Composite parent) {
    _workspace = ResourcesPlugin.getWorkspace();
    init(name, labelText);
    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:org.csstudio.sds.ui.internal.layers.LayerTransfer.java

License:Open Source License

/**
 * {@inheritDoc}//from w  w  w . j  a va2 s  .  c o m
 */
@Override
public Object nativeToJava(final TransferData transferData) {
    Object result = super.nativeToJava(transferData);
    if (isInvalidNativeType(result)) {
        Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR,
                JFaceResources.getString("LocalSelectionTransfer.errorMessage"), null)); //$NON-NLS-1$
    }
    return _selectedLayer;
}

From source file:org.csstudio.ui.util.dialogs.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * Creates an error dialog. Note that the dialog will have no visual
 * representation (no widgets) until it is told to open.
 * <p>/*w  ww. j av  a  2 s .c o m*/
 * Normally one should use <code>openError</code> to create and open one of
 * these. This constructor is useful only if the error object being
 * displayed contains child items <it>and </it> you need to specify a mask
 * which will be used to filter the displaying of these children.
 * </p>
 *
 * @param parentShell
 *            the shell under which to create this dialog
 * @param dialogTitle
 *            the title to use for this dialog, or <code>null</code> to
 *            indicate that the default title should be used
 * @param message
 *            the message to show in this dialog, or <code>null</code> to
 *            indicate that the error's message should be shown as the
 *            primary message
 * @param status
 *            the error to show to the user
 * @param displayMask
 *            the mask to use to filter the displaying of child items, as
 *            per <code>IStatus.matches</code>
 * @see org.eclipse.core.runtime.IStatus#matches(int)
 */
public ExceptionDetailsErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status,
        int displayMask) {
    super(parentShell);
    this.title = dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$
            dialogTitle;
    this.message = message == null ? status.getMessage()
            : JFaceResources.format("Reason", new Object[] { message, status.getMessage() }); //$NON-NLS-1$
    this.status = status;
    this.displayMask = displayMask;
}

From source file:org.csstudio.ui.util.dialogs.ExceptionDetailsErrorDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.OK_ID, JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
    createDetailsButton(parent);// ww  w.j  a v a2s.  co m
}

From source file:org.csstudio.ui.util.dialogs.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * Create the details button if it should be included.
 *
 * @param parent//from  w  w w.  j  a v  a  2  s  .  c o m
 *            the parent composite
 * @since 3.2
 */
protected void createDetailsButton(Composite parent) {
    if (shouldShowDetailsButton()) {
        detailsButton = createButton(parent, IDialogConstants.DETAILS_ID,
                JFaceResources.getString(IDialogLabelKeys.SHOW_DETAILS_LABEL_KEY), false);
    }
}

From source file:org.csstudio.ui.util.dialogs.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * Toggles the unfolding of the details area. This is triggered by the user
 * pressing the details button.//from   w w w.jav a 2 s.  c om
 */
private void toggleDetailsArea() {
    Point windowSize = getShell().getSize();
    Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    if (listCreated) {
        text.dispose();
        listCreated = false;
        detailsButton.setText(JFaceResources.getString(IDialogLabelKeys.SHOW_DETAILS_LABEL_KEY));
    } else {
        text = createDropDownList((Composite) getContents());
        detailsButton.setText(JFaceResources.getString(IDialogLabelKeys.HIDE_DETAILS_LABEL_KEY));
    }
    Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    // newSize = new Point(newSize.x, Math.min(newSize.y, 500));
    getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
}

From source file:org.csstudio.utility.adlconverter.ui.preferences.ContainerFieldEditor.java

License:Open Source License

/**
 * Creates a directory field editor.//from www .  j a 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 parent the parent of the field editor's control
 */
public ContainerFieldEditor(final String name, final String labelText, final Composite parent) {
    init(name, labelText);
    setEmptyStringAllowed(true);
    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:org.ebayopensource.turmeric.eclipse.ui.components.DependencyListEditor.java

License:Open Source License

@Override
protected void doFillIntoGrid(final Composite parent, final int numColumns) {

    super.doFillIntoGrid(parent, numColumns);
    // This code just browse through the buttons
    // and change the names from new to add
    for (final Control btn : getButtonBoxControl(parent).getChildren()) {
        if (btn instanceof Button) {
            final Button button = (Button) btn;
            if (JFaceResources.getString("ListEditor.add").equals(button.getText()))
                button.setText("&Add ");
            else if (JFaceResources.getString("ListEditor.remove").equals(button.getText()))
                button.setText("&Remove ");
            ((GridData) button.getLayoutData()).widthHint += 15;
        }//from   ww  w.  ja v a  2s.c  o m
    }
}

From source file:org.ebayopensource.turmeric.eclipse.utils.ui.SOAErrorDialog.java

License:Open Source License

/**
 * Instantiates a new sOA error dialog.//from  ww w  . ja v  a  2  s. c om
 *
 * @param parent the parent
 * @param title the title
 * @param message the message
 * @param status the status
 * @param mask the mask
 * @param needLineBreak the need line break
 * @param needLineTitle the need line title
 * @param needCancelButton the need cancel button
 * @param changeButtonLabel the change button label
 */
public SOAErrorDialog(Shell parent, String title, String message, IStatus status, int mask,
        boolean needLineBreak, boolean needLineTitle, boolean needCancelButton, boolean changeButtonLabel) {
    super(parent);
    errorDialogTitle = title;
    if (errorDialogTitle == null) {
        errorDialogTitle = JFaceResources.getString("Problem_Occurred");
    }

    this.message = message == null ? status.getMessage()
            : JFaceResources.format("Reason", new Object[] { message, status.getMessage() }); //$NON-NLS-1$
    this.status = status;
    this.filterMask = mask;
    setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);// #added by wecai
    this.hasLineBreak = needLineBreak;
    this.hasLineTitle = needLineTitle;
    this.hasCancelButton = needCancelButton;
    this.buttonLabelChange = changeButtonLabel;
}