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:com.amazonaws.eclipse.explorer.sns.CreateTopicDialog.java

License:Apache License

public CreateTopicDialog() {
    super(Display.getDefault().getActiveShell(), "Create New SNS Topic", null,
            "Enter the name for your new SNS Topic.", MessageDialog.INFORMATION,
            new String[] { "OK", "Cancel" }, 0);
}

From source file:com.amazonaws.eclipse.lambda.invoke.handler.InvokeFunctionHandler.java

License:Open Source License

private static void askForDeploymentFirst(IProject project) {
    MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Function not uploaded yet",
            null, "You need to upload the function to Lambda before invoking it.", MessageDialog.INFORMATION,
            new String[] { "Upload now", "Cancel" }, 0);
    int result = dialog.open();

    if (result == 0) {
        trackUploadWizardOpenedBeforeFunctionInvoke();
        UploadFunctionToLambdaCommandHandler.doUploadFunctionProjectToLambda(project);
    }/*w w w.  j a  v  a 2 s.  c  o  m*/
}

From source file:com.aptana.ide.debug.internal.ui.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *///from w  w  w .  j a  v a  2  s.co  m
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = DebugUiPlugin.getActiveWorkbenchShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtils.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/pro/pdm.php", "org.eclipse.ui.browser.ie"); //$NON-NLS-1$ //$NON-NLS-2$
            /* continue */
        case 1:
            return new Boolean(true);
        case 3:
            WorkbenchHelper.launchBrowser("http://www.aptana.com/docs/index.php/Installing_the_IE_debugger"); //$NON-NLS-1$
            return new Boolean(true);
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning,
                        new String[] { ((String) source).substring(5) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        new String[] { ((String) source).substring(10) }));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                    ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                    : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
        }
    }
    IPreferenceStore store = DebugUiPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return new Boolean(true);
        }
    }
    String message = StringUtils.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            new String[] { (String) source });

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return new Boolean(true);
        case IDialogConstants.NO_ID:
            return new Boolean(false);
        default:
            break;
        }
        WorkbenchHelper.launchBrowser(((String) source).indexOf("Internet Explorer") != -1 //$NON-NLS-1$
                ? "http://www.aptana.com/docs/index.php/Installing_the_IE_debugger" //$NON-NLS-1$
                : "http://www.aptana.com/docs/index.php/Installing_the_JavaScript_debugger"); //$NON-NLS-1$
    }
}

From source file:com.aptana.ide.debug.internal.ui.LaunchDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *//*from w w w.  java2  s.co m*/
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = DebugUiPlugin.getActiveWorkbenchShell();
    String title = Messages.LaunchDebuggerPromptStatusHandler_Title;
    String message = Messages.LaunchDebuggerPromptStatusHandler_DebuggerSessionIsActive;

    MessageDialog dlg = new MessageDialog(shell, title, null, message, MessageDialog.INFORMATION, new String[] {
            Messages.LaunchDebuggerPromptStatusHandler_CloseActiveSession, IDialogConstants.CANCEL_LABEL }, 1);
    return new Boolean(dlg.open() == 0);
}

From source file:com.aptana.ide.debug.internal.ui.Startup.java

License:Open Source License

