]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl
Importing of spreadsheets
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / scl / Spreadsheet / All.scl
index 8898ce10a9a306d58b0ea796e6d96653987fd132..a6660e57bcfc8e0bdb089ca8221fd51943fdc773 100644 (file)
@@ -1,9 +1,13 @@
 include "Simantics/DB"
 include "Simantics/Ontologies"
 include "Simantics/SCL"
+include "Simantics/UI"
 include "Document/All"
 include "File"
 
+importJava "org.simantics.spreadsheet.graph.ExternalRef" where
+    data ExternalRef
+
 importJava "org.simantics.spreadsheet.common.TableCell" where
     data TableCell
 
@@ -41,6 +45,8 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where
     saveInitialCondition :: Variable -> Resource -> String -> <WriteGraph> Resource
     findCell :: Variable -> String -> <ReadGraph> Maybe Variable
     invalidateAll :: Variable -> <ReadGraph> ()
+    extRefVariable :: Variable -> <ReadGraph> Variant
+    extRefActiveVariable :: Variable -> <ReadGraph> Variant
 
 importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
     createSheet :: Resource -> String -> <WriteGraph> Resource
@@ -65,6 +71,11 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetSessionManager" where
 importJava "org.simantics.spreadsheet.graph.ExcelImport" where
     importBook :: Resource -> File -> <Proc> ()
 
+importSpreadsheetBookAction :: Resource -> <Proc> ()
+importSpreadsheetBookAction res = match fileDialog "foo" [("Excel file", "*.xls"), ("Excel File", "*.xlsx")] with
+  Nothing -> ()
+  Just file -> importBook res file
+
 createSpreadsheetBookAction :: Resource -> <Proc> ()
 createSpreadsheetBookAction res = do
   syncWrite (\() -> createSpreadsheetBookDefault res)