Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Custom Project Problem
Custom Project Problem [message #51732] Tue, 24 March 2009 11:12
Joerg is currently offline JoergFriend
Messages: 9
Registered: July 2009
Junior Member
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
Previous Topic:Problem adding an extension point
Next Topic:Custom Project Problem
Goto Forum:
  


Current Time: Thu Apr 18 03:31:40 GMT 2024

Powered by FUDForum. Page generated in 0.02235 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top