From bb748eb026b3cf850bc5eebfe411ead8615b9e3b Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Thu, 20 Apr 2017 13:25:59 +0300 Subject: [PATCH] Fix RFileImport refs #7154 Change-Id: I9e8773b0c6ec7ea4869826e20f36afae0c6c8f71 --- .../META-INF/MANIFEST.MF | 3 +- .../simantics/r/fileimport/RFileImport.java | 58 ++++++++++--------- 2 files changed, 34 insertions(+), 27 deletions(-) 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(); + } + +} -- 2.47.1