]> gerrit.simantics Code Review - simantics/r.git/commitdiff
Fix RFileImport 37/437/2
authorjsimomaa <jani.simomaa@gmail.com>
Thu, 20 Apr 2017 10:25:59 +0000 (13:25 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 22 Apr 2017 15:16:19 +0000 (18:16 +0300)
refs #7154

Change-Id: I9e8773b0c6ec7ea4869826e20f36afae0c6c8f71

bundles/org.simantics.r.fileimport/META-INF/MANIFEST.MF
bundles/org.simantics.r.fileimport/src/org/simantics/r/fileimport/RFileImport.java

index a997db9c012f726964ddb90d6373adcc01ead63a..714ad7298b8dce8991fb3b6b4344ba71c9e33d2d 100644 (file)
@@ -7,7 +7,8 @@ Bundle-Activator: org.simantics.r.fileimport.Activator
 Require-Bundle: org.eclipse.core.runtime,
  org.simantics.fileimport,
  org.simantics.r;bundle-version="0.1.0",
- org.simantics.db
+ org.simantics.db,
+ org.simantics
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Service-Component: OSGI-INF/component.xml
index 21eed6053c5eebb467dfb48a43a4cc8292fe2979..f68594edd2c6a82739471fa82772319a2c322614 100644 (file)
@@ -1,26 +1,32 @@
-package org.simantics.r.fileimport;\r
-\r
-import java.nio.file.Path;\r
-import java.util.Collections;\r
-import java.util.Map;\r
-import java.util.Optional;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.fileimport.SimanticsResourceFileImport;\r
-import org.simantics.r.RModelUtils;\r
-\r
-public class RFileImport extends SimanticsResourceFileImport {\r
-\r
-    private static final Map<String, String> ALLOWED_EXTENSIONS = Collections.singletonMap("*.r", "R-file (*.r)");\r
-    \r
-    @Override\r
-    public Optional<Resource> perform(Resource parent, Path file) {\r
-        return Optional.ofNullable(RModelUtils.createRModel(parent, file));\r
-    }\r
-\r
-    @Override\r
-    public Map<String, String> allowedExtensionsWithFilters() {\r
-        return ALLOWED_EXTENSIONS;\r
-    }\r
-\r
-}\r
+package org.simantics.r.fileimport;
+
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+
+import org.simantics.Simantics;
+import org.simantics.db.Resource;
+import org.simantics.fileimport.SimanticsResourceFileImport;
+import org.simantics.r.RModelUtils;
+
+public class RFileImport extends SimanticsResourceFileImport {
+
+    private static final Map<String, String> ALLOWED_EXTENSIONS = Collections.singletonMap("*.r", "R-file (*.r)");
+    
+    @Override
+    public Optional<Resource> perform(Resource parent, Path file) {
+        return Optional.ofNullable(RModelUtils.createRModel(parent, file));
+    }
+
+    @Override
+    public Map<String, String> allowedExtensionsWithFilters() {
+        return ALLOWED_EXTENSIONS;
+    }
+
+    @Override
+    public Resource defaultParentResource() {
+        return Simantics.getProjectResource();
+    }
+
+}