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:org.vclipse.connection.dialogs.PreferencePage.java

License:Open Source License

/**
 *   Handles the connect operation//from w ww  .  j  ava 2 s  . co  m
 */
private void handleConnectButtonPushed() {
    final IConnection oldConnection = handler.getCurrentConnection();
    final IConnection connection = (IConnection) ((IStructuredSelection) tableViewer.getSelection())
            .getFirstElement();
    try {
        IStatus status = new ConnectionStateDialog(getShell(), handler).connect(connection);
        if (status != null && IStatus.ERROR == status.getSeverity()) {
            new MessageDialog(getShell(), "Connection state", null, status.getMessage(), MessageDialog.ERROR,
                    new String[] { "OK" }, 0).open();
        } else {
            new MessageDialog(getShell(), "Connection state", null,
                    "Connected to '" + connection.getSystemName() + "'", MessageDialog.INFORMATION,
                    new String[] { "OK" }, 0).open();
            tableViewer.refresh(connection, true);
            if (oldConnection != null) {
                tableViewer.refresh(oldConnection, true);
            }
            handler.storeConnectionData();
        }
        handleTableSelection();
    } catch (Throwable exception) {
        final String errorMessage = "Connection to '" + connection.getSystemName() + "' was not successful!\n"
                + "\n\nReason:\n\t" + exception.getMessage();
        new MessageDialog(getShell(), "Connection state", null, errorMessage, MessageDialog.ERROR,
                new String[] { "OK" }, 0).open();
    }
}

From source file:org.webcat.eclipse.projectlink.exporter.AmbiguousProjectToSubmitDialog.java

License:Open Source License

/**
 * Creates a new instance of the dialog. This method is protected because
 * pre-processing must occur before the superclass constructor can be
 * called. Use the static createWithProjects method to create a new dialog
 * instead./* w w w.  j  a  v a  2  s. com*/
 * 
 * @param parentShell the shell that owns this dialog
 * @param dialogMessage the message to display in the dialog
 * @param project1 a project
 * @param project2 a project
 */
protected AmbiguousProjectToSubmitDialog(Shell parentShell, String dialogMessage, IProject project1,
        IProject project2) {
    super(parentShell, Messages.AmbiguousProjectToSubmitDialog_Title, null, dialogMessage,
            MessageDialog.INFORMATION, new String[] { Messages.AmbiguousProjectToSubmitDialog_OK,
                    Messages.AmbiguousProjectToSubmitDialog_Cancel },
            0);

    this.project1 = project1;
    this.project2 = project2;
}

From source file:org.webcat.eclipse.submitter.ui.dialogs.AmbiguousProjectToSubmitDialog.java

License:Open Source License

/**
 * Creates a new instance of the dialog. This method is protected because
 * pre-processing must occur before the superclass constructor can be
 * called. Use the static createWithProjects method to create a new dialog
 * instead.//www  .java  2  s.c o m
 * 
 * @param parentShell the shell that owns this dialog
 * @param dialogMessage the message to display in the dialog
 * @param project1 a project
 * @param project2 a project
 */
protected AmbiguousProjectToSubmitDialog(Shell parentShell, String dialogMessage, IProject project1,
        IProject project2) {
    super(parentShell, Messages.AMBIGUOUSSELECTION_DIALOG_TITLE, null, dialogMessage, MessageDialog.INFORMATION,
            new String[] { Messages.AMBIGUOUSSELECTION_OK, Messages.AMBIGUOUSSELECTION_CANCEL }, 0);

    this.project1 = project1;
    this.project2 = project2;
}

From source file:org.wso2.developerstudio.datamapper.diagram.custom.util.SchemaKeyEditorDialog.java

License:Open Source License

private int displayUserMssg(String header, String message) {
    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), header, null, message,
            MessageDialog.INFORMATION, new String[] { "OK", "Cancel" }, 0);
    return dialog.open();
}

From source file:org.wso2.developerstudio.eclipse.updater.job.UpdateCheckerJob.java

License:Open Source License

