]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.spreadsheet.fileimport/src/org/simantics/spreadsheet/fileimport/ExcelFileImport.java
Some fixes for FileImportService to throw exceptions forward
[simantics/platform.git] / bundles / org.simantics.spreadsheet.fileimport / src / org / simantics / spreadsheet / fileimport / ExcelFileImport.java
1 package org.simantics.spreadsheet.fileimport;
2
3 import java.nio.file.Path;
4 import java.util.HashMap;
5 import java.util.Map;
6 import java.util.Optional;
7
8 import org.simantics.db.Resource;
9 import org.simantics.fileimport.SimanticsResourceFileImport;
10
11 public class ExcelFileImport extends SimanticsResourceFileImport {
12
13     private static final Map<String, String> ALLOWED_EXTENSIONS = new HashMap<>(2);
14     
15     static {
16         ALLOWED_EXTENSIONS.put("*.xls", "Excel file *.xls");
17         ALLOWED_EXTENSIONS.put("*.xlsx", "Excel file *.xlsx");
18     }
19     
20     @Override
21     public Optional<Resource> perform(Resource parent, Path file) throws Exception {
22         throw new UnsupportedOperationException("Excel import is not yet supported");
23     }
24
25     @Override
26     public Map<String, String> allowedExtensionsWithFilters() {
27         return ALLOWED_EXTENSIONS;
28     }
29
30 }