From: Antti Villberg Date: Tue, 20 Nov 2018 04:33:51 +0000 (+0200) Subject: Importing of spreadsheets X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=da92dd106dd081312f75d6f2ec04269e98d730f4;p=simantics%2Fplatform.git Importing of spreadsheets Change-Id: Iea544cc26d9f2ab57f87e39d73e4b8a4e4a7d9ba --- 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)