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.marketcetera.photon.preferences.PasswordStringFieldEditor.java

License:Open Source License

/**
 * Creates a string field editor./*from  w  w w.  j  a v  a2  s  .  com*/
 * 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 PasswordStringFieldEditor(String name, String labelText, int width, int strategy, Composite parent) {
    init(name, labelText);
    widthInChars = width;
    setValidateStrategy(strategy);
    isValid = false;
    errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$
    createControl(parent);
}

From source file:org.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

/**
 * Creates and return a new wizard closing dialog without opening it.
 * @return MessageDalog/*from  w w  w . java  2s.c  o m*/
 */
@objid("bc1ce88d-120f-11e2-b5c6-002564c97630")
private MessageDialog createWizardClosingDialog() {
    MessageDialog result = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$
            null, JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
            MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    return result;
}

From source file:org.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

/**
 * Update the receiver for the new page.
 * @param page//from   w w w. j  ava2 s . c  o  m
 */
@objid("bc21ab54-120f-11e2-b5c6-002564c97630")
void updateForPage(final IWizardPage page) {
    // ensure this page belongs to the current wizard
    if (this.wizard != page.getWizard()) {
        setWizard(page.getWizard());
    }
    // ensure that page control has been created
    // (this allows lazy page control creation)
    if (page.getControl() == null) {
        page.createControl(this.pageContainer);
        // the page is responsible for ensuring the created control is
        // accessible via getControl.
        Assert.isNotNull(page.getControl(),
                JFaceResources.format(JFaceResources.getString("WizardDialog.missingSetControl"), //$NON-NLS-1$
                        new Object[] { page.getName() }));
        // ensure the dialog is large enough for this page
        updateSize(page);
    }
    // make the new page visible
    IWizardPage oldPage = this.currentPage;
    this.currentPage = page;

    this.currentPage.setVisible(true);
    if (oldPage != null) {
        oldPage.setVisible(false);
    }
    // update the dialog controls
    update();
}

From source file:org.modelio.app.preferences.ScopedPreferenceStore.java

License:Open Source License

@objid("63af2892-f55d-424b-b447-41b5a5c80917")
@Override/*from  ww  w . jav  a  2 s .c  o m*/
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    // important: create intermediate array to protect against listeners
    // being added/removed during the notification
    final Object[] list = getListeners();
    if (list.length == 0) {
        return;
    }
    final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue);
    for (int i = 0; i < list.length; i++) {
        final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
        SafeRunner.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
            @Override
            public void run() {
                listener.propertyChange(event);
            }
        });
    }
}

From source file:org.mxupdate.eclipse.properties.FieldUtil.java

License:Apache License

/**
 * Appends a file field with a button to choose a file from the file
 * system./*from   w ww  .  ja  v a  2s. c  o  m*/
 *
 * @param _parent       parent composite where the field is added
 * @param _properties   properties where to store updated value
 * @param _propertyKey  property key
 * @param _default      default value of the file field
 * @param _extensions   allowed extensions of the file (could be
 *                      <code>null</code>)
 */
public static void addFileField(final Composite _parent, final ProjectProperties _properties,
        final String _propertyKey, final String _default, final String... _extensions) {
    final String label = Messages
            .getString(new StringBuilder(ProjectProperties.MSG_PREFIX).append(_propertyKey));

    // label
    final Label labelField = new Label(_parent, SWT.LEFT);
    final GridData labelGridData = new GridData();
    labelGridData.widthHint = FieldUtil.LABEL_WIDTH;
    labelField.setLayoutData(labelGridData);
    labelField.setText(label);

    // text field
    final Text textField = new Text(_parent, SWT.LEFT | SWT.BORDER);
    final GridData textGridData = new GridData();
    textGridData.horizontalSpan = 2;
    textGridData.horizontalAlignment = SWT.FILL;
    textGridData.grabExcessHorizontalSpace = true;
    textGridData.widthHint = 150;
    textField.setLayoutData(textGridData);
    textField.setText(_properties.getString(_propertyKey, _default));
    textField.addKeyListener(new KeyAdapter() {
        @Override()
        public void keyReleased(final KeyEvent _event) {
            _properties.setString(_propertyKey, textField.getText());
        }
    });
    textField.addFocusListener(new FocusAdapter() {
        @Override()
        public void focusLost(final FocusEvent _event) {
            _properties.setString(_propertyKey, textField.getText());
        }
    });

    // button to browse for files
    final Button button = new Button(_parent, SWT.PUSH);
    button.setText(JFaceResources.getString("openBrowse")); //$NON-NLS-1$
    button.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(final SelectionEvent _event) {
        }

        public void widgetSelected(final SelectionEvent _event) {
            final FileDialog dialog = new FileDialog(button.getShell(), SWT.OPEN);
            dialog.setText(label);
            if (!textField.getText().isEmpty()) {
                dialog.setFileName(textField.getText());
            }
            if (_extensions != null) {
                dialog.setFilterExtensions(_extensions);
            }
            final String file = dialog.open();
            if ((file != null) && !file.trim().isEmpty()) {
                textField.setText(file);
                _properties.setString(_propertyKey, file);
            }
        }
    });
}

