[295060] Transformation executor must accept a generic transformation URI
diff --git a/plugins/org.eclipse.m2m.qvt.oml.project/src/org/eclipse/m2m/internal/qvt/oml/project/builder/EclipseUnitResolverFactory.java b/plugins/org.eclipse.m2m.qvt.oml.project/src/org/eclipse/m2m/internal/qvt/oml/project/builder/EclipseUnitResolverFactory.java
index e687f0e..6778e06 100644
--- a/plugins/org.eclipse.m2m.qvt.oml.project/src/org/eclipse/m2m/internal/qvt/oml/project/builder/EclipseUnitResolverFactory.java
+++ b/plugins/org.eclipse.m2m.qvt.oml.project/src/org/eclipse/m2m/internal/qvt/oml/project/builder/EclipseUnitResolverFactory.java
@@ -15,76 +15,82 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory;
+import org.eclipse.m2m.internal.qvt.oml.compiler.BlackboxUnitResolver;
+import org.eclipse.m2m.internal.qvt.oml.compiler.URIUnitResolver;
import org.eclipse.m2m.internal.qvt.oml.compiler.UnitProxy;
import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolver;
+import org.eclipse.m2m.internal.qvt.oml.compiler.UnitResolverFactory;
import org.eclipse.m2m.internal.qvt.oml.emf.util.URIUtils;
import org.eclipse.m2m.internal.qvt.oml.project.QVTOProjectPlugin;
import org.eclipse.m2m.internal.qvt.oml.runtime.project.DeployedImportResolver;
import org.eclipse.m2m.internal.qvt.oml.runtime.project.PlatformPluginUnitResolver;
-
public class EclipseUnitResolverFactory implements UnitResolverFactory {
-
- public EclipseUnitResolverFactory() {
+
+ public EclipseUnitResolverFactory() {
}
-
+
public boolean isAccepted(Object source) {
- if(source instanceof IResource) {
+ if (source instanceof IResource) {
return true;
}
-
- if(source instanceof URI) {
- URI uri = (URI) source;
- return uri.isPlatform() || isWorkspacePath(uri) || isDeployedByID(uri);
+
+ if (source instanceof URI) {
+ return true;
}
-
+
return false;
}
public UnitProxy findUnit(URI unitURI) {
- if(unitURI.isPlatformResource()) {
+ if (unitURI.isPlatformResource()) {
IFile file = URIUtils.getFile(unitURI);
- if(file != null) {
+ if (file != null) {
return WorkspaceUnitResolver.getUnit(file);
}
- } else if(unitURI.isPlatformPlugin()) {
+ } else if (unitURI.isPlatformPlugin()) {
return PlatformPluginUnitResolver.getUnit(unitURI);
- } else {
- if(isWorkspacePath(unitURI)) {
- URI platformResourceURI = URI.createPlatformResourceURI(unitURI.path(), false);
+ } else if (BlackboxUnitResolver.isBlackboxUnitURI(unitURI)) {
+ return BlackboxUnitResolver.getUnit(unitURI);
+ } else if (isWorkspacePath(unitURI)) {
+ URI platformResourceURI = URI.createPlatformResourceURI(unitURI
+ .path(), false);
IFile file = URIUtils.getFile(platformResourceURI);
- if(file != null) {
+ if (file != null) {
return WorkspaceUnitResolver.getUnit(file);
}
- } else if(isDeployedByID(unitURI)) {
- return DeployedImportResolver.INSTANCE.resolveDeployedUnitOnly(unitURI.path());
- }
+ } else if (isDeployedByID(unitURI)) {
+ return DeployedImportResolver.INSTANCE
+ .resolveDeployedUnitOnly(unitURI.path());
+ } else {
+ return URIUnitResolver.getUnit(unitURI);
}
-
+
return null;
}
-
+
public UnitResolver getResolver(URI uri) {
IResource resource = URIUtils.getResource(uri);
- if(resource.exists()) {
+ if (resource.exists()) {
try {
return WorkspaceUnitResolver.getResolver(resource.getProject());
} catch (CoreException e) {
QVTOProjectPlugin.log(e);
}
}
-
- return null;
+
+ return null;
}
-
+
private static boolean isWorkspacePath(URI uri) {
- return uri.scheme() == null && !uri.hasDevice() && !uri.hasAuthority() &&
- !uri.hasEmptyPath() && !uri.hasQuery() && !uri.hasFragment() && uri.hasAbsolutePath();
+ return uri.scheme() == null && !uri.hasDevice() && !uri.hasAuthority()
+ && !uri.hasEmptyPath() && !uri.hasQuery() && !uri.hasFragment()
+ && uri.hasAbsolutePath();
}
-
+
private static boolean isDeployedByID(URI uri) {
- return uri.scheme() == null && !uri.hasDevice() && !uri.hasAuthority() &&
- !uri.hasEmptyPath() && !uri.hasQuery() && !uri.hasFragment() && !uri.hasAbsolutePath();
- }
+ return uri.scheme() == null && !uri.hasDevice() && !uri.hasAuthority()
+ && !uri.hasEmptyPath() && !uri.hasQuery() && !uri.hasFragment()
+ && !uri.hasAbsolutePath();
+ }
}