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=c64789605ca78d18be34fde44af7df37e988c0e0;hp=dfc237ab0f40ba5c4d6162497040bd1782db193b;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 47931cc4f..ad62313ec 100644 --- a/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph +++ b/bundles/org.simantics.modeling.ontology/graph/ModelingViewpoint.pgraph @@ -440,6 +440,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 @@ -676,6 +683,7 @@ MAC VP.BrowseContext.SupportsRenamingOf MBC.Symbol VP.BrowseContext.HasActionContribution MOD.Contributions.NewSheetBook + MOD.Contributions.ImportSheetBook @VP.renamingTestContribution L0.SharedOntology @@ -715,6 +723,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)