1 package com.proalpha.pds.ui.handlers;
3 import java.lang.reflect.InvocationTargetException;
5 import org.eclipse.core.commands.ExecutionEvent;
6 import org.eclipse.core.commands.ExecutionException;
7 import org.eclipse.core.resources.ResourcesPlugin;
8 import org.eclipse.core.runtime.jobs.ISchedulingRule;
9 import org.eclipse.jface.operation.IRunnableContext;
10 import org.eclipse.jface.operation.IRunnableWithProgress;
11 import org.eclipse.ui.PlatformUI;
13 import com.proalpha.pds.exception.ProALPHANotAvailableException;
14 import com.proalpha.pds.paconnector.Activator;
15 import com.proalpha.pds.paconnector.PaProject;
16 import com.proalpha.pds.paconnector.utils.ExceptionUtils;
17 import com.proalpha.pds.ui.AbstractProAlphaHandler;
22 public Object execute(ExecutionEvent event)
throws ExecutionException {
27 runProgram(paProject);
35 private static void runProgram(
PaProject paProject) {
36 IRunnableWithProgress runnable = monitor -> {
37 monitor.beginTask(
"open compiler", 2);
39 paProject.getBridge().startCompilerOpt(
"*",
true);
43 ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
44 IRunnableContext context = PlatformUI.getWorkbench().getProgressService();
47 PlatformUI.getWorkbench().getProgressService().runInUI(context, runnable, rule);
48 }
catch (InvocationTargetException e) {
50 }
catch (InterruptedException e) {
52 Thread.currentThread().interrupt();
static Activator getDefault()
static void showAndLogErrorMessage(AbstractUIPlugin plugin, Throwable exception)
PaProject getPaProjectOfEvent(ExecutionEvent event)