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:br.ufscar.dc.Dialogs.java

License:Open Source License

/**
 * Helper method to show a standard INFO MessageDialog
 * /*from   w w w  . ja v  a2s .  c o  m*/
 * @param message
 *            Message to display to user
 */
public static void infoDialogMessage(final String message) {
    runOnDisplayThread(new Runnable() {
        public void run() {
            MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Info", message);
        }
    });
}

From source file:brewery.ui.handlers.AboutHandler.java

License:Open Source License

@Execute
public void execute(final Shell shell) {
    MessageDialog.openInformation(shell, "About", "Eclipse 4 Application example.");
}

From source file:c8_selectionservice.parts.SamplePart.java

License:Open Source License

@Inject
public void itemSelected(Shell shell, @Optional @Named(IServiceConstants.ACTIVE_SELECTION) Person person) {
    if (person != null) {
        MessageDialog.openInformation(shell, "Item selected", "Name:" + person.getName());
    }/*ww w.j  a v  a  2s  .  c  o m*/
}

From source file:ca.mcgill.cs.swevo.ppa.ui.actions.PPAOnNameAction.java

License:Open Source License

public void run(IAction action) {
    if (javaEditor != null) {
        ICompilationUnit icu = (ICompilationUnit) SelectionConverter.getInput(javaEditor);
        IDocument document = JavaUI.getDocumentProvider().getDocument(javaEditor.getEditorInput());
        JavaTextSelection javaSelection = new JavaTextSelection(icu, document, selection.getOffset(),
                selection.getLength());/*w  w  w . j av  a 2s.  co  m*/
        ASTNode[] nodes = javaSelection.resolveSelectedNodes();

        if (nodes != null && nodes.length == 1) {
            ASTNode node = nodes[0];
            if (node instanceof Name) {

                // 1- Get the PPA CU:
                CompilationUnit cu = PPAUtil.getCU((IFile) icu.getResource(), new PPAOptions());
                if (cu == null) {
                    return;
                }
                PPANameVisitor nameVisitor = new PPANameVisitor();
                cu.accept(nameVisitor);

                // 2- Get the corresponding name in the PPA CU
                Name ppaNode = nameVisitor.getName((Name) node);
                if (ppaNode != null) {
                    String bindingText = PPABindingsUtil.getBindingText(ppaNode.resolveBinding());
                    MessageDialog.openInformation(javaEditor.getEditorSite().getShell(),
                            "Binding for " + ppaNode.getFullyQualifiedName(), bindingText);
                }

                // 3- Clean-up
                PPAUtil.cleanUp(cu);
            }
        }
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.ApplicationWorkbenchWindowAdvisor.java

License:Open Source License

@Override
public void postWindowCreate() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();

    pm.remove("net.sf.colorer.eclipse.PreferencePage"); //$NON-NLS-1$
    IPreferenceNode node = pm.remove("org.eclipse.ui.preferencePages.Workbench"); //$NON-NLS-1$
    for (IPreferenceNode sub : node.getSubNodes()) {
        if (sub.getId().equals("org.eclipse.ui.preferencePages.Keys")) //$NON-NLS-1$
        {/*www.  j  a  va 2s . c  o  m*/
            pm.addToRoot(sub);
        }
    }

    String upgradeMessage = QualyzerActivator.getDefault().getUpgradeMessage();
    if (upgradeMessage != null) {
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        boolean error = QualyzerActivator.getDefault().isUpgradeMessageError();
        if (error) {
            MessageDialog.openError(shell, Messages.getString("QualyzerActivator.upgradedTitle"), //$NON-NLS-1$
                    upgradeMessage); //$NON-NLS-1$
        } else {
            MessageDialog.openInformation(shell, Messages.getString("QualyzerActivator.upgradedTitle"), //$NON-NLS-1$
                    upgradeMessage);
        }
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.handlers.AboutQualyzerHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = HandlerUtil.getActiveShell(event).getShell();

    MessageDialog.openInformation(shell, Messages.getString("handlers.AboutQualyzerHandler.about"), //$NON-NLS-1$
            RELEASE + MCGILL + DESCRIPTION + WEB + COPYRIGHT);
    return null;/*from   www.j a  v  a 2 s  .  c o  m*/
}

From source file:ca.mcgill.cs.swevo.qualyzer.handlers.ExportCodesFragmentsHandler.java

License:Open Source License

private void exportCodes(String fileName, Project project, Shell shell) {
    Facade facade = Facade.getInstance();
    PrintWriter printer = null;/*from w w  w . j a  v a2 s.c o m*/

    try {
        printer = new PrintWriter(new File(fileName));
        printDocuments(project.getTranscripts(), Messages.getString("handlers.ExportCodesHandler.transcript"),
                facade, printer);
        printDocuments(project.getMemos(), Messages.getString("handlers.ExportCodesHandler.memo"), facade,
                printer);

        MessageDialog.openInformation(shell, Messages.getString("handlers.ExportCodesHandler.exportSucessful"), //$NON-NLS-1$
                Messages.getString("handlers.ExportCodesHandler.exportMessage") + fileName);
    }
    // CSOFF:
    catch (Exception e) {
        fLogger.error("Error while exporting code fragments.", e);
        throw new QualyzerException(Messages.getString("handlers.ExportCodesHandler.writeFailed")); //$NON-NLS-1$
    }
    // CSON:
    finally {
        quietClose(printer);
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.handlers.ExportCodesHandler.java

License:Open Source License

/**
 * @param shell/* ww w  . ja  v a2 s .  com*/
 * @param fileName
 * @param buffer
 */
private void writeFile(Shell shell, String fileName, StringBuilder buffer) {
    File file = new File(fileName);
    FileWriter writer = null;
    try {
        writer = new FileWriter(file);
        writer.write(buffer.toString());
        MessageDialog.openInformation(shell, Messages.getString("handlers.ExportCodesHandler.exportSucessful"), //$NON-NLS-1$
                Messages.getString("handlers.ExportCodesHandler.exportMessage") + fileName);
    } catch (IOException e) {
        throw new QualyzerException(Messages.getString("handlers.ExportCodesHandler.writeFailed")); //$NON-NLS-1$
    } finally {
        try {
            if (writer != null) {
                writer.close();
            }
        } catch (IOException e) {
            throw new QualyzerException(Messages.getString("handlers.ExportCodesHandler.closeFailed")); //$NON-NLS-1$
        }
    }
}

From source file:ca.uvic.cs.tagsea.wizards.XMLTagSendWizardPage.java

License:Open Source License

boolean send() {
    int id = TagSEAPlugin.getDefault().getUserID();
    if (id < 0) {
        boolean result = MessageDialog.openQuestion(getShell(), "Cannot Send",
                "You must register TagSEA before you can upload your tags. Would you like to register now?");
        if (result) {
            id = TagSEAPlugin.getDefault().askForUserID();
        }//from w w  w. j  a  va2 s. co  m
    }
    if (id < 0) {
        MessageDialog.openError(getShell(), "Operation Incomplete", "Error getting ID.");
        return false;
    }
    final int fid = TagSEAPlugin.getDefault().askForUserID();
    try {
        getContainer().run(false, false, new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                TagNetworkSender.send(textData, monitor, fid);
            }
        });
    } catch (InvocationTargetException ex) {
        MessageDialog.openError(getShell(), "Error", ex.getLocalizedMessage());
        TagSEAPlugin.log(ex.getLocalizedMessage(), ex);
        return false;
    } catch (InterruptedException e) {
    }
    MessageDialog.openInformation(getShell(), "Complete", "Upload Complete");
    return true;
}

From source file:ca.uwaterloo.gp.fmp.presentation.FeatureComparisonView.java

License:Open Source License

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