Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog run

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog run

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressMonitorDialog run.

Prototype

@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException 

Source Link

Document

This implementation of IRunnableContext#run(boolean, boolean, IRunnableWithProgress) runs the given IRunnableWithProgress using the progress monitor for this progress dialog and blocks until the runnable has been run, regardless of the value of fork.

Usage

From source file:SaveHandler.java

License:Open Source License

    @Execute
   public void execute(
         IEclipseContext context,/*from  w w  w .ja v  a 2 s  .c o m*/
         @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
         @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
         throws InvocationTargetException, InterruptedException {
      final IEclipseContext pmContext = context.createChild();

      ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
      dialog.open();
      dialog.run(true, true, new IRunnableWithProgress() {
         public void run(IProgressMonitor monitor)
               throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
               Object clientObject = contribution.getObject();
//               ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
//                     pmContext, null);
            }
         }
      });

      if (pmContext instanceof IDisposable) {
         ((IDisposable) pmContext).dispose();
      }
   }

From source file:BMVirtualFindAction.java

License:Open Source License

public void run() {
    final VirtualViewerListener listener = new VirtualViewerListener();
    VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);

    ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(),
            500);/*from  w w w  .  j  av a2  s . c o m*/
    final IProgressMonitor monitor = dialog.getProgressMonitor();
    dialog.setCancelable(true);

    try {
        dialog.run(true, true, new IRunnableWithProgress() {
            public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
                synchronized (listener) {
                    listener.fProgressMonitor = m;
                    listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()),
                            listener.fRemainingUpdatesCount);
                }

                while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete)
                        && !listener.fProgressMonitor.isCanceled()) {
                    Thread.sleep(1);
                }
                synchronized (listener) {
                    listener.fProgressMonitor = null;
                }
            }
        });
    } catch (InvocationTargetException e) {
        DebugUIPlugin.log(e);
        return;
    } catch (InterruptedException e) {
        return;
    }

    VirtualItem root = virtualViewer.getTree();
    if (!monitor.isCanceled()) {
        List<VirtualItem> list = new ArrayList<VirtualItem>();
        collectAllChildren(root, list);
        FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
        VirtualItem result = performFind(list, labelProvider);
        if (result != null) {
            setSelectionToClient(virtualViewer, labelProvider, result);
        }
    }

    virtualViewer.removeLabelUpdateListener(listener);
    virtualViewer.removeViewerUpdateListener(listener);
    virtualViewer.dispose();
}

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

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();//  w w  w.  j  a va  2  s . c  om
    dialog.run(true, true, new IRunnableWithProgress() {
        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                //               Object clientObject = contribution.getObject();
                //               ContextInjectionFactory.invoke(clientObject, Persist.class, //\$NON-NLS-1\$
                //                     pmContext, null);
            }
        }
    });

    pmContext.dispose();
}

