From: jsimomaa Date: Thu, 20 Apr 2017 10:25:59 +0000 (+0300) Subject: Fix RFileImport X-Git-Tag: v1.29.0~2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F437%2F2;p=simantics%2Fr.git Fix RFileImport refs #7154 Change-Id: I9e8773b0c6ec7ea4869826e20f36afae0c6c8f71 --- diff --git a/bundles/org.simantics.r.fileimport/META-INF/MANIFEST.MF b/bundles/org.simantics.r.fileimport/META-INF/MANIFEST.MF index a997db9..714ad72 100644 --- a/bundles/org.simantics.r.fileimport/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.r.fileimport/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Bundle-Activator: org.simantics.r.fileimport.Activator Require-Bundle: org.eclipse.core.runtime, org.simantics.fileimport, org.simantics.r;bundle-version="0.1.0", - org.simantics.db + org.simantics.db, + org.simantics Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/component.xml diff --git a/bundles/org.simantics.r.fileimport/src/org/simantics/r/fileimport/RFileImport.java b/bundles/org.simantics.r.fileimport/src/org/simantics/r/fileimport/RFileImport.java index 21eed60..f68594e 100644 --- a/bundles/org.simantics.r.fileimport/src/org/simantics/r/fileimport/RFileImport.java +++ b/bundles/org.simantics.r.fileimport/src/org/simantics/r/fileimport/RFileImport.java @@ -1,26 +1,32 @@ -package org.simantics.r.fileimport; - -import java.nio.file.Path; -import java.util.Collections; -import java.util.Map; -import java.util.Optional; - -import org.simantics.db.Resource; -import org.simantics.fileimport.SimanticsResourceFileImport; -import org.simantics.r.RModelUtils; - -public class RFileImport extends SimanticsResourceFileImport { - - private static final Map ALLOWED_EXTENSIONS = Collections.singletonMap("*.r", "R-file (*.r)"); - - @Override - public Optional perform(Resource parent, Path file) { - return Optional.ofNullable(RModelUtils.createRModel(parent, file)); - } - - @Override - public Map allowedExtensionsWithFilters() { - return ALLOWED_EXTENSIONS; - } - -} +package org.simantics.r.fileimport; + +import java.nio.file.Path; +import java.util.Collections; +import java.util.Map; +import java.util.Optional; + +import org.simantics.Simantics; +import org.simantics.db.Resource; +import org.simantics.fileimport.SimanticsResourceFileImport; +import org.simantics.r.RModelUtils; + +public class RFileImport extends SimanticsResourceFileImport { + + private static final Map ALLOWED_EXTENSIONS = Collections.singletonMap("*.r", "R-file (*.r)"); + + @Override + public Optional perform(Resource parent, Path file) { + return Optional.ofNullable(RModelUtils.createRModel(parent, file)); + } + + @Override + public Map allowedExtensionsWithFilters() { + return ALLOWED_EXTENSIONS; + } + + @Override + public Resource defaultParentResource() { + return Simantics.getProjectResource(); + } + +}