I am creating a dynamic IProject in eclipse. This IProject acts like the “New Plug-in with JAR archives” project in eclipse. Then I point to the reference of this outside jar file. Which btw I extract then link to the temporary IProject.
<linkedResources>
<link>
<name>SampleTestSuite</name>
<type>2</type>
<location>D:/eclipse-rcp-indigo/tests/SampleTestSuite</location>
</link>
</linkedResources>
Now, I’m planning to make this IProject Run-As JUnit. I want to delete the extracted and linked jar file after the JUnit. This is my code below in running JUnit but after file deletion it will throw an error because the linkedresource will not be there. Any ideas how to monitor if JUnit is already finished so that the linkedresource will be deleted?
Activator.getDisplay().syncExec(new Runnable() {
public void run() {
Job job = new Job("Test Runner JUnit") {
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Launching JUnit", 100);
try {
ILaunch launch = new Launch(launchConfiguration,
"run", null);
launch.setAttribute(
"org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING",
DebugPlugin.getDefault().getLaunchManager()
.getEncoding(launchConfiguration));
DebugPlugin.getDefault().getLaunchManager()
.addLaunch(launch);
launchDelegate.launch(launchConfiguration, "run",
launch, monitor);
} catch (CoreException e) {
return e.getStatus();
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
};
job.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
System.out.println("Job completed successfully");
// delete the file here
} else
System.out
.println("Job did not complete successfully");
}
});
job.setPriority(Job.INTERACTIVE);
job.schedule();
}
});
I just added this one