From source file:ac.soton.eventb.atomicitydecomposition.generator.actions.GenerateAction.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
    if (editor instanceof RoseEditor) {
        final RoseEditor roseEditor = (RoseEditor) editor;
        IStructuredSelection selection = (IStructuredSelection) roseEditor.getSelection();
        if (selection.getFirstElement() instanceof EventBElement) {
            final EventBElement eventBElement = (EventBElement) selection.getFirstElement();

            ResourceSet resourceSet = eventBElement.eResource().getResourceSet();

            if (editor.isDirty())
                editor.doSave(new NullProgressMonitor());

            // first validate, then transform
            //   if (ValidateAction.validate(diagramDocumentEditor)){

            for (AbstractExtension abs : eventBElement.getExtensions()) {
                TransactionalEditingDomain editingDomain = TransactionalEditingDomain.Factory.INSTANCE
                        .createEditingDomain();

                AbstractExtension absExt;
                if (abs.eIsProxy()) {
                    absExt = (AbstractExtension) resourceSet.getEObject(EcoreUtil.getURI(abs), false);
                } else
                    absExt = abs;//from  w w w . j  a v  a2s.  c  o  m

                if (absExt instanceof FlowDiagram) {
                    //If there is no extension, set as being the name
                    if (absExt.getExtensionId() == null || absExt.getExtensionId().equals("")) {
                        absExt.setExtensionId(((FlowDiagram) absExt).getName());
                    }

                    final GenerateCommand generateCommand = new GenerateCommand(editingDomain, absExt);
                    if (generateCommand.canExecute()) {
                        // run with progress
                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                                roseEditor.getSite().getShell());
                        try {
                            dialog.run(true, true, new IRunnableWithProgress() {
                                public void run(IProgressMonitor monitor) {
                                    monitor.beginTask(Messages.GENERATOR_MSG_05, IProgressMonitor.UNKNOWN);
                                    try {
                                        generateCommand.execute(monitor, roseEditor);
                                    } catch (ExecutionException e) {
                                        Activator.logError(Messages.GENERATOR_MSG_06, e);
                                    }
                                    monitor.done();
                                }
                            });
                        } catch (InvocationTargetException e) {
                            Activator.logError(Messages.GENERATOR_MSG_07, e);
                            return null;
                        } catch (InterruptedException e) {
                            Activator.logError(Messages.GENERATOR_MSG_08, e);
                            return null;
                        }
                        // error feedback
                        if (false == generateCommand.getCommandResult().getStatus().isOK())
                            MessageDialog.openError(editor.getSite().getShell(), Messages.GENERATOR_MSG_09,
                                    Messages.GENERATOR_MSG_10);
                    }
                }
            }
        }
    }
    return null;
}

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

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
    if (editor instanceof DiagramDocumentEditor) {
        final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor) editor;

        if (diagramDocumentEditor.getDiagram().getElement() instanceof EventBElement) {
            final EventBElement eventBElement = (EventBElement) diagramDocumentEditor.getDiagram().getElement();

            // save before transformation
            if (editor.isDirty())
                editor.doSave(new NullProgressMonitor());

            // first validate, then transform
            if (ValidateAction.validate(diagramDocumentEditor)) {

                final GenerateCommand generateCommand = new GenerateCommand(
                        diagramDocumentEditor.getDiagramEditPart().getEditingDomain(), eventBElement);
                if (generateCommand.canExecute()) {
                    // run with progress
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                            diagramDocumentEditor.getSite().getShell());
                    try {
                        dialog.run(true, true, new IRunnableWithProgress() {
                            public void run(IProgressMonitor monitor) {
                                monitor.beginTask(Messages.GENERATOR_MSG_05, IProgressMonitor.UNKNOWN);
                                try {
                                    generateCommand.execute(monitor, diagramDocumentEditor);
                                } catch (ExecutionException e) {
                                    Activator.logError(Messages.GENERATOR_MSG_06, e);
                                }/*  ww w.  j a v  a 2  s  .  c o  m*/
                                monitor.done();
                            }
                        });
                    } catch (InvocationTargetException e) {
                        Activator.logError(Messages.GENERATOR_MSG_07, e);
                        return null;
                    } catch (InterruptedException e) {
                        Activator.logError(Messages.GENERATOR_MSG_08, e);
                        return null;
                    }

                    // error feedback
                    if (false == generateCommand.getCommandResult().getStatus().isOK())
                        MessageDialog.openError(editor.getSite().getShell(), Messages.GENERATOR_MSG_09,
                                Messages.GENERATOR_MSG_10);
                }
            }
        }
    }
    return null;
}

From source file:ac.soton.eventb.statemachines.transformation.TranslateAction.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
    if (editor instanceof DiagramDocumentEditor) {
        final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor) editor;

        if (diagramDocumentEditor.getDiagram().getElement() instanceof Statemachine) {
            final Statemachine statemachine = (Statemachine) diagramDocumentEditor.getDiagram().getElement();

            // save before transformation
            if (editor.isDirty())
                editor.doSave(new NullProgressMonitor());

            // first validate, then transform
            if (ValidateAction.validate(diagramDocumentEditor)) {

                final StatemachineTransformationCommand generateCommand = new StatemachineTransformationCommand(
                        diagramDocumentEditor.getDiagramEditPart().getEditingDomain(), statemachine);

                if (generateCommand.canExecute()) {
                    // run with progress
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                            diagramDocumentEditor.getSite().getShell());
                    try {
                        dialog.run(true, true, new IRunnableWithProgress() {
                            public void run(IProgressMonitor monitor) {
                                monitor.beginTask("Translating to Event-B ...", IProgressMonitor.UNKNOWN);
                                try {
                                    generateCommand.execute(monitor, diagramDocumentEditor);
                                } catch (ExecutionException e) {
                                    Activator.logError("Statemachine transformation failed", e);
                                }/*from  w ww .j a  v  a2  s.c  o m*/
                                monitor.done();
                            }
                        });
                    } catch (InvocationTargetException e) {
                        TransformationPlugin.getDefault().logError("Transformation failed", e);
                        return null;
                    } catch (InterruptedException e) {
                        TransformationPlugin.getDefault().logError("Transformation interrupted", e);
                        return null;
                    }

                    // error feedback
                    if (false == generateCommand.getCommandResult().getStatus().isOK())
                        MessageDialog.openError(editor.getSite().getShell(), "Translation Information",
                                "Translation encountered problems.\n\nSee log for details.");
                }
            }
        }
    }
    return null;
}

