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:AboutHandler.java

License:Open Source License

 @Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
   MessageDialog.openInformation(shell, "About", "e4 Application example.");
}

From source file:$group_id$.core.handlers.AboutHandler.java

License:Open Source License

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

From source file:$packageName$.$className$.java

License:Open Source License

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

From source file:$packageName$.$contributorClassName$.java

License:Open Source License

private void createActions() {
    // TODO Create any actions
    sampleAction = new Action() {
        public void run() {
            MessageDialog.openInformation(null, "TestWaveform", "Sample Action Executed");
        }//from ww w. ja  v  a2 s  .  c  om
    };
    sampleAction.setText("Sample Action");
    sampleAction.setToolTipText("Sample Action tool tip");
    sampleAction.setImageDescriptor(
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ELEMENT));
}

From source file:ac.soton.eventb.emf.diagrams.generator.actions.ValidateAction.java

License:Open Source License

/**
 * /*from ww w  .j  ava 2  s.  c om*/
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
    if (editor instanceof DiagramDocumentEditor) {
        if (validate((DiagramDocumentEditor) editor)) {
            MessageDialog.openInformation(editor.getSite().getShell(), "Validation Information",
                    "Validation completed successfully with no errors found");
            ;
        }
    }
    return null;
}

From source file:ac.soton.eventb.statemachines.diagram.part.ValidateDiagramAction.java

License:Open Source License

/**
 * @generated NOT// w  w w  . jav a  2 s.co  m
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
    if (editor instanceof IDiagramWorkbenchPart) {
        IDiagramWorkbenchPart diagramEditor = (IDiagramWorkbenchPart) editor;

        // run validation
        ValidateAction action = new ValidateAction(editor.getSite().getPage());
        action.run();

        // show feedback
        try {
            IFile file = WorkspaceSynchronizer.getFile(diagramEditor.getDiagram().eResource());
            String errors = ValidateAction.getValidationErrors(file);
            if (errors.isEmpty())
                MessageDialog.openInformation(editor.getSite().getShell(), "Validation Information",
                        "Validation completed successfully");
            else
                MessageDialog.openError(editor.getSite().getShell(), "Validation Information",
                        "Validation has found problems in your model:\n" + errors);
        } catch (CoreException e) {
            throw new ExecutionException("Validation result retrieval failed", e);
        }
    }

    return null;
}

From source file:ac.soton.multisim.ui.commands.SimulateCommandHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    if (validate(editor) == false)
        return null;

    final ComponentDiagram diagram = (ComponentDiagram) ((DiagramEditor) editor).getDiagram().getElement();

    // input dialog for entering simulation parameters
    SimulationSettingsDialog simulationInputDialog = new SimulationSettingsDialog(
            Display.getCurrent().getActiveShell(), diagram);
    if (simulationInputDialog.open() != InputDialog.OK)
        return null;

    // get output path
    IResource res = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    final String outputPath = res.getLocation().removeLastSegments(1).append("results.csv").toOSString();

    // source provider service
    ISourceProviderService sourceProviderService = (ISourceProviderService) HandlerUtil
            .getActiveWorkbenchWindow(event).getService(ISourceProviderService.class);
    final SimulationStateSourceProvider simulationStateService = (SimulationStateSourceProvider) sourceProviderService
            .getSourceProvider(SimulationStateSourceProvider.STATE_SIMULATING);

    // simulation job
    final Job job = new Job(JOB_NAME) {
        @Override/*from  w w w . j  a v  a 2s  .c om*/
        protected IStatus run(IProgressMonitor monitor) {
            return TwoListMaster.simulate(diagram, monitor, new File(outputPath));
        }

        @Override
        public boolean belongsTo(Object family) {
            return JOB_NAME.equals(getName());
        }
    };
    job.setUser(true); // user UI job
    job.setPriority(Job.LONG); // long-running job scheduling (lower priority than interactive and short, but higher than build)
    job.setProperty(IProgressConstants.KEEPONE_PROPERTY, true); // keep only one job in progress monitor
    job.setProperty(IProgressConstants.ICON_PROPERTY, MultisimUIActivator.getDefault().getImageRegistry()
            .getDescriptor(MultisimUIActivator.IMAGE_MULTISIM)); // job icon
    job.addJobChangeListener(new JobChangeAdapter() {
        @Override
        public void done(IJobChangeEvent event) {
            Display.getDefault().syncExec(new Runnable() {
                @Override
                public void run() {
                    // update UI state on finish
                    simulationStateService.setSimulating(false);
                }
            });
        }
    });
    job.setProperty(IProgressConstants.ACTION_PROPERTY, new Action() {
        Job jb = job;

        @Override
        public void run() {
            Display.getDefault().asyncExec(new Runnable() {
                @Override
                public void run() {
                    // results dialog on finish
                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Simulation Results",
                            jb.getResult().getMessage());
                }
            });
        }
    });
    job.schedule();

    // update UI state to simulating
    simulationStateService.setSimulating(true);

    return null;
}