@Override
protected IStatus run(IProgressMonitor monitor) {
    try {/*from  ww  w.  jav  a 2 s . c o  m*/
        if (!isJobRunning()) {
            setIsJobRunning(true);
            SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateCheckerJob_1, 2);
            try {
                updateManager.checkForAvailableUpdates(progress.newChild(1));
                updateManager.checkForAvailableFeatures(progress.newChild(1));
            } catch (Exception e) {
                setIsJobRunning(false);
                return Status.CANCEL_STATUS;
            }
            return Status.OK_STATUS;
        } else {
            Display.getDefault().syncExec(new Runnable() {
                @Override
                public void run() {
                    try {
                        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(),
                                "Updater Tool in Progress", null, "Updater tool is already in Progress",
                                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
                        dialog.open();
                    } catch (Exception e) {

                    }
                }
                // pop up user message saying an updater job is already
                // running
            });
        }
    } catch (Exception e) {
        log.error(Messages.UpdateCheckerJob_2, e);
    }
    return Status.CANCEL_STATUS;
}

From source file:org.wso2.developerstudio.eclipse.updater.job.UpdateMetaFileReaderJobListener.java

License:Open Source License

public static int getUserPreference(String title, String message) {
    // Display activeDisplay = Display.getDefault();
    String userChoice = prefPage.getString(PreferenceConstants.UPDATE_NOTIFICATION_CONFIGURATION);
    if (userChoice == null || userChoice.isEmpty()) {
        userChoice = PreferenceConstants.NOTIFY_ME;
    }//  w  ww .j a v a  2s . co  m
    if (userChoice.equals(PreferenceConstants.NOTIFY_ME)) {
        MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), title, null, message,
                MessageDialog.INFORMATION, new String[] { YES, SET_LATER }, 0);
        return dialog.open();
    }
    return USER_SCHEDULED_AUTOMATIC_INSTALL;// in case if user configured to
    // install updates automatically
    // with time preference
}

From source file:org.xmind.cathy.internal.BetaVerifier.java

License:Open Source License

private void promptBetaExpiry() {
    int selection = openMessageDialog(NLS.bind(
            WorkbenchMessages.BetaVerifier_BetaExpiredPromptDialog_message_withBrandingVersion_andBuildId,
            brandingVersion, buildId), MessageDialog.INFORMATION,
            new String[] { WorkbenchMessages.BetaVerifier_BetaExpiredPromptDialog_CheckAndInstallButton_text,
                    WorkbenchMessages.BetaVerifier_BetaExpiredPromptDialog_ExitButton_text });
    if (selection == 0) {
        openDownloadSite();//ww w. j  ava 2 s.c  o  m
    }
}

From source file:org2.eclipse.php.internal.debug.core.launching.PHPLaunchUtilities.java

License:Open Source License

/**
 * In case the preferences allow it, check to see if the current debugger uses a non-standard port for the session.
 * A message will be displayed asking to acknowledge this launch.
 * /*from  w  ww .j ava 2s  . c o  m*/
 * @param debuggerID
 *            The debugger ID to check
 * @return True in case the preferences are set to 'Never' test it, or when the user clicked continue when prompted.
 */