private String showBrowserNotFoundDialog(final boolean download) {
    final String[] path = new String[] { null };
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
        public void run() {

            if (Display.getCurrent().getActiveShell() == null) { // another message box is shown
                return;
            }//w w w . j  a v a2 s  .com
            MessageDialogWithToggle md = new MessageDialogWithToggle(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    Messages.Startup_Notification, null, Messages.Startup_AptanaRequiresFirefox,
                    MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.PROCEED_LABEL, StringUtils.ellipsify(CoreStrings.BROWSE),
                            download ? Messages.Startup_Download : Messages.Startup_CheckAgain },
                    0, Messages.Startup_DontAskAgain, false);
            md.setPrefKey(com.aptana.ide.debug.internal.ui.IDebugUIConstants.PREF_SKIP_FIREFOX_CHECK);
            md.setPrefStore(DebugUiPlugin.getDefault().getPreferenceStore());

            int returnCode = md.open();
            switch (returnCode) {
            case IDialogConstants.INTERNAL_ID:
                FileDialog fileDialog = new FileDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN);
                if (Platform.OS_WIN32.equals(Platform.getOS())) {
                    fileDialog.setFilterExtensions(new String[] { "*.exe" }); //$NON-NLS-1$
                    fileDialog.setFilterNames(new String[] { Messages.Startup_ExecutableFiles });
                }
                path[0] = fileDialog.open();
                break;
            case IDialogConstants.INTERNAL_ID + 1:
                if (download) {
                    WorkbenchHelper.launchBrowser("http://www.getfirefox.com"); //$NON-NLS-1$
                }
                path[0] = StringUtils.EMPTY;
                break;
            default:
            }
        }
    });
    return path[0];
}

From source file:com.aptana.ide.server.ui.views.actions.OpenStatisticsAction.java

License:Open Source License

/**
 * @see org.eclipse.jface.action.Action#run()
 *//*from   w w w  . jav a 2  s. c  om*/
public void run() {
    ISelection selection = provider.getSelection();
    if (selection instanceof StructuredSelection && !selection.isEmpty()) {
        StructuredSelection ss = (StructuredSelection) selection;
        if (ss.getFirstElement() != null && ss.getFirstElement() instanceof IServer) {
            IServer server = (IServer) ss.getFirstElement();
            if (server.suppliesStatisticsInterface()) {
                server.showStatisticsInterface();
            } else {
                String stats = server.fetchStatistics();
                MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(),
                        StringUtils.format(Messages.OpenStatisticsAction_Stats_Title, server.getName()), null,
                        stats, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0) {

                    protected Control createMessageArea(Composite composite) {
                        super.createMessageArea(composite);
                        GridData mlData = new GridData(SWT.FILL, SWT.FILL, true, true);
                        super.messageLabel.setLayoutData(mlData);
                        return composite;
                    }

                    protected int getMessageLabelStyle() {
                        return SWT.LEFT;
                    }

                };
                dialog.open();
            }
        }

    }
}

From source file:com.aptana.js.debug.ui.internal.InstallDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *///w  ww.  ja va2  s. c  o  m
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = UIUtils.getActiveShell();
    String title = Messages.InstallDebuggerPromptStatusHandler_InstallDebuggerExtension;

    if ("install".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_AcceptExtensionInstallation_Quit);
        return null;
    } else if ("postinstall".equals(source)) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                Messages.InstallDebuggerPromptStatusHandler_WaitbrowserLaunches_Quit);
        return null;
    } else if ("nopdm".equals(source)) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null, Messages.InstallDebuggerPromptStatusHandler_PDMNotInstalled, MessageDialog.WARNING,
                new String[] { StringUtil.ellipsify(Messages.InstallDebuggerPromptStatusHandler_Download),
                        CoreStrings.CONTINUE, CoreStrings.CANCEL, CoreStrings.HELP },
                0);
        switch (md.open()) {
        case 0:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_INSTALL_PDM, "org.eclipse.ui.browser.ie"); //$NON-NLS-1$
            return Boolean.TRUE;
        case 1:
            return Boolean.TRUE;
        case 3:
            WorkbenchBrowserUtil.launchExternalBrowser(URL_DOCS_INSTALL_IE_DEBUGGER);
            return Boolean.TRUE;
        default:
            break;
        }
        return null;
    } else if (source instanceof String && ((String) source).startsWith("quit_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title, MessageFormat.format(
                Messages.InstallDebuggerPromptStatusHandler_BrowserIsRunning, ((String) source).substring(5)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("installed_")) { //$NON-NLS-1$
        MessageDialog.openInformation(shell, title,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstalled,
                        ((String) source).substring(10)));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("warning_")) { //$NON-NLS-1$
        MessageDialog.openWarning(shell, title, ((String) source).substring(8));
        return null;
    } else if (source instanceof String && ((String) source).startsWith("failed_")) { //$NON-NLS-1$
        MessageDialog md = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                title, null,
                MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionInstallFailed,
                        new Object[] { ((String) source).substring(7) }),
                MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, CoreStrings.HELP }, 0);
        while (true) {
            switch (md.open()) {
            case IDialogConstants.OK_ID:
                return null;
            default:
                break;
            }
            String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                    ? URL_DOCS_INSTALL_IE_DEBUGGER
                    : URL_DOCS_INSTALL_DEBUGGER;
            WorkbenchBrowserUtil.launchExternalBrowser(urlString);
        }
    }
    IPreferenceStore store = JSDebugUIPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return Boolean.TRUE;
        }
    }
    String message = MessageFormat.format(Messages.InstallDebuggerPromptStatusHandler_ExtensionNotInstalled,
            (String) source);

    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.INFORMATION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, CoreStrings.HELP }, 2, null,
            false);
    dialog.setPrefKey(IJSDebugUIConstants.PREF_INSTALL_DEBUGGER);
    dialog.setPrefStore(store);

    while (true) {
        switch (dialog.open()) {
        case IDialogConstants.YES_ID:
            return Boolean.TRUE;
        case IDialogConstants.NO_ID:
            return Boolean.FALSE;
        default:
            break;
        }
        String urlString = (((String) source).indexOf("Internet Explorer") != -1) //$NON-NLS-1$
                ? URL_DOCS_INSTALL_IE_DEBUGGER
                : URL_DOCS_INSTALL_DEBUGGER;
        WorkbenchBrowserUtil.launchExternalBrowser(urlString);
    }
}