From source file:org.netxms.ui.eclipse.tools.MessageDialogHelper.java

License:Open Source License

/**
 * Convenience method to open a simple confirm (OK/Cancel) dialog with a check box
 * to remember selection. //www .j  av a 2 s  . c o  m
 * 
 * @param parent the parent shell of the dialog, or <code>null</code> if none
 * @param title the dialog's title, or <code>null</code> if none
 * @param label the label for the check box
 * @param message the message
 * @return 
 */
public static DialogData openConfirmWithCheckbox(Shell parent, String title, String label, String message) {
    MessageDialogWithCheckbox msg = new MessageDialogWithCheckbox(MessageDialog.CONFIRM,
            new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY),
                    JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY) },
            parent, title, label, message);
    return msg.openMsg();
}

From source file:org.netxms.ui.eclipse.tools.MessageDialogHelper.java

License:Open Source License

/**
 * Convenience method to open a standard warning dialog with a check box
 * to remember selection. /*from  ww w  .jav  a2  s  . co  m*/
 * 
 * @param parent the parent shell of the dialog, or <code>null</code> if none
 * @param title the dialog's title, or <code>null</code> if none
 * @param label the label for the check box
 * @param message the message
 * @return 
 */
public static DialogData openWarningWithCheckbox(Shell parent, String title, String label, String message) {
    MessageDialogWithCheckbox msg = new MessageDialogWithCheckbox(MessageDialog.WARNING,
            new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY),
                    JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY) },
            parent, title, label, message);
    return msg.openMsg();
}

From source file:org.nightlabs.base.ui.exceptionhandler.DefaultErrorDialog.java

License:Open Source License

public DefaultErrorDialog() {
    super(RCPUtil.getActiveShell(), JFaceResources.getString("Problem_Occurred"), //$NON-NLS-1$
            null, JFaceResources.getString("Problem_Occurred"), //$NON-NLS-1$
            ERROR,/*from   w  w w.  ja  v a  2  s. c om*/
            // FIXME: Build problem: IDialogConstants.OK_LABEL is static in RCP but non-static in RAP
            //            new String[] { CompatibleDialogConstants.get().OK_LABEL },
            new String[] { "OK" }, 0);
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:org.nightlabs.base.ui.exceptionhandler.DefaultErrorDialog.java

License:Open Source License

@Override
public void showError(String dialogTitle, String message, ExceptionHandlerParam exceptionHandlerParam) {
    this.title = dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : dialogTitle; //$NON-NLS-1$
    this.exceptHandlerParam = exceptionHandlerParam;

    ErrorItem errorItem = creatErrorItem(dialogTitle, message, exceptHandlerParam.getThrownException(),
            exceptHandlerParam.getTriggerException());
    errorList.add(errorItem);/*from w  w w .  java2  s .co m*/
    if (errorTable != null) {
        errorTable.refresh();
    }
    if (errorList.size() > 1)
        showErrorTable(true);
    setErrorItem(errorItem);
}

From source file:org.opentravel.schemas.controllers.MainController.java

License:Apache License

public static RepositoryManager getDefaultRepositoryManager() {
    RepositoryManager defaultManager = null;
    try {/*from  w  w  w  .  ja v a  2  s.c  o m*/
        defaultManager = RepositoryManager.getDefault();
    } catch (RepositoryException ex) {
        IStatus ss = new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex);
        ErrorWithExceptionDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                JFaceResources.getString("error"),
                MessageFormat.format(Messages.getString("dialog.localRepository.error.message"),
                        RepositoryFileManager.getDefaultRepositoryLocation()),
                ss);
        LOGGER.error("Invalid local repository", ex);
        PlatformUI.getWorkbench().close();
    }
    return defaultManager;
}