From source file:actions.FileScanningAction.java

License:Open Source License

public void scanFiles(String[] files) {
    try {/*from w w w.j  a  v a2 s.  c  o  m*/
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
        dialog.run(true, true, new ScanProgressMonitor(files));
    } catch (InvocationTargetException e) {
        MessageDialog.openError(shell, "Error", e.getMessage());
    } catch (InterruptedException e) {
        MessageDialog.openInformation(shell, "Cancelled", e.getMessage());
    }
}

From source file:ag.ion.noa4e.ui.NOAUIPlugin.java

License:Open Source License

/**
 * Internal method in order to start the office application.
 * // w  w  w .  ja  v a 2 s. com
 * @param shell shell to be used
 * @param officeApplication office application to be used
 * 
 * @return status information
 * 
 * @author Joerg Sigle
 * @date 24.06.2012
 * @date 20.02.2012 00:57
 *
 * @author Andreas Brker
 * @date 28.06.2006
 * 
 * Adopted for Elexis by Joerg Sigle 02/2012, adding the following line.
 * Changes required because of different preference store layout in Elexis.
 * There are corresponding changes in:
 * LocalOfficeApplicationsPreferencesPage.java
 *   PREFS_PREVENT_TERMINATION
 *   initPreferenceValues()
 *   performOk()
 * NOAUIPlugin.java                     
 *   PREFERENCE_OFFICE_HOME
 *   PREFERENCE_PREVENT_TERMINATION            
 *   internalStartApplication().
 */
