X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.fileimport%2Fsrc%2Forg%2Fsimantics%2Ffileimport%2FIGenericFileImport.java;h=16df3ab457dd84b4b5217518b2b83c907a61f000;hp=a8bb132c98f8245013d250d5fd2f8c3f44e6e113;hb=664f37a026967c90a9a8a4ef3c5336ee426f67aa;hpb=5915c1bbd6d0c6125aa3c815c7843339190f28e4 diff --git a/bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java b/bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java index a8bb132c9..16df3ab45 100644 --- a/bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java +++ b/bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java @@ -18,14 +18,15 @@ import org.simantics.db.Resource; public interface IGenericFileImport { /** - * Performs the import for the given file + * Performs the import for the given file, using the default parent defined in the file-specific import implementation + * Calls perform(parent, file) with the defaultParent it finds * * @param file Path to file to import * @return Optional string which will be the identifier of the imported file which can later be used for removing the imported entity * @throws Exception */ - Optional perform(Path file) throws Exception; - + Optional performWithDefaultParent(Path file) throws Exception; + Optional perform(Resource parent, Path file) throws Exception; /** @@ -42,4 +43,11 @@ public interface IGenericFileImport { */ Map allowedExtensionsWithFilters(); + /** + * Choose the default parent resource in the specific implementations of the importer + * Can be null, in which case the default parent must always be provided from a selection UI or explicitly defined + * @return + */ + public abstract Resource defaultParentResource(); + }