Example usage for org.eclipse.jface.dialogs MessageDialog NONE

List of usage examples for org.eclipse.jface.dialogs MessageDialog NONE

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog NONE.

Prototype

int NONE

To view the source code for org.eclipse.jface.dialogs MessageDialog NONE.

Click Source Link

Document

Constant for no image (value 0).

Usage

From source file:org.mendix.eclipse.util.EclipseUtil.java

License:Open Source License

/**
 * Show a question in a modal dialog box and return the user's answer.
 * //from w  w  w  .j a va2  s  . c o m
 * @param title
 *            Text for the title bar of the dialog window
 * @param message
 *            The text of the message
 * @return true if users selects ok, false if he selected Cancel
 */
static public boolean showQuestion(String title, String message) {
    boolean goThrough;
    // accept the default window icon
    // TODO error in SWT cannot find WARNING icon
    final MessageDialog dialog = new MessageDialog(null, title, null, message, MessageDialog.NONE,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            dialog.open();
        }
    });
    if (dialog.getReturnCode() == Window.OK) {
        goThrough = true;
    } else {
        goThrough = false;
    }
    return goThrough;
}

From source file:org.pentaho.di.ui.repository.repositoryexplorer.controllers.BrowseController.java

License:Apache License

protected void confirmDialog(String title, String msg, String ok) throws Exception {
    MessageDialog confirmDialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.NONE,
            new String[] { ok }, 0) {
        @Override/*from ww w . jav  a 2 s. co  m*/
        protected Point getInitialSize() {
            return new Point(DIALOG_WIDTH, DIALOG_HEIGHT);
        }

        @Override
        protected void configureShell(Shell shell) {
            super.configureShell(shell);
            shell.setBackground(shell.getDisplay().getSystemColor(DIALOG_COLOR));
            shell.setBackgroundMode(SWT.INHERIT_FORCE);
        }
    };
    confirmDialog.open();
}

From source file:org.pentaho.di.ui.repository.repositoryexplorer.controllers.BrowseController.java

License:Apache License

protected void confirmDialog(Callable<Void> callback, String title, String msg, String yes, String no)
        throws Exception {
    MessageDialog confirmDialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.NONE,
            new String[] { yes, no }, 0) {
        @Override// w ww  .  j a v a  2  s  . c om
        protected Point getInitialSize() {
            return new Point(DIALOG_WIDTH, DIALOG_HEIGHT);
        }

        @Override
        protected void configureShell(Shell shell) {
            super.configureShell(shell);
            shell.setBackground(shell.getDisplay().getSystemColor(DIALOG_COLOR));
            shell.setBackgroundMode(SWT.INHERIT_FORCE);
        }
    };
    int result = confirmDialog.open();
    if (result == 0) {
        try {
            callback.call();
        } catch (Exception e) {
            if (mainController == null || !mainController.handleLostRepository(e)) {
                messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
                messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
                messageBox.setMessage(BaseMessages.getString(PKG, e.getLocalizedMessage()));
                messageBox.open();
            }
        }
    }
}

From source file:org.thanlwinsoft.languagetest.eclipse.search.LanguageTestItemSearch.java

License:Open Source License

protected void chooseTags() {
    TagFilterDialog mb = new TagFilterDialog(filterGroup.getShell(),
            MessageUtil.getString("SearchTagFilterTitle"), null, MessageUtil.getString("SearchTagFilterTitle"),
            MessageDialog.NONE, new String[] { MessageUtil.getString("OK"), MessageUtil.getString("Cancel") },
            0);/*from ww w.ja  v a2s  .c o m*/
    int result = mb.open();
    if (result == 0) {
        TagFilterComposite tfc = mb.getTagFilterComposite();
        if (tfc != null) {
            tags = tfc.getCheckedTagPaths();
            StringBuilder tagList = new StringBuilder();
            final String eol = System.getProperty("line.separator");
            switch (tags.length) {
            case 0:
                filtersLabel.setText(MessageUtil.getString("NoTagsSelected"));
                filtersLabel.setToolTipText(MessageUtil.getString("NoTagsSelected"));
                break;
            case 1:
                filtersLabel.setText(tags[0].toPortableString());
                filtersLabel.setToolTipText(tags[0].toPortableString());
                break;
            default:
                tagList.append(MessageUtil.getString("TagsSelected", Integer.toString(tags.length)));
                tagList.append(eol);
                for (IPath p : tags) {
                    tagList.append(p.toPortableString());
                    tagList.append(eol);
                }
                filtersLabel.setText(tagList.toString());
                filtersLabel.setToolTipText(tagList.toString());
            }

        }
    }
}

From source file:org.thanlwinsoft.languagetest.eclipse.views.EditTagDialog.java

License:Open Source License

/**
 * @param parentShell/*from   w w  w  .  j  a v a 2 s. c  o  m*/
 * @param dialogTitle
 * @param dialogMessage
 * @param isNew
 */
public EditTagDialog(Shell parentShell, String dialogTitle, String dialogMessage, boolean isNew) {
    super(parentShell, dialogTitle, null, dialogMessage, MessageDialog.NONE,
            new String[] { MessageUtil.getString("OK"), MessageUtil.getString("Cancel") }, 0);
    this.isNew = isNew;
}

From source file:org2.eclipse.php.internal.debug.ui.launching.FileSelectionDialog.java

License:Open Source License

/**
 * Creates a resource selection dialog rooted at the given element.
 * //from w  ww  . ja v a 2s . com
 * @param parentShell
 *            the parent shell
 * @param rootElement
 *            the root element to populate this dialog with
 * @param message
 *            the message to be displayed at the top of this dialog, or
 *            <code>null</code> to display a default message
 */
public FileSelectionDialog(Shell parentShell, IAdaptable rootElement, String message) {
    super(parentShell, "Choose Location", null, message, MessageDialog.NONE, new String[] { "OK", "Cancel" }, //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
            0);
    root = rootElement;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:us.pwc.vista.eclipse.core.helper.MessageDialogHelper.java

License:Apache License

private static int getDialogSeverity(int severity) {
    switch (severity) {
    case IStatus.ERROR:
        return MessageDialog.ERROR;
    case IStatus.WARNING:
        return MessageDialog.WARNING;
    case IStatus.INFO:
        return MessageDialog.INFORMATION;
    default:/*w  ww. jav a 2  s  .  com*/
        return MessageDialog.NONE;
    }
}