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:nl.utwente.ce.imageexport.ExceptionErrorDialog.java

License:Open Source License

/**
 * @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// w w w  .ja va2s.  co  m
 * @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
 */
public ExceptionErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status) {
    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;
}

From source file:org.adichatz.widget.richText.HyperlinkDialog.java

License:CeCILL license

protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID,
            JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
    okButton.setEnabled(false);//from  w  ww. j a  v a2  s  .  c o m
    createButton(parent, IDialogConstants.CANCEL_ID,
            JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY), false);
}

From source file:org.bonitasoft.studio.common.jface.BonitaErrorDialog.java

License:Open Source License

@Override
protected List createDropDownList(Composite parent) {
    list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    // fill the list
    populateList(list);// ww  w . java2  s.  c  om
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL
            | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
    data.heightHint = list.getItemHeight() * 7;
    data.horizontalSpan = 2;
    list.setLayoutData(data);
    list.setFont(parent.getFont());
    Menu copyMenu = new Menu(list);
    MenuItem copyItem = new MenuItem(copyMenu, SWT.NONE);
    copyItem.addSelectionListener(new SelectionListener() {
        /*
         * @see SelectionListener.widgetSelected (SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            copyToClipboard();
        }

        /*
         * @see SelectionListener.widgetDefaultSelected(SelectionEvent)
         */
        public void widgetDefaultSelected(SelectionEvent e) {
            copyToClipboard();
        }
    });
    copyItem.setText(JFaceResources.getString("copy")); //$NON-NLS-1$
    list.setMenu(copyMenu);
    listCreated = true;
    return list;
}

From source file:org.bonitasoft.studio.contract.ui.property.constraint.edit.editor.ConstraintEditorWizardDialog.java

License:Open Source License

private ToolBar createHelpImageButton(final Composite parent, final Image image) {
    final ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);/*from  ww  w . j  ava  2 s  .c  o  m*/
    toolBar.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(final DisposeEvent e) {
            cursor.dispose();
        }
    });
    final ToolItem fHelpButton = new ToolItem(toolBar, SWT.CHECK);
    fHelpButton.setImage(image);
    fHelpButton.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$
    fHelpButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            helpPressed();
        }
    });
    return toolBar;
}

From source file:org.caleydo.core.gui.util.AHelpButtonDialog.java

License:Open Source License

private ToolBar createHelpImageButton(Composite parent, Image image) {
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);/*w  w w .  j a v  a2 s.  c o m*/
    toolBar.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    helpButton = new ToolItem(toolBar, SWT.PUSH);
    helpButton.setImage(image);
    helpButton.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            helpPressed();
        }
    });
    return toolBar;
}

From source file:org.caleydo.core.gui.util.HelpButtonWizardDialog.java

License:Open Source License

private ToolBar createHelpImageButton(Composite parent, Image image) {
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);//from  ww w  . j av  a 2  s.co m
    toolBar.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    helpButton = new ToolItem(toolBar, SWT.PUSH);
    helpButton.setImage(image);
    helpButton.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpButton.setData(new Integer(IDialogConstants.HELP_ID));
    helpButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
    return toolBar;
}

From source file:org.cs3.prolog.ui.util.FileListEditor.java

License:Open Source License

/**
 * Helper method to create a push button.
 * //  w w  w . j  a v  a2  s  . co m
 * @param parent the parent control
 * @param key the resource name used to supply the button's label text
 * @return Button
 */
private Button createPushButton(Composite parent, String key) {
    Button button = new Button(parent, SWT.PUSH);
    if (key.equals("HACK.addFile")) {
        button.setText(addFileButtonLabel);
    } else if (key.equals("HACK.addDir")) {
        button.setText(addDirButtonLabel);
    } else {
        button.setText(JFaceResources.getString(key));
    }
    button.setFont(parent.getFont());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    button.addSelectionListener(getSelectionListener());
    return button;
}

From source file:org.csstudio.apputil.ui.dialog.ErrorDetailDialog.java

License:Open Source License

/** Show only the 'OK' button, no 'Cancel' */
@Override/*from  w w  w .ja v  a2  s  . c  om*/
protected void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY), true);
}

From source file:org.csstudio.display.builder.rcp.preferences.TextAreaFieldEditor.java

License:Open Source License

/**
 * Creates a string field editor./*from   ww w  .  j a  v a  2 s.c  om*/
 * Use the method <code>setTextLimit</code> to limit the text.
 *
 * @param name the name of the preference this field editor works on
 * @param labelText the label text of the field editor
 * @param width the width of the text input field in characters,
 *  or <code>UNLIMITED</code> for no limit
 * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform
 *  on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
 *  perform validation only after the text has been typed in
 * @param parent the parent of the field editor's control
 * @since 2.0
 */
public TextAreaFieldEditor(String name, String labelText, Composite parent, int width, int height) {
    init(name, labelText);
    widthInChars = width;
    heightInChars = height;
    isValid = false;
    errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$
    createControl(parent);
}

From source file:org.csstudio.domain.common.ui.AbstractTableFieldEditor.java

License:Open Source License

/**
 * Helper method to create a push button.
 *
 * @param parent//from  w w  w.  j  a v a2 s.co m
 *            the parent control
 * @param key
 *            the resource name used to supply the button's label text
 * @return Button
 */
private Button createPushButton(final Composite parent, final String key,
        final SelectionListener selectionListener) {
    final Button button = new Button(parent, SWT.PUSH);
    button.setText(JFaceResources.getString(key));
    button.setFont(parent.getFont());
    final GridData data = new GridData(GridData.FILL_HORIZONTAL);
    final int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    button.addSelectionListener(selectionListener);
    return button;
}