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.eclipse.tcf.te.ui.jface.dialogs.OptionalMessageDialog.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  w  w  w .j av  a 2  s .c  om
    toolBar.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem item = new ToolItem(toolBar, SWT.NONE);
    item.setImage(image);
    item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$
    item.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            helpPressed();
        }
    });
    return toolBar;
}

From source file:org.eclipse.team.svn.ui.dialog.DefaultDialog.java

License:Open Source License

protected ToolBar createHelpImageButton(Composite parent) {
    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  . ja v a  2s . c  om
    toolBar.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem item = new ToolItem(toolBar, SWT.NONE);
    item.setImage(JFaceResources.getImage(DLG_IMG_HELP));
    item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$
    item.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DefaultDialog.this.mainComposite.notifyListeners(SWT.Help, new Event());
        }
    });
    return toolBar;
}

From source file:org.eclipse.titan.log.viewer.preferences.fieldeditors.TitanListEditor.java

License:Open Source License

/**
 * Helper method to create a push button.
 * //from w w w.jav  a  2 s.com
 * @param parent 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) {
    Button button = new Button(parent, SWT.PUSH);
    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.eclipse.ui.internal.ide.ExtendedFileEditorsPreferencePage.java

License:Open Source License

@Override
public boolean performOk() {
    if (idePreferenceStore != null && idePreferenceStore.needsSaving()
            && idePreferenceStore instanceof IPersistentPreferenceStore) {
        try {//from   w w  w. j  ava2 s.c  o  m
            ((IPersistentPreferenceStore) idePreferenceStore).save();
        } catch (IOException e) {
            String message = JFaceResources.format("PreferenceDialog.saveErrorMessage", getTitle(), //$NON-NLS-1$
                    e.getMessage());
            Policy.getStatusHandler().show(new Status(IStatus.ERROR, Policy.JFACE, message, e),
                    JFaceResources.getString("PreferenceDialog.saveErrorTitle")); //$NON-NLS-1$
        }
    }
    return super.performOk();
}

From source file:org.eclipse.ui.internal.statushandlers.DefaultDetailsArea.java

License:Open Source License

private void createCopyAction(final Composite parent) {
    Menu menu = new Menu(parent.getShell(), SWT.POP_UP);
    copyAction = new MenuItem(menu, SWT.PUSH);
    copyAction.setText(JFaceResources.getString("copy")); //$NON-NLS-1$
    copyAction.addSelectionListener(new SelectionAdapter() {

        /*/*  w  ww.  j a  v  a2s  . co  m*/
         * (non-Javadoc)
         * 
         * @see
         * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
         * .swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            copyToClipboard();
            super.widgetSelected(e);
        }

    });
    text.setMenu(menu);
    if (text.getSelectionText().length() == 0) {
        copyAction.setEnabled(false);
    }
}

From source file:org.eclipse.ui.internal.statushandlers.SupportTray.java

License:Open Source License

/**
 * Creates any actions needed by the tray.
 *//*w  w w .  j  a va  2 s.c o  m*/
private void createActions() {
    createImages();
    closeAction = new ContributionItem() {
        public void fill(ToolBar parent, int index) {
            final ToolItem item = new ToolItem(parent, SWT.PUSH);
            item.setImage(normal);
            item.setHotImage(hover);
            item.setToolTipText(JFaceResources.getString("close")); //$NON-NLS-1$
            item.addListener(SWT.Selection, closeListener);
        }
    };
}

From source file:org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.java

License:Open Source License

/**
 * This method creates the initial state of the dialog.
 * //from   w  ww .  j av  a  2 s.  co  m
 * @param dialogState
 *            - the map to fill in.
 * @param displayMask
 *            - the mask suggesting which statuses should be displayed
 * @param dialogTitle
 *            - the dialog title.
 * @return populated dialogState
 */
public Map initDialogState(Map dialogState, int displayMask, String dialogTitle) {
    dialogState.put(IStatusDialogConstants.MASK, new Integer(displayMask));
    dialogState.put(IStatusDialogConstants.TITLE,
            dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$
                    dialogTitle);
    dialogState.put(IStatusDialogConstants.HANDLE_OK_STATUSES, Boolean.FALSE);

    dialogState.put(IStatusDialogConstants.SHOW_SUPPORT, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.ENABLE_DEFAULT_SUPPORT_AREA, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.DETAILS_OPENED, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.TRAY_OPENED, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.HIDE_SUPPORT_BUTTON, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.STATUS_ADAPTERS, Collections.synchronizedSet(new HashSet()));
    dialogState.put(IStatusDialogConstants.STATUS_MODALS, new HashMap());
    dialogState.put(IStatusDialogConstants.LABEL_PROVIDER, new LabelProviderWrapper(dialogState));
    dialogState.put(IStatusDialogConstants.MODALITY_SWITCH, Boolean.FALSE);
    dialogState.put(IStatusDialogConstants.ANIMATION, Boolean.TRUE);
    return dialogState;
}

From source file:org.eclipse.ui.internal.views.markers.MarkersViewColumnsDialog.java

License:Open Source License

protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(JFaceResources.getString("ConfigureColumnsDialog_Title")); //$NON-NLS-1$
}

From source file:org.eclipse.ui.internal.views.markers.ViewerColumnsDialog.java

License:Open Source License

/**
 * The Up and Down button to change column ordering.
 * /*from w w  w .ja v a 2  s.  c om*/
 * @param parent
 */
Control createUpDownBtt(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout compositeLayout = new GridLayout();
    compositeLayout.marginHeight = 0;
    compositeLayout.marginWidth = 0;
    composite.setLayout(compositeLayout);
    composite.setLayoutData(new GridData(SWT.NONE, SWT.FILL, false, true));

    Composite bttArea = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    bttArea.setLayout(layout);
    bttArea.setLayoutData(new GridData(SWT.NONE, SWT.CENTER, false, true));
    upButton = new Button(bttArea, SWT.PUSH);
    upButton.setText(JFaceResources.getString("ConfigureColumnsDialog_up")); //$NON-NLS-1$
    upButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleUpButton(event);
        }
    });
    setButtonLayoutData(upButton);
    ((GridData) upButton.getLayoutData()).verticalIndent = tableLabelSize.y;
    upButton.setEnabled(false);

    downButton = new Button(bttArea, SWT.PUSH);
    downButton.setText(JFaceResources.getString("ConfigureColumnsDialog_down")); //$NON-NLS-1$
    downButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            handleDownButton(event);
        }
    });
    setButtonLayoutData(downButton);
    downButton.setEnabled(false);
    return bttArea;
}

From source file:org.eclipse.ui.internal.views.markers.ViewerSettingsAndStatusDialog.java

License:Open Source License

/**
 * @return Returns the error message to display for a wrong limit value.
 *///from   w ww.  ja v  a  2  s.c om
protected String getErrorMessage() {
    return JFaceResources.getString("StringFieldEditor.errorMessage"); //$NON-NLS-1$
}