]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.fileimport/src/org/simantics/spreadsheet/fileimport/ExcelFileImport.java
Updated file importer interface and fixed Spreadsheet import
[simantics/platform.git] / bundles / org.simantics.spreadsheet.fileimport / src / org / simantics / spreadsheet / fileimport / ExcelFileImport.java
index c3a84f7a4ef6cf0709f17b0e494b376b4bbc05a4..d1f8924a58b5c245c6b450d4b6c33769bf81999d 100644 (file)
@@ -20,8 +20,13 @@ public class ExcelFileImport extends SimanticsResourceFileImport {
     }
     
     @Override
     }
     
     @Override
-    public Optional<Resource> perform(Resource parent, Path file) throws Exception {
-        return Optional.ofNullable(ExcelImport.importBookR(parent, file.toFile()));
+    public Optional<Resource> perform(Resource possibleSelection, Path file) throws Exception {
+       if(possibleSelection != null) {
+               //Make sure the selection is of valid type here
+               return Optional.ofNullable(ExcelImport.importBookR(possibleSelection, file.toFile()));
+       } else {
+               throw new NullPointerException("No selection provided - Cannot import book");
+       }
     }
 
     @Override
     }
 
     @Override
@@ -31,7 +36,7 @@ public class ExcelFileImport extends SimanticsResourceFileImport {
 
     @Override
     public Resource defaultParentResource() {
 
     @Override
     public Resource defaultParentResource() {
-        return Simantics.getSession().getRootLibrary();
+        return null;
     }
 
 }
     }
 
 }