use of org.eclipse.wst.common.componentcore.internal.ComponentResource in project mdw-designer by CenturyLinkCloud.
the class ProjectConfigurator method addDeploymentAssemblyResourceMappings.
@SuppressWarnings("unchecked")
public boolean addDeploymentAssemblyResourceMappings(IFolder folder) {
StructureEdit moduleCore = null;
try {
moduleCore = StructureEdit.getStructureEditForWrite(project.getSourceProject());
if (moduleCore != null) {
ComponentResource found = null;
for (Object o : moduleCore.getComponent().getResources()) {
ComponentResource resource = (ComponentResource) o;
if (("/" + folder.getProjectRelativePath()).equals(resource.getSourcePath().toString()))
found = resource;
}
if (found == null) {
ComponentResource componentResource = moduleCore.createWorkbenchModuleResource(folder);
componentResource.setRuntimePath(new Path("/"));
moduleCore.getComponent().getResources().add(componentResource);
}
}
} finally {
if (moduleCore != null) {
moduleCore.saveIfNecessary(new NullProgressMonitor());
moduleCore.dispose();
}
}
return true;
}
Aggregations