private static IStatus internalStartApplication(final Shell shell, IOfficeApplication officeApplication) {

    System.out.println("NOAUIPlugin: internalStartApplication() begin");

    if (officeApplication.isActive()) {
        System.out.println(
                "NOAUIPlugin: internalStartApplication(): officeApplication.isActive(), so returning immediately.");
        return Status.OK_STATUS;
    }

    System.out.println(
            "NOAUIPlugin: internalStartApplication(): !officeApplication.isActive(), so starting it up...");

    boolean configurationChanged = false;
    boolean canStart = false;
    String home = null;

    HashMap configuration = new HashMap(1);

    //My warning in the following line referred to the original noa4e code:
    //System.out.println("NOAUIPlugin: internalStartApplication(): getting officeHome (WARNING: probably from the wrong source)...");
    System.out.println("NOAUIPlugin: internalStartApplication(): getting officeHome...");
    System.out.println(
            "NOAUIPlugin: internalStartApplication(): Using js mod adopted for Elexis, reproducing prior GW adoptions, P_OOBASEDIR via ...(Hub.localCfg)");

    //JS modified this:
    //The original code tries to access a preference store which is not used in Elexis,
    //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java
    //Unsuitable original line, removed:
    //String officeHome = getDefault().getPreferenceStore().getString(PREFERENCE_OFFICE_HOME);
    //Newly inserted lines:
    IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg);
    String officeHome = preferenceStore.getString(PreferenceConstants.P_OOBASEDIR);

    if (officeHome == null)
        System.out.println("NOAUIPlugin: internalStartApplication(): WARNING: officeHome==null");
    else
        System.out.println("NOAUIPlugin: internalStartApplication(): officeHome=" + officeHome);

    if (officeHome.length() != 0) {
        File file = new File(officeHome);
        if (file.canRead()) {

            System.out.println(
                    "NOAUIPlugin: internalStartApplication(): Check: officeHome is a valid path. Setting canStart to true.");

            configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, officeHome);
            canStart = true;
        } else {
            System.out.println(
                    "NOAUIPlugin: internalStartApplication(): WARNING: officeHome is NOT a valid path. Leaving canStart at false.");

            MessageDialog.openWarning(shell, Messages.NOAUIPlugin_dialog_warning_invalid_path_title,
                    Messages.NOAUIPlugin_dialog_warning_invalid_path_message);
        }
    }

    System.out.println("NOAUIPlugin: internalStartApplication(): canStart=" + canStart);

    if (!canStart) {
        System.out.println(
                "NOAUIPlugin: internalStartApplication(): canStart==false; trying to auto locate available office suite installations...");

        configurationChanged = true;
        ILazyApplicationInfo[] applicationInfos = null;
        boolean configurationCompleted = false;
        try {
            ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell);
            FindApplicationInfosOperation findApplicationInfosOperation = new FindApplicationInfosOperation();
            progressMonitorDialog.run(true, true, findApplicationInfosOperation);
            applicationInfos = findApplicationInfosOperation.getApplicationsInfos();
            if (applicationInfos.length == 1) {
                if (applicationInfos[0].getMajorVersion() == 2 || (applicationInfos[0].getMajorVersion() == 1
                        && applicationInfos[0].getMinorVersion() == 9)) {
                    configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, applicationInfos[0].getHome());
                    configurationCompleted = true;
                }
            }
        } catch (Throwable throwable) {
            System.out.println(
                    "NOAUIPlugin: internalStartApplication(): canStart==false; cannot auto locate an office suite installation. So we must search manually...");
            //we must search manually
        }

        System.out.println(
                "NOAUIPlugin: internalStartApplication(): configurationCompleted=" + configurationCompleted);

        if (!configurationCompleted) {
            LocalApplicationWizard localApplicationWizard = new LocalApplicationWizard(applicationInfos);
            if (home != null && home.length() != 0)
                localApplicationWizard.setHomePath(home);
            WizardDialog wizardDialog = new WizardDialog(shell, localApplicationWizard);
            if (wizardDialog.open() == Window.CANCEL)
                return Status.CANCEL_STATUS;

            configuration.put(IOfficeApplication.APPLICATION_HOME_KEY,
                    localApplicationWizard.getSelectedHomePath());
        }
    }

    System.out.println(
            "NOAUIPlugin: internalStartApplication(): the office suite configuration should now be valid:");
    if (officeApplication == null)
        System.out.println("NOAUIPlugin: internalStartApplication(): officeApplication==null");
    else
        System.out.println(
                "NOAUIPlugin: internalStartApplication(): officeApplication=" + officeApplication.toString());
    if (configuration == null)
        System.out.println("NOAUIPlugin: internalStartApplication(): configuration==null");
    else
        System.out
                .println("NOAUIPlugin: internalStartApplication(): configuration=" + configuration.toString());
    if (shell == null)
        System.out.println("NOAUIPlugin: internalStartApplication(): shell==null");
    else
        System.out.println("NOAUIPlugin: internalStartApplication(): shell=" + shell.toString());
    System.out.println(
            "NOAUIPlugin: internalStartApplication(): Finally trying activateOfficeApplication(officeApplication, configuration, shell):");

    IStatus status = activateOfficeApplication(officeApplication, configuration, shell);
    if (configurationChanged) {
        System.out.println(
                "NOAUIPlugin: internalStartApplication(): Configuration of PREFERENCE_OFFICE_HOME changed.");
        System.out.println("NOAUIPlugin: internalStartApplication(): Storing the new configuration.");
        System.out.println(
                "NOAUIPlugin: internalStartApplication(): Using js mod adopted for Elexis, reproducing prior GW adoptions, P_OOBASEDIR via ...(Hub.localCfg)");

        //JS modified this:
        //The original code tries to access a preference store which is not used in Elexis,
        //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java
        //Unsuitable original line, removed:
        //getDefault().getPluginPreferences().setValue(PREFERENCE_OFFICE_HOME,
        //                                             configuration.get(IOfficeApplication.APPLICATION_HOME_KEY).toString());
        //Newly inserted line:
        preferenceStore.setValue(PreferenceConstants.P_OOBASEDIR,
                configuration.get(IOfficeApplication.APPLICATION_HOME_KEY).toString());
    }

    System.out.println("NOAUIPlugin: internalStartApplication() end, returning status");
    return status;
}

From source file:ag.ion.noa4e.ui.NOAUIPlugin.java

License:Open Source License

/**
 * Activates office application./*from w ww. ja  v  a  2  s . co m*/
 * 
 * @param officeApplication office application to be activated
 * @param configuration configuration to be used
 * @param shell shell to be used
 * 
 * @return status information of the activation
 *  
 * @author Andreas Brker
 * @date 28.08.2006
 */
