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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:scouter.client.configuration.views.ConfigureAgentView.java

License:Apache License

private void saveConfigurations() {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    try {//from ww w .ja  va 2s.c  o  m
        MapPack param = new MapPack();
        param.put("objHash", objHash);
        param.put("setConfig", text.getText());
        MapPack out = (MapPack) tcp.getSingle(RequestCmd.SET_CONFIGURE_WAS, param);

        if (out == null) {
            return;
        }

        if (out != null) {
            String config = out.getText("result");
            if ("true".equalsIgnoreCase(config)) {
                MessageDialog.open(MessageDialog.INFORMATION,
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Success",
                        objName + "- Configuration saving is done.", SWT.NONE);
                loadConfigList();
                saved = true;
            } else {
                MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        "Error", objName + "- Configuration saving is failed.");
            }
        }
    } catch (Exception e) {
        ConsoleProxy.errorSafe(e.toString());
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }
}

From source file:scouter.client.configuration.views.ConfigureServerView.java

License:Apache License

private void saveConfigurations() {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    try {//from   w  w w  .ja va2  s  .c om
        MapPack param = new MapPack();
        param.put("setConfig", text.getText());
        MapPack out = (MapPack) tcp.getSingle(RequestCmd.SET_CONFIGURE_SERVER, param);

        if (out != null) {
            String config = out.getText("result");
            if ("true".equalsIgnoreCase(config)) {
                MessageDialog.open(MessageDialog.INFORMATION,
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Success",
                        "Configuration saving is done.", SWT.NONE);
                loadConfigList();
            } else {
                MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        "Error", "Configuration saving is failed.");
            }
        }
    } catch (Exception e) {
        ConsoleProxy.errorSafe(e.toString());
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }
}

From source file:scouter.client.configuration.views.ConfigureView.java

License:Apache License

private void saveConfigurations() {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    try {//from ww w . j  av a 2 s .  c o m
        MapPack param = new MapPack();
        param.put("setConfig", text.getText());
        MapPack out = null;
        if (objHash == 0) {
            out = (MapPack) tcp.getSingle(RequestCmd.SET_CONFIGURE_SERVER, param);
        } else {
            param.put("objHash", objHash);
            out = (MapPack) tcp.getSingle(RequestCmd.SET_CONFIGURE_WAS, param);
        }

        if (out != null) {
            String config = out.getText("result");
            if ("true".equalsIgnoreCase(config)) {
                MessageDialog.open(MessageDialog.INFORMATION,
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Success",
                        "Configuration saving is done.", SWT.NONE);
                if (objHash == 0) {
                    loadConfigList(RequestCmd.LIST_CONFIGURE_SERVER, null);
                } else {
                    MapPack param2 = new MapPack();
                    param2.put("objHash", objHash);
                    loadConfigList(RequestCmd.LIST_CONFIGURE_WAS, param2);
                }
            } else {
                MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                        "Error", "Configuration saving is failed.");
            }
        }
    } catch (Exception e) {
        ConsoleProxy.errorSafe(e.toString());
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }
}

