[204226] refactor rename does not work as expected after save as. Didn't update the URI.
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
index f159fc6..cf82bcc 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/text/XSDModelAdapter.java
@@ -83,19 +83,8 @@
// TODO... gotta pester SSE folks to provide 'useful' baseLocations
//
- URI uri = null;
- if (baseLocation.startsWith("/"))
- {
- uri = URI.createPlatformResourceURI(baseLocation);
- }
- else if (baseLocation.startsWith("http"))
- {
- uri = URI.createURI(baseLocation);
- }
- else
- {
- uri = URI.createFileURI(baseLocation);
- }
+ URI uri = getURI(baseLocation);
+
Resource resource = new XSDResourceImpl();
resource.setURI(uri);
schema = XSDFactory.eINSTANCE.createXSDSchema();
@@ -172,6 +161,10 @@
schema.setDocument(document);
schema.setElement(document.getDocumentElement());
+ String baseLocation = domNode.getModel().getBaseLocation();
+ URI uri = getURI(baseLocation);
+ schema.eResource().setURI(uri);
+
resourceSet = XSDSchemaImpl.createResourceSet();
resourceSet.getAdapterFactories().add(new XSDSchemaLocationResolverAdapterFactory());
resourceSet.getResources().add(schema.eResource());
@@ -212,7 +205,25 @@
}
result = adapter.getSchema();
return result;
- }
+ }
+
+ private URI getURI(String baseLocation)
+ {
+ URI uri = null;
+ if (baseLocation.startsWith("/"))
+ {
+ uri = URI.createPlatformResourceURI(baseLocation);
+ }
+ else if (baseLocation.startsWith("http"))
+ {
+ uri = URI.createURI(baseLocation);
+ }
+ else
+ {
+ uri = URI.createFileURI(baseLocation);
+ }
+ return uri;
+ }
}