use of org.eclipse.wst.common.componentcore.internal.ReferencedComponent in project webtools.servertools by eclipse.
the class ModuleTraverser method traverseWebComponent.
private static void traverseWebComponent(IVirtualComponent component, IModuleVisitor visitor, IProgressMonitor monitor) throws CoreException {
visitor.visitWebComponent(component);
IProject proj = component.getProject();
StructureEdit warStruct = StructureEdit.getStructureEditForRead(proj);
try {
WorkbenchComponent comp = warStruct.getComponent();
if (comp == null) {
Trace.trace(Trace.SEVERE, "Error getting WorkbenchComponent from war project. IProject=\"" + proj + "\" StructureEdit=\"" + warStruct + "\" WorkbenchComponent=\"" + comp + "\"");
return;
}
traverseWebComponentLocalEntries(comp, visitor, monitor);
// traverse referenced components
List children = comp.getReferencedComponents();
for (Iterator itor = children.iterator(); itor.hasNext(); ) {
ReferencedComponent childRef = (ReferencedComponent) itor.next();
IPath rtFolder = childRef.getRuntimePath();
URI refHandle = childRef.getHandle();
if (PlatformURLModuleConnection.CLASSPATH.equals(refHandle.segment(ModuleURIUtil.ModuleURI.SUB_PROTOCOL_INDX))) {
IPath refPath = getResolvedPathForArchiveComponent(refHandle);
// If an archive component, add to list
if (refPath != null) {
if (!refPath.isAbsolute()) {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(refPath);
IPath refPath2 = file.getLocation();
if (refPath2 != null) {
visitor.visitArchiveComponent(rtFolder, refPath2);
} else {
Trace.trace(Trace.WARNING, NLS.bind("Could not get the location of a referenced component. It may not exist. Project={0}, Parent Component={1}, Referenced Component Path={2}", new Object[] { proj.getName(), comp.getName(), refPath }));
}
} else {
visitor.visitArchiveComponent(rtFolder, refPath);
}
} else {
// TODO Determine if any use case would arrive here.
}
} else {
try {
WorkbenchComponent childCom = warStruct.findComponentByURI(refHandle);
if (childCom == null) {
continue;
}
traverseDependentEntries(visitor, rtFolder, childCom, monitor);
} catch (UnresolveableURIException e) {
TomcatPlugin.log(e);
}
}
}
} finally {
warStruct.dispose();
}
visitor.endVisitWebComponent(component);
}
use of org.eclipse.wst.common.componentcore.internal.ReferencedComponent in project liferay-ide by liferay.
the class ModuleTraverser method traverseWebComponent.
private static void traverseWebComponent(IVirtualComponent component, IModuleVisitor visitor, IProgressMonitor monitor) throws CoreException {
visitor.visitWebComponent(component);
IProject proj = component.getProject();
StructureEdit warStruct = StructureEdit.getStructureEditForRead(proj);
try {
WorkbenchComponent comp = warStruct.getComponent();
if (comp == null) {
// + "\" WorkbenchComponent=\"" + comp + "\""); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
traverseWebComponentLocalEntries(comp, visitor, monitor);
// traverse referenced components
List children = comp.getReferencedComponents();
for (Iterator itor = children.iterator(); itor.hasNext(); ) {
ReferencedComponent childRef = (ReferencedComponent) itor.next();
IPath rtFolder = childRef.getRuntimePath();
URI refHandle = childRef.getHandle();
if (PlatformURLModuleConnection.CLASSPATH.equals(refHandle.segment(ModuleURIUtil.ModuleURI.SUB_PROTOCOL_INDX))) {
IPath refPath = getResolvedPathForArchiveComponent(refHandle);
// If an archive component, add to list
if (refPath != null) {
if (!refPath.isAbsolute()) {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(refPath);
IPath refPath2 = file.getLocation();
if (refPath2 != null) {
visitor.visitArchiveComponent(rtFolder, refPath2);
} else {
// Trace.trace(Trace.WARNING, NLS.bind(
// "Could not get the location of a referenced component. It may not exist. Project={0}, Parent Component={1}, Referenced Component Path={2}", //$NON-NLS-1$
// new Object[] { proj.getName(), comp.getName(), refPath}));
}
} else {
visitor.visitArchiveComponent(rtFolder, refPath);
}
} else {
// TODO Determine if any use case would arrive here.
}
} else {
try {
WorkbenchComponent childCom = warStruct.findComponentByURI(refHandle);
if (childCom == null) {
continue;
}
traverseDependentEntries(visitor, rtFolder, childCom, monitor);
} catch (UnresolveableURIException e) {
LiferayServerCore.logError(e);
}
}
}
} finally {
warStruct.dispose();
}
visitor.endVisitWebComponent(component);
}
Aggregations