From source file:spritey.ui.wizards.SpriteSheetWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    isOverwrite = saveAsPage.isOverwrite();

    OverwriteQuery callback = new OverwriteQuery() {
        @Override/*  w w w.  j  av  a 2 s.c o m*/
        public int queryOverwrite(String path) {
            if (isOverwrite) {
                return OverwriteQuery.ALL;
            }

            String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL };

            File file = new File(path);
            String message = NLS.bind(Messages.SAVE_AS_OVERWRITE_FILE, file.getName(), file.getParent());
            final MessageDialog dialog = new MessageDialog(getShell(), Messages.SPRITE_SHEET_WIZARD_TITLE, null,
                    message, MessageDialog.QUESTION, buttons, 0) {
                @Override
                protected int getShellStyle() {
                    return super.getShellStyle() | SWT.SHEET;
                }
            };

            // This method is called from a non-UI thread, therefore,
            // opening dialog has to be wrapped into runnable and executed
            // in the UI thread.
            getShell().getDisplay().syncExec(new Runnable() {
                @Override
                public void run() {
                    dialog.open();
                }
            });
            return dialog.getReturnCode();
        }
    };

    try {
        SaveSheetOperation op = new SaveSheetOperation(newSheetPage.getConstraints(), newSheetPage.getSheet(),
                saveAsPage.getImageFile(), saveAsPage.getMetadataFile(), callback);
        getContainer().run(true, true, op);

        Shell parent = getContainer().getShell();
        IStatus status = op.getStatus();

        if (!status.isOK()) {
            // To make dialogs consistent throughout the application,
            // display a custom error dialog with details button only when
            // there are multiple problems. Otherwise display an OS native
            // dialog.
            if (status.isMultiStatus()) {
                ErrorDialog.openError(parent, Messages.SPRITE_SHEET_WIZARD_TITLE, null, status);
            } else {
                MessageDialog.open(MessageDialog.ERROR, parent, Messages.SPRITE_SHEET_WIZARD_TITLE,
                        status.getMessage(), SWT.SHEET);
            }
        } else {
            MessageDialog.open(MessageDialog.INFORMATION, parent, Messages.SPRITE_SHEET_WIZARD_TITLE,
                    Messages.SPRITE_SHEET_WIZARD_BUILT_SUCCESSFULLY, SWT.SHEET);
        }
    } catch (InterruptedException e) {
        return false;
    } catch (InvocationTargetException e) {
        throw new InternalError("Error occurred during save operation.", e);
    }
    return false;
}

From source file:tinyos.dlrc.jobs.InvokeMakeJob.java

License:Open Source License

public void execShouldContinue() {
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            IStatus ready = target.ready();
            if (ready != null) {
                int type = -1;
                String title = null;
                String message = null;

                switch (ready.getSeverity()) {
                case IStatus.ERROR:
                    title = "Error";
                    message = "an error";
                    type = MessageDialog.ERROR;
                    break;
                case IStatus.WARNING:
                    title = "Warning";
                    message = "a warning";
                    type = MessageDialog.WARNING;
                    break;
                case IStatus.INFO:
                    title = "Info";
                    message = "a message";
                    type = MessageDialog.INFORMATION;
                    break;
                }//from w w  w.  j  a v a  2 s.  c o m

                if (type >= 0) {
                    message = "There is " + message + " associated with this make-option:\n\n" + "'"
                            + ready.getMessage() + "'\n\n" + "Would you like to continue anyway?";

                    MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), title, null,
                            message, type,
                            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);

                    if (dialog.open() != 0) {
                        shouldContinue = false;
                    }
                }
            }
        }
    });
}

From source file:tubame.knowhow.plugin.ui.dialog.ConfirmDialog.java

License:Apache License

/**
 * Confirmation dialog for constructor.<br/>
 * Confirmation dialog with "Yes" "No" "Cancel" button.<br/>
 * /*  w  ww.  j a va2 s  . co  m*/
 * @param parentShell
 *            Shell to be displayed screen
 * @param dialogTitle
 *            Title of the dialog
 * @param dialogMessage
 *            Messages that are displayed in the dialog
 * @param dialogType
 *            Type of dialog
 */
public ConfirmDialog(Shell parentShell, String dialogTitle, String dialogMessage, int dialogType) {

    super(parentShell, dialogTitle, null, dialogMessage, dialogType, null, 1);

    LOGGER.debug("shell:" + parentShell + "message" + dialogMessage);
    if (dialogType == MessageDialog.QUESTION_WITH_CANCEL) {
        super.setButtonLabels(new String[] { "Yes", "No", "Cancel" });
    } else if (dialogType == MessageDialog.INFORMATION) {
        super.setButtonLabels(new String[] { "Yes" });
    } else {
        super.setButtonLabels(new String[] { "Yes", "No" });
    }
}

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:/*from  w  w w  .  j a va  2  s  .co  m*/
        return MessageDialog.NONE;
    }
}