private static IStatus activateOfficeApplication(IOfficeApplication officeApplication, Map configuration,
        Shell shell) {
    IStatus status = Status.OK_STATUS;

    System.out.println("NOAUIPlugin: activateOfficeApplication() begin");
    System.out.println("NOAUIPlugin: activateOfficeApplication(): trying to getActiveWorkbenchWindow()");

    try {
        officeApplication.setConfiguration(configuration);
        boolean useProgressMonitor = true;
        IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (workbenchWindow == null)
            useProgressMonitor = false;
        else {
            IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
            if (workbenchPage == null)
                useProgressMonitor = false;

            if (workbenchPage == null)
                System.out.println("NOAUIPlugin: activateOfficeApplication(): workbenchPage==null");
            else
                System.out.println(
                        "NOAUIPlugin: activateOfficeApplication(): workbenchPage=" + workbenchPage.toString());

        }

        if (workbenchWindow == null)
            System.out.println("NOAUIPlugin: activateOfficeApplication(): workbenchWindow==null");
        else
            System.out.println(
                    "NOAUIPlugin: activateOfficeApplication(): workbenchWindow=" + workbenchWindow.toString());

        System.out.println(
                "NOAUIPlugin: activateOfficeApplication(): trying to get new ActivateOfficeApplicationOperation()");

        ActivateOfficeApplicationOperation activateOfficeApplicationOperation = new ActivateOfficeApplicationOperation(
                officeApplication);

        if (activateOfficeApplicationOperation == null)
            System.out.println(
                    "NOAUIPlugin: activateOfficeApplication(): activateOfficeApplicationOperation==null");
        else
            System.out.println("NOAUIPlugin: activateOfficeApplication(): activateOfficeApplicationOperation="
                    + activateOfficeApplicationOperation.toString());

        System.out
                .println("NOAUIPlugin: activateOfficeApplication(): useProgressMonitor=" + useProgressMonitor);

        if (useProgressMonitor) {
            System.out.println(
                    "NOAUIPlugin: activateOfficeApplication(): trying to get new ProgressMonitorDialog()");

            ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell);

            if (progressMonitorDialog == null)
                System.out.println("NOAUIPlugin: activateOfficeApplication(): progressMonitorDialog==null");
            else
                System.out.println("NOAUIPlugin: activateOfficeApplication(): progressMonitorDialog="
                        + progressMonitorDialog.toString());
            if (activateOfficeApplicationOperation == null)
                System.out.println(
                        "NOAUIPlugin: activateOfficeApplication(): activateOfficeApplicationOperation==null");
            else
                System.out
                        .println("NOAUIPlugin: activateOfficeApplication(): activateOfficeApplicationOperation="
                                + activateOfficeApplicationOperation.toString());

            System.out.println("NOAUIPlugin: activateOfficeApplication(): trying to run ProgressMonitorDialog");

            //in progressMonitorDialog.run() selbst kann ich offenbar kein Monitoring hineinschreiben,
            //das gehrt zu den eclipse Klassen. Aber vielleicht nach activateOfficeApplicationOperation.

            progressMonitorDialog.run(true, true, activateOfficeApplicationOperation);

            System.out.println(
                    "NOAUIPlugin: activateOfficeApplication(): ProgressMonitorDialog should now be running...");
        } else
            activateOfficeApplicationOperation.run(new NullProgressMonitor());

        System.out.println("NOAUIPlugin: activateOfficeApplication(): check whether exception occured:");

        if (activateOfficeApplicationOperation.getOfficeApplicationException() != null) {

            System.out.println(
                    "NOAUIPlugin: activateOfficeApplication(): check whether exception occured: YES: so show status in error dialog");

            status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
                    activateOfficeApplicationOperation.getOfficeApplicationException().getMessage(),
                    activateOfficeApplicationOperation.getOfficeApplicationException());
            ErrorDialog.openError(shell, Messages.NOAUIPlugin_title_error, ERROR_ACTIVATING_APPLICATION,
                    status);
        }

    } catch (InvocationTargetException invocationTargetException) {
        status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, invocationTargetException.getMessage(),
                invocationTargetException);
        ErrorDialog.openError(shell, Messages.NOAUIPlugin_title_error, ERROR_ACTIVATING_APPLICATION, status);
    } catch (OfficeApplicationException officeApplicationException) {
        status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, officeApplicationException.getMessage(),
                officeApplicationException);
        ErrorDialog.openError(shell, Messages.NOAUIPlugin_title_error, ERROR_ACTIVATING_APPLICATION, status);
    } catch (InterruptedException interruptedException) {
        return Status.CANCEL_STATUS;
    }

    System.out.println("NOAUIPlugin: activateOfficeApplication() end, returning status");
    return status;
}

From source file:al.gov.asp.smc.e4.linkapp.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();/*from  w  ww . j  a  va  2 s. c o m*/
    dialog.run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
            }
        }
    });

    pmContext.dispose();
}