1 package org.simantics.fileimport;
3 import java.nio.file.Path;
4 import java.util.Collections;
6 import java.util.Optional;
8 import org.simantics.Simantics;
9 import org.simantics.db.Resource;
10 import org.simantics.graphfile.util.GraphFileUtil;
12 public class FileReferenceFileImport extends SimanticsResourceFileImport {
14 private static final Map<String, String> ALLOWED_EXTENSIONS = Collections.singletonMap("*", "All files");
17 public Optional<Resource> perform(Resource parent, Path file) throws Exception {
18 return Optional.of(GraphFileUtil.createFileReference(parent, file));
22 public Map<String, String> allowedExtensionsWithFilters() {
23 return ALLOWED_EXTENSIONS;
27 public Resource defaultParentResource() {
28 return Simantics.getProjectResource();