]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/BundleUtils.java
Editing of texts inside SVG elements
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / BundleUtils.java
index f3e3383f67cd8d5da36c519962e5084c9afa3570..62fd287c18f51458c0b6b4b79c6264601e87b8f0 100644 (file)
@@ -90,7 +90,7 @@ public final class BundleUtils {
     public static URL find(String bundleId, String path) {
         return find(Platform.getBundle(bundleId), path);
     }
-       
+
        public static File findFile(String bundleId, String path) throws IOException {
                URL url = find(bundleId, path);
                if (url == null)
@@ -98,5 +98,17 @@ public final class BundleUtils {
                url = FileLocator.toFileURL(url);
                return new File(url.getPath());
        }
-    
+
+    /**
+     * @since 1.31.0
+     */
+    public static File resolveWritableBundleFile(URL url) throws IOException {
+        // This returns file, jar, http etc. - essentially resolves the bundle protocol
+        URL resolved = FileLocator.resolve(url);
+        if (resolved.getProtocol().equals("file")) {
+            return new File(resolved.getPath());
+        }
+        return null;
+    }
+
 }