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

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

Introduction

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

Prototype

public static void openInformation(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard information dialog.

Usage

From source file:bixie.plugin.util.UI.java

License:Open Source License

/**
 * Prints an info message/*from ww  w.j  a v  a2 s. co m*/
 * 
 * @param text
 *            Text to be printed
 */
public static void printInfo(String text) {
    final String printText = text;
    Display.getDefault().syncExec(new Runnable() {
        @Override
        public void run() {
            MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", printText);
        }
    });
}

From source file:bndtools.Plugin.java

License:Open Source License

public static void message(final String msg) {
    async(new Runnable() {
        @Override/*from www . j av  a 2  s .c o  m*/
        public void run() {
            MessageDialog.openInformation(null, "Bnd", msg);
        }
    });
}

From source file:bndtools.release.Activator.java

License:Open Source License

public static void message(final String msg) {
    async(new Runnable() {
        @Override/*from   w w w . j a  va2s.co  m*/
        public void run() {
            MessageDialog.openInformation(null, Messages.releaseDialogTitle1, msg);
        }
    });
}

From source file:bndtools.release.WorkspaceAnalyserJob.java

License:Open Source License

@Override
protected IStatus run(IProgressMonitor monitor) {
    IProgressMonitor mon = monitor;//from   www.  j a v  a2  s  . c o m
    if (mon == null) {
        mon = new NullProgressMonitor();
    }

    try {
        Collection<Project> projects = Activator.getWorkspace().getAllProjects();

        mon.beginTask(Messages.workspaceReleaseJob, projects.size() * 2);

        List<Project> orderedProjects = getBuildOrder(mon, Activator.getWorkspace());
        if (mon.isCanceled()) {
            return Status.CANCEL_STATUS;
        }

        final List<ProjectDiff> projectDiffs = new ArrayList<ProjectDiff>();
        mon.setTaskName(Messages.processingProjects);
        for (Project project : orderedProjects) {
            IProject eProject = ReleaseUtils.getProject(project);
            if (!isIncluded(eProject)) {
                mon.worked(1);
                continue;
            }
            if ("".equals(project.getProperty(Constants.RELEASEREPO, null))) {
                mon.worked(1);
                continue;
            }
            if (eProject == null || !eProject.isOpen() || !eProject.isAccessible()) {
                mon.worked(1);
                continue;
            }
            List<Baseline> jarDiffs = null;
            try (ProjectBuilder pb = project.getBuilder(null)) {
                for (Builder b : pb.getSubBuilders()) {
                    mon.subTask(String.format(Messages.processingProject, b.getBsn()));

                    Baseline jarDiff = DiffHelper.createBaseline(b);
                    if (jarDiff != null) {
                        if (jarDiffs == null) {
                            jarDiffs = new ArrayList<Baseline>();
                        }
                        jarDiffs.add(jarDiff);
                    }
                }
            }
            if (jarDiffs != null && jarDiffs.size() > 0) {
                projectDiffs.add(new ProjectDiff(project, jarDiffs));
            }
            if (mon.isCanceled()) {
                return Status.CANCEL_STATUS;
            }
            mon.worked(1);
        }

        if (projectDiffs.size() == 0) {
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    MessageDialog.openInformation(shell, Messages.releaseWorkspaceBundles,
                            Messages.noBundlesRequireRelease);
                }
            };
            if (Display.getCurrent() == null) {
                Display.getDefault().syncExec(runnable);
            } else {
                runnable.run();
            }
            return Status.OK_STATUS;
        }

        ReleaseHelper.initializeProjectDiffs(projectDiffs);

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                WorkspaceReleaseDialog dialog = new WorkspaceReleaseDialog(shell, projectDiffs, false);
                int ret = dialog.open();
                if (ret == Window.OK) {
                    boolean runJob = false;
                    for (ProjectDiff diff : projectDiffs) {
                        if (diff.isRelease()) {
                            runJob = true;
                            break;
                        }
                    }
                    if (!runJob) {
                        return;
                    }
                    WorkspaceReleaseJob releaseJob = new WorkspaceReleaseJob(projectDiffs,
                            dialog.getReleaseOption(), dialog.isShowMessage());
                    releaseJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
                    releaseJob.schedule();
                }
            }
        };

        if (Display.getCurrent() == null) {
            Display.getDefault().asyncExec(runnable);
        } else {
            runnable.run();
        }

    } catch (Exception e) {
        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
    }
    return Status.OK_STATUS;
}

From source file:bndtools.utils.MessageHyperlinkAdapter.java

License:Open Source License

private void showPopup(final HyperlinkEvent e) {
    Hyperlink link = (Hyperlink) e.getSource();
    link.setToolTipText(null);//from ww  w.  j  ava  2 s. c om

    if (popupDialog != null)
        popupDialog.close();

    IMessage[] messages = (IMessage[]) e.data;

    if (messages == null) {
        messages = new IMessage[0];
    } else {
        messages = Stream.of(messages).filter(Objects::nonNull).toArray(IMessage[]::new);
    }

    if (messages.length == 0) {
        MessageDialog.openInformation(part.getSite().getShell(), part.getTitle(),
                "No further information available.");
    } else {
        popupDialog = new MessagesPopupDialog(link, (IMessage[]) e.data, part);
        popupDialog.open();
    }
}

From source file:br.com.mamom.handlers.AboutHandler.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    MessageDialog.openInformation(shell, "About", "Mamom");
}

From source file:br.gov.frameworkdemoiselle.tools.nimble.eclipse.actions.NimbleAction.java

License:Open Source License

public void run(IAction action) {
    NimbleConfiguration config = EclipseUtil.createNimbleConfiguration(selectedProject);
    try {// w ww  . jav a 2  s .c om
        new NimbleRunner().run(config);
    } catch (CoreException e) {
        MessageDialog.openInformation(window.getShell(), "Demoiselle-nimble-eclipse",
                "Nimble Action had problems.");
    }
}

From source file:br.gov.frameworkdemoiselle.tools.nimble.eclipse.popup.actions.NimbelAction.java

License:Open Source License

/**
 * @see IActionDelegate#run(IAction)/*w w w .j a v a 2 s. com*/
 */
public void run(IAction action) {
    MessageDialog.openInformation(shell, "Demoiselle-nimble-eclipse", "Nimble Action was executed.");
}

From source file:br.gov.frameworkdemoiselle.tools.nimble.eclipse.views.NimbleView.java

License:Open Source License

private void showMessage(String message) {
    MessageDialog.openInformation(viewer.getControl().getShell(), "Nimbel View", message);
}

From source file:br.gov.frameworkdemoiselle.tools.nimble.eclipse.wizards.NimbleNewWizard.java

License:Open Source License

/**
 * We will accept the selection in the workbench to see if
 * we can initialize from it./*from  w w w  .java2s.  co  m*/
 * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
 */
public void init(IWorkbench workbench, IStructuredSelection selection) {
    NimbleConfiguration config = EclipseUtil.createNimbleConfiguration(null);
    try {
        new NimbleRunner().run(config);
    } catch (CoreException e) {
        MessageDialog.openInformation(window.getShell(), "Demoiselle-nimble-eclipse",
                "Nimble Action had problems.");
    }

}