]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.fileimport/src/org/simantics/fileimport/SimanticsResourceFileImport.java
Updated file importer interface and fixed Spreadsheet import
[simantics/platform.git] / bundles / org.simantics.fileimport / src / org / simantics / fileimport / SimanticsResourceFileImport.java
index fed7b292ff52c0561a7225d99e79e51ac7dd86d9..67ff51dab9c029ae9ef7e1222bf83968058d220f 100644 (file)
@@ -29,7 +29,7 @@ import org.simantics.layer0.Layer0;
 public abstract class SimanticsResourceFileImport implements IGenericFileImport {
 
     @Override
-    final public Optional<String> perform(Path file) throws Exception {
+    final public Optional<String> performWithDefaultParent(Path file) throws Exception {
         
         Path dropins = Activator.getDropinsFolder();
         
@@ -40,9 +40,13 @@ public abstract class SimanticsResourceFileImport implements IGenericFileImport
                parts = file.getFileName();
         }
         
-        Resource parent = resolveParent(null, parts);
+        Resource parent = defaultParentResource();
+        if(parent == null)
+               parent = resolveParent(null, parts);
+        
         if (parent == null)
             return Optional.empty();
+        
         Optional<Resource> imported = perform(parent, file); 
         if (imported.isPresent()) {
             return Optional.of(serialize(imported.get()));
@@ -59,7 +63,6 @@ public abstract class SimanticsResourceFileImport implements IGenericFileImport
      * @return Optional Resource of the imported entity in Simantics database
      * @throws Exception
      */
-    public abstract Optional<Resource> perform(Resource parent, Path file) throws Exception;
     
     @Override
     public void remove(String resourceId) throws Exception {