diff options
4 files changed, 47 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java index 90d59b16c2..b086a009ef 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java @@ -48,6 +48,8 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.spi.cdo.InternalCDOObject; import org.eclipse.emf.spi.cdo.InternalCDOView; +import org.eclipse.core.runtime.Path; + import java.io.File; import java.util.ArrayList; import java.util.HashSet; @@ -684,16 +686,15 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec public URI createResourceURI(String path) { + String authority = getID(); + if (StringUtil.isEmpty(path)) { - path = ""; - } - else if (!path.startsWith("/")) - { - path = "/" + path; + return URI.createHierarchicalURI(CDOCheckoutViewProvider.SCHEME, authority, null, null, null, null); } - return URI.createURI(CDOCheckoutViewProvider.SCHEME + "://" + getID() + path); + String[] segments = new Path(path).segments(); + return URI.createHierarchicalURI(CDOCheckoutViewProvider.SCHEME, authority, null, segments, null, null); } public String getEditorOpenerID(CDOID objectID) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java index fb8379b07a..2f18d54f73 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java @@ -133,6 +133,11 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, /** * @ADDED */ + private URI initialURI; + + /** + * @ADDED + */ private URI uri; /** @@ -190,7 +195,7 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, */ public CDOResourceImpl(URI initialURI) { - uri = initialURI; + this.initialURI = initialURI; } /** @@ -324,11 +329,21 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, private URI doGetURI() { + if (initialURI != null) + { + InternalCDOView view = cdoView(); + if (view == null || view.isClosed() || cdoID() == null) + { + return initialURI; + } + } + if (viewProvider != null) { InternalCDOView view = cdoView(); + String path = getPath(); - URI uri = viewProvider.getResourceURI(view, getPath()); + URI uri = viewProvider.getResourceURI(view, path); if (uri != null) { return uri; @@ -1197,9 +1212,9 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, { if (!isLoaded()) { - if (uri != null) + if (initialURI != null) { - String query = uri.query(); + String query = initialURI.query(); if (query != null && query.length() != 0) { Map<String, String> parameters = CDOURIUtil.getParameters(query); @@ -1741,6 +1756,11 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, return string + "(\"" + uri + "\")"; } + if (initialURI != null) + { + return string + "(\"" + initialURI + "\")"; + } + return super.toString(string); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java index 81423a8223..9485be0b05 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java @@ -25,6 +25,7 @@ import org.eclipse.net4j.util.ObjectUtil; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import org.eclipse.emf.spi.cdo.InternalCDOView; @@ -278,8 +279,15 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe public URI getURI() { InternalCDOView view = cdoView(); - URI uri = CDOURIUtil.createResourceURI(view, getPath()); - uri = view.getResourceSet().getURIConverter().normalize(uri); + String path = getPath(); + + URI uri = CDOURIUtil.createResourceURI(view, path); + if (uri != null) + { + URIConverter uriConverter = view.getResourceSet().getURIConverter(); + uri = uriConverter.normalize(uri); + } + return uri; } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java index a64853cf85..c2a6278e5b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java @@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.view.ManagedContainerViewProvider; import org.eclipse.emf.internal.cdo.session.CDOSessionFactory; +import org.eclipse.net4j.util.StringUtil; import org.eclipse.net4j.util.container.IManagedContainer; import org.eclipse.net4j.util.container.IPluginContainer; @@ -73,15 +74,16 @@ public class PluginContainerViewProvider extends ManagedContainerViewProvider @Override public URI getResourceURI(CDOView view, String path) { - if (path == null) + if (StringUtil.isEmpty(path)) { path = ""; } + else if (!path.startsWith("/")) + { + path = "/" + path; + } String authority = view.getSession().getRepositoryInfo().getUUID(); - // String[] segments = StringUtil.isEmpty(path) ? null : new Path(path).segments(); - // return URI.createHierarchicalURI(CDOURIUtil.PROTOCOL_NAME, authority, null, segments, null, null); - return URI.createURI(CDOURIUtil.PROTOCOL_NAME + "://" + authority + path); } |