From source file:com.aptana.js.debug.ui.internal.LaunchConfigurationsHelper.java

License:Open Source License

public static String showBrowserNotFoundDialog(final boolean download) {
    final String[] path = new String[] { null };
    UIUtils.getDisplay().syncExec(new Runnable() {
        public void run() {
            MessageDialogWithToggle md = new MessageDialogWithToggle(UIUtils.getActiveShell(),
                    Messages.Startup_Notification, null, Messages.Startup_StudioRequiresFirefox,
                    MessageDialog.INFORMATION,
                    new String[] { StringUtil.ellipsify(CoreStrings.BROWSE),
                            download ? Messages.Startup_Download : Messages.Startup_CheckAgain,
                            IDialogConstants.CANCEL_LABEL },
                    0, Messages.Startup_DontAskAgain, false);
            md.setPrefKey(com.aptana.js.debug.ui.internal.IJSDebugUIConstants.PREF_SKIP_FIREFOX_CHECK);
            md.setPrefStore(JSDebugUIPlugin.getDefault().getPreferenceStore());

            int returnCode = md.open();
            switch (returnCode) {
            case IDialogConstants.INTERNAL_ID:
                FileDialog fileDialog = new FileDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN);
                if (Platform.OS_WIN32.equals(Platform.getOS())) {
                    fileDialog.setFilterExtensions(new String[] { "*.exe" }); //$NON-NLS-1$
                    fileDialog.setFilterNames(new String[] { Messages.Startup_ExecutableFiles });
                }/*  w w w.  j  a  va2s  .c om*/
                path[0] = fileDialog.open();
                break;
            case IDialogConstants.INTERNAL_ID + 1:
                if (download) {
                    WorkbenchBrowserUtil.launchExternalBrowser("http://www.getfirefox.com"); //$NON-NLS-1$
                }
                path[0] = StringUtil.EMPTY;
                break;
            default:
            }
        }
    });
    return path[0];
}

From source file:com.aptana.js.debug.ui.internal.LaunchDebuggerPromptStatusHandler.java

License:Open Source License

/**
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
 *//*from  w  ww  .  j a  v a2s . co  m*/
