Search in sources :

Example 1 with JavaLaunchConfig

use of org.absmodels.abs.plugin.actions.runconfig.java.JavaLaunchConfig 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)

Aggregations

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 JavaJob (org.absmodels.abs.plugin.actions.JavaJob)1 JavaLaunchConfig (org.absmodels.abs.plugin.actions.runconfig.java.JavaLaunchConfig)1 AbsJobException (org.absmodels.abs.plugin.exceptions.AbsJobException)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)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 IAction (org.eclipse.jface.action.IAction)1