use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project webtools.sourceediting by eclipse.
the class ModuleCoreSupportDelegate method resolveInReferenced.
private static IPath resolveInReferenced(IProject project, IPath runtimeReference) {
IVirtualReference[] references = ComponentCore.createComponent(project).getReferences();
if (references != null) {
for (int i = 0; i < references.length; i++) {
IVirtualComponent referencedComponent = references[i].getReferencedComponent();
if (referencedComponent == null)
continue;
IVirtualComponent component = referencedComponent.getComponent();
if (component == null)
continue;
IVirtualFolder rootFolder = component.getRootFolder();
if (rootFolder == null)
continue;
// overlay?
IVirtualResource member = rootFolder.findMember(runtimeReference);
if (member != null) {
return member.getWorkspaceRelativePath();
}
}
}
return null;
}
use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project webtools.sourceediting by eclipse.
the class ModuleCoreSupportDelegate method resolveInReferenced.
private static IPath resolveInReferenced(IProject project, IPath runtimeReference) {
IVirtualReference[] references = ComponentCore.createComponent(project).getReferences();
if (references != null) {
for (int i = 0; i < references.length; i++) {
IVirtualComponent referencedComponent = references[i].getReferencedComponent();
if (referencedComponent == null)
continue;
IVirtualComponent component = referencedComponent.getComponent();
if (component == null)
continue;
IVirtualFolder rootFolder = component.getRootFolder();
if (rootFolder == null)
continue;
// overlay?
IVirtualResource member = rootFolder.findMember(runtimeReference);
if (member != null) {
return member.getWorkspaceRelativePath();
}
}
}
return null;
}
use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project webtools.sourceediting by eclipse.
the class ModuleCoreSupportDelegate method getWebContentRootPath.
/**
* @param project
* @return the IPath to the "root" of the web contents
*/
static IPath getWebContentRootPath(IProject project) {
if (project == null)
return null;
if (!ModuleCoreNature.isFlexibleProject(project))
return null;
IPath path = null;
IVirtualComponent component = ComponentCore.createComponent(project);
if (component != null && component.exists()) {
path = component.getRootFolder().getWorkspaceRelativePath();
}
return path;
}
use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project webtools.sourceediting by eclipse.
the class FacetModuleCoreSupportDelegate method getAcceptableRootPaths.
static IPath[] getAcceptableRootPaths(IProject project) {
if (!ModuleCoreNature.isFlexibleProject(project)) {
return new IPath[] { project.getFullPath() };
}
List paths = new ArrayList();
IVirtualFolder componentFolder = ComponentCore.createFolder(project, Path.ROOT);
if (componentFolder != null && componentFolder.exists()) {
IContainer[] workspaceFolders = componentFolder.getUnderlyingFolders();
for (int i = 0; i < workspaceFolders.length; i++) {
if (workspaceFolders[i].getFolder(FacetModuleCoreSupport.META_INF_RESOURCES_PATH).isAccessible())
paths.add(workspaceFolders[i].getFullPath().append(FacetModuleCoreSupport.META_INF_RESOURCES_PATH));
else
paths.add(workspaceFolders[i].getFullPath());
}
IVirtualReference[] references = ComponentCore.createComponent(project).getReferences();
if (references != null) {
for (int i = 0; i < references.length; i++) {
IVirtualComponent referencedComponent = references[i].getReferencedComponent();
if (referencedComponent == null)
continue;
IVirtualComponent component = referencedComponent.getComponent();
if (component == null)
continue;
IVirtualFolder rootFolder = component.getRootFolder();
if (rootFolder == null)
continue;
IPath referencedPathRoot = rootFolder.getWorkspaceRelativePath();
/* http://bugs.eclipse.org/410161 */
if (referencedPathRoot != null) {
/*
* See Servlet 3.0, section 4.6 ; this is the only
* referenced module/component type we support
*/
IPath resources = referencedPathRoot.append(FacetModuleCoreSupport.META_INF_RESOURCES);
if (resources != null && component.getProject().findMember(resources.removeFirstSegments(1)) != null) {
paths.add(resources);
}
}
}
}
} else {
paths.add(project.getFullPath());
}
return (IPath[]) paths.toArray(new IPath[paths.size()]);
}
use of org.eclipse.wst.common.componentcore.resources.IVirtualComponent in project webtools.sourceediting by eclipse.
the class FacetModuleCoreSupportDelegate method getWebContentRootPath.
/**
* @param project
* @return the IPath to the "root" of the web contents
*/
static IPath getWebContentRootPath(IProject project) {
if (project == null)
return null;
if (!ModuleCoreNature.isFlexibleProject(project))
return null;
IPath path = null;
IVirtualComponent component = ComponentCore.createComponent(project);
if (component != null && component.exists() && component.getRootFolder() != null) {
path = component.getRootFolder().getWorkspaceRelativePath();
if (component.getRootFolder().getFolder(FacetModuleCoreSupport.META_INF_RESOURCES_PATH).getUnderlyingFolder().isAccessible()) {
path = path.append(FacetModuleCoreSupport.META_INF_RESOURCES_PATH);
}
}
return path;
}
Aggregations