--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+ <classpathentry kind="src" path="src"/>\r
+ <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.simantics.r.fileimport</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ManifestBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.SchemaBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ds.core.builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.pde.PluginNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.8\r
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Fileimport
+Bundle-SymbolicName: org.simantics.r.fileimport
+Bundle-Version: 1.0.0.qualifier
+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
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/component.xml
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.simantics.r.fileimport">\r
+ <implementation class="org.simantics.r.fileimport.RFileImport"/>\r
+ <service>\r
+ <provide interface="org.simantics.fileimport.IGenericFileImport"/>\r
+ </service>\r
+</scr:component>\r
--- /dev/null
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+ .,\\r
+ OSGI-INF/component.xml\r
+source.. = src/\r
--- /dev/null
+package org.simantics.r.fileimport;\r
+\r
+import org.osgi.framework.BundleActivator;\r
+import org.osgi.framework.BundleContext;\r
+\r
+public class Activator implements BundleActivator {\r
+\r
+ private static BundleContext context;\r
+\r
+ static BundleContext getContext() {\r
+ return context;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)\r
+ */\r
+ public void start(BundleContext bundleContext) throws Exception {\r
+ Activator.context = bundleContext;\r
+ }\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)\r
+ */\r
+ public void stop(BundleContext bundleContext) throws Exception {\r
+ Activator.context = null;\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.simantics.r.fileimport;\r
+\r
+import java.nio.file.Path;\r
+import java.util.Collections;\r
+import java.util.Map;\r
+import java.util.Optional;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.fileimport.SimanticsResourceFileImport;\r
+import org.simantics.r.RModelUtils;\r
+\r
+public class RFileImport extends SimanticsResourceFileImport {\r
+\r
+ private static final Map<String, String> ALLOWED_EXTENSIONS = Collections.singletonMap("*.r", "R-file (*.r)");\r
+ \r
+ @Override\r
+ public Optional<Resource> perform(Resource parent, Path file) {\r
+ return Optional.ofNullable(RModelUtils.createRModel(parent, file));\r
+ }\r
+\r
+ @Override\r
+ public Map<String, String> allowedExtensionsWithFilters() {\r
+ return ALLOWED_EXTENSIONS;\r
+ }\r
+\r
+}\r