[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.webtools] Re: Extension point for Dynamic Web Project


Thanks for your answer.

I have tried the following code but got error message saying project should either be ComponentHandle or implement IVirtualComponent. So my questions are

Is the "project" an instance of IProject (class which implements IProject)?

How can I get ref of IVirtualComponent from project?


Thank very much!


William



Daniel Rohe wrote:

You must have a reference to the dynamic web project to get the descriptor model of the web application which is stored in web.xml.

WebArtifactEdit artifactEdit = null;
try {
   // here you can edit the descriptor
   artifactEdit = WebArtifactEdit.getWebArtifactEditForWrite(project);
   // here only reading is allowed
   //artifactEdit = WebArtifactEdit.getWebArtifactEditForRead(project);

   // your web application descriptor model (web.xml)
   WebApp webApp = artifactEdit.getWebApp();
} finally {
   if (artifactEdit != null) {
     artifactEdit.dispose();
   }
}

The class WebArtifactEdit is in org.eclipse.jst.j2ee.web, package org.eclipse.jst.j2ee.web.componentcore.util.

Kind regards,
Daniel

William schrieb:

Do you guys know what is the extension point for adding a popup menu item to dynamic web project? As you know we add a popup menu item to java project node by defining extension point of org.eclipse.jdt.core.IJavaProject.


Is there a helper class to get/set web.xml content?


Thanks

William