public Object handleStatus(IStatus status, Object source) throws CoreException {
    Shell shell = UIUtils.getActiveShell();
    String title = Messages.LaunchDebuggerPromptStatusHandler_Title;
    String message = Messages.LaunchDebuggerPromptStatusHandler_DebuggerSessionIsActive;

    MessageDialog dlg = new MessageDialog(shell, title, null, message, MessageDialog.INFORMATION, new String[] {
            Messages.LaunchDebuggerPromptStatusHandler_CloseActiveSession, IDialogConstants.CANCEL_LABEL }, 1);
    return Boolean.valueOf(dlg.open() == Window.OK);
}

From source file:com.aptana.portal.ui.dispatch.configurationProcessors.JavaScriptLibraryInstallProcessor.java

License:Open Source License

/**
 * Install a JavaScript library into a user-specified project.<br>
 * The configuration will grab the name and the location of the library from the given attributes. <br>
 * We expect an array of attributes with the same structure described at {@link #loadAttributes(Object)}.
 * /*from w w w  . ja v  a 2  s.  co m*/
 * @param attributes
 *            A non-empty string array, which contains the URLs for the JS library file(s) and an optional Map of
 *            additional attributes.
 * @see com.aptana.configurations.processor.AbstractConfigurationProcessor#configure(org.eclipse.core.runtime.IProgressMonitor,
 *      java.lang.Object)
 * @see #loadAttributes(Object)
 */
@Override
public ConfigurationStatus configure(IProgressMonitor progressMonitor, Object attributes) {
    // Get a Class lock to avoid multiple installations at the same time even with multiple instances of this
    // RubyInstallProcessor
    synchronized (this.getClass()) {
        if (installationInProgress) {
            return configurationStatus;
        }
        installationInProgress = true;
    }
    try {
        configurationStatus.removeAttribute(CONFIG_ATTR);
        clearErrorAttributes();

        // Load the installer's attributes
        IStatus loadingStatus = loadAttributes(attributes);
        if (!loadingStatus.isOK()) {
            String message = loadingStatus.getMessage();
            applyErrorAttributes(message);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(message));
            return configurationStatus;
        }

        // Check that we got the expected single install URL

        if (urls.length == 0) {
            // structure error
            String err = NLS.bind(Messages.InstallProcessor_wrongNumberOfInstallLinks,
                    new Object[] { JS_LIBRARY, 1, urls.length });
            applyErrorAttributes(err);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
            return configurationStatus;
        }
        // Try to get the library name from the optional attributes. If it's not there, we log a warning and use a
        // default one.
        libraryName = attributesMap.get(NAME_ATTRIBUTE);
        if (libraryName == null) {
            // just in case
            libraryName = JS_LIBRARY;
            IdeLog.logWarning(PortalUIPlugin.getDefault(),
                    "Expected a name attribute for the JS library, but got null."); //$NON-NLS-1$
        }
        // Start the installation...
        configurationStatus.setStatus(ConfigurationStatus.PROCESSING);
        IStatus status = download(urls, progressMonitor);
        if (status.isOK()) {
            status = install(progressMonitor);
        }
        switch (status.getSeverity()) {
        case IStatus.OK:
        case IStatus.INFO:
        case IStatus.WARNING:
            displayMessageInUIThread(MessageDialog.INFORMATION,
                    NLS.bind(Messages.InstallProcessor_installerTitle, libraryName),
                    NLS.bind(Messages.InstallProcessor_installationSuccessful, libraryName));
            configurationStatus.setStatus(ConfigurationStatus.OK);
            break;
        case IStatus.ERROR:
            configurationStatus.setStatus(ConfigurationStatus.ERROR);
            break;
        case IStatus.CANCEL:
            configurationStatus.setStatus(ConfigurationStatus.INCOMPLETE);
            break;
        default:
            configurationStatus.setStatus(ConfigurationStatus.UNKNOWN);
        }
        return configurationStatus;
    } finally {
        synchronized (this.getClass()) {
            installationInProgress = false;
        }
    }
}