|
Re: Listen to PerformFinisch Wizard [message #1174701 is a reply to message #1171927] |
Thu, 07 November 2013 09:09 |
arthurembo Simo Messages: 16 Registered: May 2011 Location: Germany |
Junior Member |
|
|
Hi all,
I find a workaround to do my work but I get another problem:
I wrote an eclipse(Juno) plugin to automatically create a junit launch configuration, when a java project is created. I listen the changes in the workspace and when a new java project is created, I start a process to create the corresponding launch configuration:
public static void create(IProject project) {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchType = manager
.getLaunchConfigurationType(JUNIT_LAUNCH_IDENTIFIER);
try {
ILaunchConfigurationWorkingCopy workingCopy = launchType.newInstance(null, project.getName());
List<IResource> resources = new ArrayList<IResource>();
resources.add(project);
IResource[] resourcesArray = toArray(resources);
workingCopy.setMappedResources(resources.toArray(resourcesArray) );
workingCopy.setAttribute("org.eclipse.jdt.junit.CONTAINER", project.getName().replace("#", "\\#"));
workingCopy.setAttribute("org.eclipse.jdt.junit.KEEPRUNNING_ATTR", false);
workingCopy.setAttribute("org.eclipse.jdt.junit.TESTNAME", "");
workingCopy.setAttribute("org.eclipse.jdt.junit.TEST_KIND", "org.eclipse.jdt.junit.loader.junit4");
workingCopy.setAttribute("org.eclipse.jdt.launching.MAIN_TYPE", "");
workingCopy.setAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", "");
workingCopy.setAttribute("org.eclipse.jdt.launching.VM_ARGUMENTS", "-Xms128m -Xmx512m -DSYS_DRIVE=${env_var:SYS_DRIVE} " +
"-DAPPL_DRIVE=${env_var:APPL_DRIVE} -DDATA1_DRIVE=${env_var:DATA1_DRIVE} -DSYS_DIR=${env_var:SYS_DIR} " +
"-DEXT1_DRIVE=F: -DTESTDATA_ROOT=${workspace_loc:trunk#IS+LVIS/testdata}");
workingCopy.doSave();
} catch (CoreException e) {
log.log(Level.WARNING,
"Unable to create a new launch configuration.", e);
}
}
By the method workingCopy.setMappedResources(), I give as parameter the corresponding IProject. I try the plugin, I create a project with the name 'testProject', my plugin receives the event and create the junit launch configuration file. I check the file, I open it in an editor and the attribute above are setted:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/testProject"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="testProject"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms128m -Xmx512m -DSYS_DRIVE=${env_var:SYS_DRIVE} -DAPPL_DRIVE=${env_var:APPL_DRIVE} -DDATA1_DRIVE=${env_var:DATA1_DRIVE} -DSYS_DIR=${env_var:SYS_DIR} -DEXT1_DRIVE=F: -DTESTDATA_ROOT=${workspace_loc:trunk#IS+LVIS/testdata}"/>
</launchConfiguration>
Now I opened the eclipse debug configuration dialog, I get a problem:
It look the dialog opening overwrote the launch configuration and I get no project selected in the dialog.
Another thing is that, when I make a right click on my project in the package explorer view to debug the project as Junit, it creates another launch configuration with the same name and the suffix (1). So "testProject(1)".
I need help thanks.
Best Regards.
|
|
|
Powered by
FUDForum. Page generated in 0.03179 seconds