[199338] model fix
diff --git a/plugins/org.eclipse.jem.util/.classpath b/plugins/org.eclipse.jem.util/.classpath
index 25434f7..a988941 100644
--- a/plugins/org.eclipse.jem.util/.classpath
+++ b/plugins/org.eclipse.jem.util/.classpath
@@ -3,7 +3,7 @@
<classpathentry kind="src" path="jemutil"/>
<classpathentry kind="src" path="property_files"/>
<classpathentry kind="src" path="jemutil-nonworkbnech"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
index d223546..cb579cc 100644
--- a/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.jem.util/.settings/org.eclipse.jdt.core.prefs
@@ -1,15 +1,15 @@
-#Sat Mar 31 22:57:30 EDT 2007
+#Tue Jul 31 20:39:48 EDT 2007
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -45,7 +45,7 @@
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
index 61e0bf5..eea0f11 100644
--- a/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.util/META-INF/MANIFEST.MF
@@ -23,4 +23,4 @@
org.eclipse.perfmsr.core;bundle-version="1.0.0";resolution:=optional,
com.ibm.icu;bundle-version="[3.4.4.1,4.0.0)"
Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
index 36c8f4d..ce29582 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/internal/util/emf/workbench/ProjectResourceSetImpl.java
@@ -10,7 +10,7 @@
*******************************************************************************/
/*
* $$RCSfile: ProjectResourceSetImpl.java,v $$
- * $$Revision: 1.8 $$ $$Date: 2005/03/18 18:52:06 $$
+ * $$Revision: 1.9 $$ $$Date: 2007/08/09 00:44:35 $$
*/
package org.eclipse.jem.internal.util.emf.workbench;
@@ -23,6 +23,8 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.Resource.Factory;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
@@ -75,6 +77,31 @@
return result;
}
+ public Resource createResource(URI uri, Resource.Factory resourceFactory) {
+ if (isReleasing) return null;
+ //Check the map first when creating the resource and do not
+ //normalize if a value is found.
+ boolean isMapped = !(((URIConverterImpl.URIMap)getURIConverter().getURIMap()).getURI(uri).equals(uri));
+ URI converted = uri;
+ if (!isMapped)
+ converted = getURIConverter().normalize(uri);
+ Resource result = createResourceFromHandlers(converted);
+ if (result == null) {
+
+ if (resourceFactory != null)
+ {
+ result = resourceFactory.createResource(uri);
+ getResources().add(result);
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+ return result;
+ }
/**
* @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandLoad(Resource)
*/
@@ -261,6 +288,76 @@
if (isReleasing) return null;
return super.getResource(uri, loadOnDemand);
}
+ /*
+ * Javadoc copied from interface.
+ */
+ public Resource getResource(URI uri, boolean loadOnDemand, Resource.Factory resourceFactory) {
+ if (isReleasing) return null;
+
+
+ Map<URI, Resource> map = getURIResourceMap();
+ if (map != null)
+ {
+ Resource resource = map.get(uri);
+ if (resource != null)
+ {
+ if (loadOnDemand && !resource.isLoaded())
+ {
+ demandLoadHelper(resource);
+ }
+ return resource;
+ }
+ }
+
+ URIConverter theURIConverter = getURIConverter();
+ URI normalizedURI = theURIConverter.normalize(uri);
+ for (Resource resource : getResources())
+ {
+ if (theURIConverter.normalize(resource.getURI()).equals(normalizedURI))
+ {
+ if (loadOnDemand && !resource.isLoaded())
+ {
+ demandLoadHelper(resource);
+ }
+
+ if (map != null)
+ {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+ }
+
+ Resource delegatedResource = delegatedGetResource(uri, loadOnDemand);
+ if (delegatedResource != null)
+ {
+ if (map != null)
+ {
+ map.put(uri, delegatedResource);
+ }
+ return delegatedResource;
+ }
+
+ if (loadOnDemand)
+ {
+ Resource resource = demandCreateResource(uri,resourceFactory);
+ if (resource == null)
+ {
+ throw new RuntimeException("Cannot create a resource for '" + uri + "'; a registered resource factory is needed");
+ }
+
+ demandLoadHelper(resource);
+
+ if (map != null)
+ {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+
+ return null;
+
+ }
/* (non-Javadoc)
@@ -270,5 +367,10 @@
if (getURIResourceMap() != null)
getURIResourceMap().clear();
}
+
+ protected Resource demandCreateResource(URI uri, Factory resourceFactory) {
+ // TODO Auto-generated method stub
+ return createResource(uri,resourceFactory);
+ }
}
diff --git a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
index 68c9735..facbfd0 100644
--- a/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
+++ b/plugins/org.eclipse.jem.util/jemutil/org/eclipse/jem/util/emf/workbench/ProjectResourceSet.java
@@ -10,13 +10,15 @@
*******************************************************************************/
/*
* $$RCSfile: ProjectResourceSet.java,v $$
- * $$Revision: 1.3 $$ $$Date: 2005/02/15 23:04:14 $$
+ * $$Revision: 1.4 $$ $$Date: 2007/08/09 00:44:36 $$
*/
package org.eclipse.jem.util.emf.workbench;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.*;
+import org.eclipse.emf.ecore.resource.Resource.Factory;
/**
* A ResourceSet for an entire project. It allows sharing of resources from multiple editors/viewers for a project.
@@ -114,4 +116,45 @@
* @since 1.0.0
*/
void resetNormalizedURICache();
+
+
+ /**
+ * Returns the resource resolved by the URI.
+ * <p>
+ * A resource set is expected to implement the following strategy
+ * in order to resolve the given URI to a resource.
+ * First it uses it's {@link #getURIConverter URI converter} to {@link URIConverter#normalize normalize} the URI
+ * and then to compare it with the normalized URI of each resource;
+ * if it finds a match,
+ * that resource becomes the result.
+ * Failing that,
+ * it {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#delegatedGetResource delegates}
+ * to allow the URI to be resolved elsewhere.
+ * For example,
+ * the {@link org.eclipse.emf.ecore.EPackage.Registry#INSTANCE package registry}
+ * is used to {@link org.eclipse.emf.ecore.EPackage.Registry#getEPackage resolve}
+ * the {@link org.eclipse.emf.ecore.EPackage namespace URI} of a package
+ * to the static instance of that package.
+ * So the important point is that an arbitrary implementation may resolve the URI to any resource,
+ * not necessarily to one contained by this particular resource set.
+ * If the delegation step fails to provide a result,
+ * and if <code>loadOnDemand</code> is <code>true</code>,
+ * a resource is {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandCreateResource created}
+ * and that resource becomes the result.
+ * If <code>loadOnDemand</code> is <code>true</code>
+ * and the result resource is not {@link Resource#isLoaded loaded},
+ * it will be {@link org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#demandLoad loaded} before it is returned.
+ * </p>
+ * @param uri the URI to resolve.
+ * @param loadOnDemand whether to create and load the resource, if it doesn't already exists.
+ * @param registeredFactory that is used to create resource if needed
+ * @return the resource resolved by the URI, or <code>null</code> if there isn't one and it's not being demand loaded.
+ * @throws RuntimeException if a resource can't be demand created.
+ * @throws org.eclipse.emf.common.util.WrappedException if a problem occurs during demand load.
+ * @since 2.1
+ */
+
+ Resource getResource(URI uri, boolean loadOnDemand, Factory registeredFactory);
+
+ public Resource createResource(URI uri, Resource.Factory resourceFactory);
}
\ No newline at end of file