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%2FSimanticsResourceFileImport.java;h=67ff51dab9c029ae9ef7e1222bf83968058d220f;hp=fed7b292ff52c0561a7225d99e79e51ac7dd86d9;hb=664f37a026967c90a9a8a4ef3c5336ee426f67aa;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.fileimport/src/org/simantics/fileimport/SimanticsResourceFileImport.java b/bundles/org.simantics.fileimport/src/org/simantics/fileimport/SimanticsResourceFileImport.java index fed7b292f..67ff51dab 100644 --- a/bundles/org.simantics.fileimport/src/org/simantics/fileimport/SimanticsResourceFileImport.java +++ b/bundles/org.simantics.fileimport/src/org/simantics/fileimport/SimanticsResourceFileImport.java @@ -29,7 +29,7 @@ import org.simantics.layer0.Layer0; public abstract class SimanticsResourceFileImport implements IGenericFileImport { @Override - final public Optional perform(Path file) throws Exception { + final public Optional 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 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 perform(Resource parent, Path file) throws Exception; @Override public void remove(String resourceId) throws Exception {