|
Re: How to: create DWP programmatically? [message #668192 is a reply to message #667985] |
Wed, 04 May 2011 08:42   |
Eclipse User |
|
|
|
Created a dwp manually using eclipse.
Tried to create a dwp programmatically so that its .project matches that of created by Eclipse.
Project gets created fine. (both .project files are same).
But there is no .classpath file in the project dir.
Also I'm not able to link the sources and add external jars to classpath. When I link the sources, the package structure doesn't match the one on the disk.
Here is the code (thus far):
private void createDWP(IProject project) throws CoreException {
IFacetedProject facetedProject =
ProjectFacetsManager.create(project, true, null);
IProjectDescription description = project.getDescription();
description.setNatureIds(new String[]
{"org.eclipse.jem.workbench.JavaEMFNature",
"org.eclipse.jdt.core.javanature",
"org.eclipse.wst.common.project.facet.core.nature",
"org.eclipse.wst.common.modulecore.ModuleCoreNature",
"org.eclipse.wst.jsdt.core.jsNature"});
project.setDescription(description, null);
IProjectFacet wstWebFacet = ProjectFacetsManager.getProjectFacet
(IModuleConstants.WST_WEB_MODULE);
facetedProject.installProjectFacet
(wstWebFacet.getDefaultVersion(), null, null);
}
How does one add source and lib entries to a DynamicWebProject (facetedproject) programmatically?
Please guide.
|
|
|
Re: How to: create DWP programmatically? [message #870971 is a reply to message #668192] |
Thu, 10 May 2012 08:02  |
Eclipse User |
|
|
|
Hi,
I'm also trying to create the dynamic web project using RSA plugins, but my code is getting failed. Could you please share your code to generate dynamic web project...
Below is the code which i'm using:
IDataModel dm = DataModelFactory.createDataModel(new SimpleWebFacetProjectCreationDataModelProvider());
dm.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, projectName); //$NON-NLS-1$
FacetDataModelMap facetDataModelMap = (FacetDataModelMap) dm
.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
IDataModel webFacetDataModel = facetDataModelMap.getFacetDataModel(IModuleConstants.WST_WEB_MODULE/*IModuleConstants.JST_WEB_MODULE*/);
webFacetDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION,
ProjectFacetsManager.getProjectFacet(
IModuleConstants.WST_WEB_MODULE).getVersion("2.4"));
dm.getDefaultOperation().execute(null, null);
IFacetedProject project = ProjectFacetsManager.create(ResourcesPlugin.getWorkspace().getRoot().getProject(
projectName));
The error that i'm getting is:
java.lang.IllegalArgumentException: Could not find version 2.4 of project facet wst.web.
at org.eclipse.wst.common.project.facet.core.internal.ProjectFacet.getVersion(ProjectFacet.java:125)
Thanks in adavance.
Raj
|
|
|
Powered by
FUDForum. Page generated in 0.05099 seconds