Search in sources :

Example 1 with JavaJob

use of org.absmodels.abs.plugin.actions.JavaJob in project abstools by abstools.

the class JavaRunConfiguration method launch.

@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    JavaLaunchConfig launchConfig = new JavaLaunchConfig(config);
    IAction action = createNewAction(launchConfig);
    IProject project = ActionUtils.getProject(config);
    IFile file = null;
    ActionUtils.saveDirtyEditors(project);
    JavaJob job = new JavaJob(JavaJob.RUN_JOB, action, project, file);
    String product = launchConfig.getProductName();
    if (product != null) {
        try {
            Model model = JavaJob.getModelFromProject(project);
            job.setProduct(model.findProduct(product));
        } catch (WrongProgramArgumentException e) {
            throw new CoreException(new Status(IStatus.ERROR, Constants.PLUGIN_ID, "Launch failed", e));
        } catch (AbsJobException e) {
            throw new CoreException(new Status(IStatus.ERROR, Constants.PLUGIN_ID, "Launch failed", e));
        }
    }
    if (launchConfig.getTestExecution()) {
        List<String> obs = launchConfig.getDebuggerObserverList();
        obs.add(ABSTestObserver.class.getName());
    }
    modifyDebuggerArguments(launchConfig, job);
    if (launchConfig.getTestExecution()) {
        // execution of unit tests
        Job testJob = new ABSUnitTestJavaExecutionJob(project, product, job);
        testJob.schedule();
    } else {
        // normal execution
        job.schedule();
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) IAction(org.eclipse.jface.action.IAction) JavaJob(org.absmodels.abs.plugin.actions.JavaJob) WrongProgramArgumentException(abs.common.WrongProgramArgumentException) ABSUnitTestJavaExecutionJob(org.absmodels.abs.plugin.actions.ABSUnitTestJavaExecutionJob) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) Model(abs.frontend.ast.Model) JavaLaunchConfig(org.absmodels.abs.plugin.actions.runconfig.java.JavaLaunchConfig) Job(org.eclipse.core.runtime.jobs.Job) JavaJob(org.absmodels.abs.plugin.actions.JavaJob) ABSUnitTestJavaExecutionJob(org.absmodels.abs.plugin.actions.ABSUnitTestJavaExecutionJob) AbsJobException(org.absmodels.abs.plugin.exceptions.AbsJobException) ABSTestObserver(abs.backend.java.absunit.ABSTestObserver)

Example 2 with JavaJob

use of org.absmodels.abs.plugin.actions.JavaJob in project abstools by abstools.

the class AbstractLaunchJavaShortcut method startJavaJob.

private void startJavaJob(IResource resource, String actionId, boolean withoutArgs) {
    IProject project = resource.getProject();
    IAction action = new Action() {
    };
    action.setId(actionId);
    IFile file = null;
    if (resource instanceof IFile) {
        file = (IFile) resource;
    }
    JavaJob job = new JavaJob(JavaJob.RUN_JOB, action, project, file);
    if (withoutArgs) {
        overwriteDefaultArgs(job);
    }
    job.schedule();
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IFile(org.eclipse.core.resources.IFile) IAction(org.eclipse.jface.action.IAction) JavaJob(org.absmodels.abs.plugin.actions.JavaJob) IProject(org.eclipse.core.resources.IProject)

Aggregations

JavaJob (org.absmodels.abs.plugin.actions.JavaJob)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 IAction (org.eclipse.jface.action.IAction)2 ABSTestObserver (abs.backend.java.absunit.ABSTestObserver)1 WrongProgramArgumentException (abs.common.WrongProgramArgumentException)1 Model (abs.frontend.ast.Model)1 ABSUnitTestJavaExecutionJob (org.absmodels.abs.plugin.actions.ABSUnitTestJavaExecutionJob)1 JavaLaunchConfig (org.absmodels.abs.plugin.actions.runconfig.java.JavaLaunchConfig)1 AbsJobException (org.absmodels.abs.plugin.exceptions.AbsJobException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1 Action (org.eclipse.jface.action.Action)1