Skip to content
Snippets Groups Projects
Commit 0c52fced authored by Simon Barner's avatar Simon Barner
Browse files

- Base implementation of createBundleURI() into URI.createPlatformPluginURI()

- This is expected to create the right bundle URIs when the code is executed from a deployed bundle (in an RCP)
parent 6263354b
No related branches found
No related tags found
No related merge requests found
......@@ -18,12 +18,10 @@ $Id$
package org.fortiss.tooling.kernel.utils;
import java.io.IOException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
......@@ -42,7 +40,7 @@ import org.osgi.framework.Bundle;
* @author barner
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: F10473D1A1DE3292FC8190D97C636E71
* @ConQAT.Rating YELLOW Hash: C32245AE9177E3958D86E91CFA9926D1
*/
public abstract class EcoreSerializerBase<R extends EObject> {
......@@ -205,15 +203,16 @@ public abstract class EcoreSerializerBase<R extends EObject> {
/**
* Converts the given {@code bundlePathName} into a {@link URI} within the given {@link Bundle}.
*
* @throws IOException
* @param bundlePathName
* {@link Bundle}-relative path name
* @param bundle
* {@link Bundle} in which URI should be created
* @return URI to resource within the given {@link Bundle}.
*/
protected final URI createBundleURI(final String bundlePathName, final Bundle bundle)
throws IOException {
URL url = FileLocator.toFileURL(FileLocator.find(bundle, new Path(bundlePathName), null));
String pathName = url.getFile();
protected final URI createBundleURI(final String bundlePathName, final Bundle bundle) {
return URI.createFileURI(pathName);
return URI.createPlatformPluginURI(new Path(bundle.getSymbolicName())
.append(bundlePathName).toString(), true);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment