From 7db836e2d27d5be0a122a917c0d4e5576b76cef0 Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Tue, 20 Nov 2018 06:33:51 +0200 Subject: [PATCH] Importing of spreadsheets Change-Id: Iea544cc26d9f2ab57f87e39d73e4b8a4e4a7d9ba --- .../graph/ModelingViewpoint.pgraph | 10 ++++++++++ .../scl/Spreadsheet/All.scl | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph b/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph index e3c551d0a..35bfa3a37 100644 --- a/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph +++ b/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph @@ -420,6 +420,13 @@ MOD.Contributions.NewSheetBook : VP.ActionContribution VP.ActionContribution.HasNodeType L0.Library VP.ActionContribution.HasAction ACTIONS.NewSheetBook +MOD.Contributions.ImportSheetBook : VP.ActionContribution + L0.HasLabel "Spreadsheet" + VP.ActionContribution.HasImage SILK.star + VP.ActionContribution.HasCategory VP.ImportActionCategory + VP.ActionContribution.HasNodeType L0.Library + VP.ActionContribution.HasAction ACTIONS.ImportSheetBook + MOD.Contributions.ActivateModel : VP.ActionContribution L0.HasLabel "Activate" VP.ActionContribution.HasImage SILK.bullet_go @@ -656,6 +663,7 @@ MAC VP.BrowseContext.SupportsRenamingOf MBC.Symbol VP.BrowseContext.HasActionContribution MOD.Contributions.NewSheetBook + MOD.Contributions.ImportSheetBook @VP.renamingTestContribution L0.SharedOntology @@ -695,6 +703,8 @@ ACTIONS.NewSCLQueryType @MOD.sclAction "createSCLQueryTypeAction" ACTIONS.NewSheetBook @MOD.sclAction "createSpreadsheetBookAction" +ACTIONS.ImportSheetBook + @MOD.sclAction "importSpreadsheetBookAction" ACTIONS.ActivateModel @MOD.sclAction "activateModelAction" ACTIONS.MigrateComponentType : ACT.Action diff --git a/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl b/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl index 9ca65f8d1..a6660e57b 100644 --- a/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl +++ b/bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl @@ -1,6 +1,7 @@ include "Simantics/DB" include "Simantics/Ontologies" include "Simantics/SCL" +include "Simantics/UI" include "Document/All" include "File" @@ -70,6 +71,11 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetSessionManager" where importJava "org.simantics.spreadsheet.graph.ExcelImport" where importBook :: Resource -> File -> () +importSpreadsheetBookAction :: Resource -> () +importSpreadsheetBookAction res = match fileDialog "foo" [("Excel file", "*.xls"), ("Excel File", "*.xlsx")] with + Nothing -> () + Just file -> importBook res file + createSpreadsheetBookAction :: Resource -> () createSpreadsheetBookAction res = do syncWrite (\() -> createSpreadsheetBookDefault res) -- 2.43.2