}
@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
public Resource defaultParentResource() {
- return Simantics.getSession().getRootLibrary();
+ return null;
}
}