Custom Project Problem [message #51732] |
Tue, 24 March 2009 07:12 |
Eclipse User |
|
|
|
Hello all,
I want to add my own project type to my plug-in. The plug-ins ID is
"de.mappa.ui". I made it like this:
1.:
Add a new nature
<plugin>
<extension
id="problemnature"
name="MAPPA-Problem"
point="org.eclipse.core.resources.natures">
<runtime>
<run
class="de.mappa.ui.natures.ProblemProject">
</run>
</runtime>
</extension>
</plugin>
The implementation:
public class ProblemProject implements IProjectNature {
private IProject project;
public void configure() throws CoreException {
System.out.println("DEBUG: ProblemProject#configure()");
}
public void deconfigure() throws CoreException {
}
public IProject getProject() {
return project;
}
public void setProject(IProject project) {
this.project = project;
}
}
But the configure-method is never invoked. Why do I need this class? What
can I do with it?
2.:
I added a new project programmatically:
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject p = root.getProject(sPage.getName());
if (!p.exists()) {
IProjectDescription description = workspace.newProjectDescription(p
.getName());
String path = MAPPA.MODEL.getRootPath();
path += DataConstants.SYSTEM_SEPARATOR + sPage.getFolderName();
description.setLocation(new Path(path));
description.setNatureIds(new String[] { "de.mappa.ui.problemnature" });
try {
p.create(description, null);
p.open(null);
} catch (CoreException e) {}
}
This result in the following .project file:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>The problems name2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>de.mappa.ui.problemnature</nature>
</natures>
</projectDescription>
But if I choose properties in the navigator the type is "Project" and not
my custom project. Furthermore the following trigger does not fire:
<triggerPoints>
<and>
<adapt type="org.eclipse.core.resources.IProject" />
<test
forcePluginActivation="true"
property="org.eclipse.core.resources.projectNature"
value="de.mappa.ui.problemnature">
</test>
</and>
</triggerPoints>
And as a last question what can be done with IProjectNatureDescriptor?
Thx in advance
|
|
|
Powered by
FUDForum. Page generated in 0.04313 seconds