public static boolean checkIsStandardPort(String debuggerID) {
    // check whether we should ask the user.
    IPreferenceStore store = PHPDebugEPLPlugin.getDefault().getPreferenceStore();
    String option = store.getString(IPHPDebugCorePreferenceKeys.NOTIFY_NON_STANDARD_PORT);
    if (MessageDialogWithToggle.ALWAYS.equals(option)) {
        IStatus warningStatus = null;
        int debugPort = PHPDebugEPLPlugin.getDebugPort(debuggerID);
        if (XDebugCommunicationDaemon.XDEBUG_DEBUGGER_ID.equals(debuggerID)) {
            if (!XDebugCommunicationDaemon.isDefaultDebugPort(debugPort)) {
                warningStatus = new Status(IStatus.WARNING, PHPDebugEPLPlugin.PLUGIN_ID, 0,
                        NLS.bind(PHPDebugCoreMessages.PHPLaunchUtilities_xdebugNonStandardPort, debugPort),
                        null);
            }
        } else if (DebuggerCommunicationDaemon.ZEND_DEBUGGER_ID.equals(debuggerID)) {
            if (!DebuggerCommunicationDaemon.isDefaultDebugPort(debugPort)) {
                warningStatus = new Status(IStatus.WARNING, PHPDebugEPLPlugin.PLUGIN_ID, 0,
                        NLS.bind(PHPDebugCoreMessages.PHPLaunchUtilities_zendDebugNonStandardPort, debugPort),
                        null);
            }
        }
        if (warningStatus == null) {
            return true; // The port is set to default
        }
        IStatus preferencesMassage = new Status(IStatus.INFO, PHPDebugEPLPlugin.PLUGIN_ID, 0,
                PHPDebugCoreMessages.PHPLaunchUtilities_portSettingsPreferencesPage, null);
        final MultiStatus multiStatus = new MultiStatus(PHPDebugEPLPlugin.PLUGIN_ID, 0,
                new IStatus[] { warningStatus, preferencesMassage },
                PHPDebugCoreMessages.PHPLaunchUtilities_confirmation, null);
        final DialogResultHolder resultHolder = new DialogResultHolder();
        Display.getDefault().syncExec(new Runnable() {
            public void run() {
                DebugPortNotificationDialog notificationDialog = new DebugPortNotificationDialog(
                        Display.getDefault().getActiveShell(),
                        PHPDebugCoreMessages.PHPLaunchUtilities_confirmation, null,
                        PHPDebugCoreMessages.PHPLaunchUtilities_nonStandardPort, multiStatus,
                        MessageDialog.INFORMATION, PHPDebugCoreMessages.PHPLaunchUtilities_doNotShowThisAgain,
                        false);
                resultHolder.setReturnCode(notificationDialog.open());
            }
        });

        switch (resultHolder.getReturnCode()) {
        case IDialogConstants.PROCEED_ID:
            return true;
        case IDialogConstants.ABORT_ID:
        case IDialogConstants.CANCEL_ID:
        case -1:
            return false;
        }
    }
    return true;
}

From source file:phasereditor.ide.intro.PhaserIDE.java

License:Open Source License

/**
 * Return true if the argument directory is ok to use as a workspace and
 * false otherwise. A version check will be performed, and a confirmation
 * box may be displayed on the argument shell if an older version is
 * detected.//w  ww  . j ava 2  s .  c o m
 * 
 * @return true if the argument URL is ok to use as a workspace and false
 *         otherwise.
 */
private static boolean checkValidWorkspace(Shell shell, URL url) {
    // a null url is not a valid workspace
    if (url == null) {
        return false;
    }

    if (WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION == null) {
        // no reference bundle installed, no check possible
        return true;
    }

    Version version = readWorkspaceVersion(url);
    // if the version could not be read, then there is not any existing
    // workspace data to trample, e.g., perhaps its a new directory that
    // is just starting to be used as a workspace
    if (version == null) {
        return true;
    }

    final Version ide_version = toMajorMinorVersion(WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION);
    Version workspace_version = toMajorMinorVersion(version);
    int versionCompareResult = workspace_version.compareTo(ide_version);

    // equality test is required since any version difference (newer
    // or older) may result in data being trampled
    if (versionCompareResult == 0) {
        return true;
    }

    // At this point workspace has been detected to be from a version
    // other than the current ide version -- find out if the user wants
    // to use it anyhow.
    int severity;
    String title;
    String message;
    if (versionCompareResult < 0) {
        // Workspace < IDE. Update must be possible without issues,
        // so only inform user about it.
        severity = MessageDialog.INFORMATION;
        title = IDEWorkbenchMessages.IDEApplication_versionTitle_olderWorkspace;
        message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_olderWorkspace, url.getFile());
    } else {
        // Workspace > IDE. It must have been opened with a newer IDE
        // version.
        // Downgrade might be problematic, so warn user about it.
        severity = MessageDialog.WARNING;
        title = IDEWorkbenchMessages.IDEApplication_versionTitle_newerWorkspace;
        message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_newerWorkspace, url.getFile());
    }

    MessageDialog dialog = new MessageDialog(shell, title, null, message, severity,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    return dialog.open() == Window.OK;
}

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

License:Apache License

private static void openSaveSuccessDialog() {
    MessageDialog.open(MessageDialog.INFORMATION,
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Success", "Successfully saved.",
            SWT.NONE);//from w  w w.  j a v a 2s .c o  m
}