@Override
public ReferencedComponent resolve(IVirtualReference reference) {
if(canResolve(reference)) {
IOverlayVirtualComponent comp = (IOverlayVirtualComponent)reference.getReferencedComponent();
ReferencedComponent rc = ComponentcorePackage.eINSTANCE.getComponentcoreFactory().createReferencedComponent();
rc.setArchiveName(reference.getArchiveName());
rc.setRuntimePath(reference.getRuntimePath());
URI handle;
Map<String, String> parameters = new LinkedHashMap<String, String>(3);
if (comp instanceof OverlayVirtualArchiveComponent) {
OverlayVirtualArchiveComponent archivecomp = (OverlayVirtualArchiveComponent) comp;
handle = URI.createURI(VAR_ARCHIVE_PROTOCOL+archivecomp.getArchivePath().toPortableString());
parameters.put(UNPACK_FOLDER, archivecomp.getUnpackFolderPath().toPortableString());
} else {
IProject p = comp.getProject();
if (p.equals(reference.getEnclosingComponent().getProject())) {
handle = URI.createURI(SELF_PROTOCOL);
} else {
handle = URI.createURI(PROJECT_PROTOCOL+p.getName());
}
}
parameters.put(INCLUDES, flatten(comp.getInclusions()));
parameters.put(EXCLUDES, flatten(comp.getExclusions()));
handle = URI.createURI(ModuleURIUtil.appendToUri(handle.toString(), parameters));
rc.setHandle(handle);
rc.setDependencyType(DependencyType.CONSUMES_LITERAL);
return rc;
}
return null;
}