From source file:ac.soton.multisim.ui.commands.ValidateCommandHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart diagramEditor = HandlerUtil.getActiveEditorChecked(event);

    // reuse GMF-generated validate action from the diagram
    Action validateAction = new ValidateAction(diagramEditor.getSite().getPage());
    validateAction.run();/*  w  w w  .  j  a  va  2 s .c om*/

    // show validation results
    IFile file = WorkspaceSynchronizer
            .getFile(((IDiagramWorkbenchPart) diagramEditor).getDiagram().eResource());
    List<IMarker> markers = null;
    try {
        markers = ValidateAction.getErrorMarkers(file);
    } catch (CoreException e) {
        throw new ExecutionException("Validation result retrieval failed", e);
    }
    if (markers.isEmpty()) {
        MessageDialog.openInformation(diagramEditor.getSite().getShell(), "Validation Information",
                "Validation completed successfully");
    } else {
        final String PID = MultisimDiagramEditorPlugin.ID;
        MultiStatus errors = new MultiStatus(PID, 1, "Diagram constraints violated", null);
        for (IMarker marker : markers) {
            errors.add(
                    SimulationStatus.createErrorStatus(marker.getAttribute(IMarker.MESSAGE, "unknown error")));
        }
        ErrorDialog.openError(diagramEditor.getSite().getShell(), "Validation Problems",
                "Problems found during validation", errors);
    }

    return null;
}

From source file:ac.soton.rms.ui.commands.SimulateCommand.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    final boolean recordTrace = Boolean.valueOf(event.getParameter(PARAM_RECORD_TRACE));
    final boolean compareTrace = Boolean.valueOf(event.getParameter(PARAM_COMPARE_TRACE));
    final boolean checkInvariants = Boolean.valueOf(event.getParameter(PARAM_CHECK_INVARIANTS));

    // source provider service
    ISourceProviderService sourceProviderService = (ISourceProviderService) HandlerUtil
            .getActiveWorkbenchWindow(event).getService(ISourceProviderService.class);
    final SimulationState simulationStateService = (SimulationState) sourceProviderService
            .getSourceProvider(SimulationState.SIM_ACTIVE);

    if (editor != null) {
        final ComponentDiagram diagram = (ComponentDiagram) ((DiagramEditor) editor).getDiagram().getElement();
        Job job = new Job("RMS Simulation") {
            @Override/*from w ww .  j a  v a  2s. c om*/
            protected IStatus run(IProgressMonitor monitor) {
                return Master.simulate(diagram, monitor, recordTrace, compareTrace, checkInvariants);
            }
        };
        job.setUser(true);
        job.setPriority(Job.LONG);
        job.addJobChangeListener(new JobChangeAdapter() {
            @Override
            public void done(IJobChangeEvent event) {
                Display.getDefault().syncExec(new Runnable() {
                    @Override
                    public void run() {
                        simulationStateService.setActive(false);
                    }
                });
            }
        });
        job.setProperty(IProgressConstants.ACTION_PROPERTY, new Action() {
            @Override
            public void run() {
                Display.getDefault().asyncExec(new Runnable() {
                    @Override
                    public void run() {
                        MessageDialog.openInformation(Display.getDefault().getActiveShell(),
                                "Simulation Results", Master.getResultsMessage());
                    }
                });
            }
        });
        job.setProperty(IProgressConstants.KEEPONE_PROPERTY, true);
        job.setProperty(IProgressConstants.ICON_PROPERTY,
                RmsUIActivator.getDefault().getImageRegistry().getDescriptor(RmsUIActivator.IMAGE_RMS));
        job.schedule();

        simulationStateService.setActive(true);
    }
    return null;
}

From source file:actions.FileScanningAction.java

License:Open Source License

@Override
public void run() {

    try {/*from   www . j a  v a 2  s  . c  o m*/
        mainTable.setRedrawEnabled(false);
        // disable action
        DirectoryDialog dialog = new DirectoryDialog(shell);
        dialog.setText("Select a Directory");
        dialog.setMessage(
                "Select a directory of music files. Music files found in that directory will be added to your music library.");
        final String path = dialog.open();

        new ProgressMonitorDialog(shell).run(true, true, new ScanProgressMonitor(path));
    } catch (InvocationTargetException e) {
        MessageDialog.openError(shell, "Error", e.getMessage());
    } catch (InterruptedException e) {
        MessageDialog.openInformation(shell, "Cancelled", e.getMessage());
    } finally {
        mainTable.setRedrawEnabled(true);
    }
}