From 920856257841273193c640607e735f5adf09031d Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Sun, 25 Aug 2019 13:35:15 +0300 Subject: [PATCH] Move contents of SCLMain in PlatformUI from pgraph to scl-file gitlab #361 Change-Id: I45fa44cc708a0292b0b68dfe2015cd4aef3e462a --- .../scl/Simantics/Testing/BrowseContext.scl | 6 ++ .../scl/Simantics/Ontologies.scl | 4 +- .../build.properties | 3 +- .../graph/PlatformUI.pgraph | 15 ++++- .../Simantics/PlatformUI.scl} | 60 ++++++++++++++++++- 5 files changed, 83 insertions(+), 5 deletions(-) rename bundles/org.simantics.platform.ui.ontology/{graph/scl/SCLMain.scl => scl/Simantics/PlatformUI.scl} (54%) diff --git a/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl b/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl index 590ddd21c..d051042d5 100644 --- a/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl +++ b/bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl @@ -111,6 +111,9 @@ importJava "org.simantics.browsing.ui.content.LabelDecorator" where importJava "org.simantics.browsing.ui.CheckedState" where data CheckedState + CHECKED :: CheckedState + GRAYED :: CheckedState + NOT_CHECKED :: CheckedState importJava "org.simantics.browsing.ui.content.Labeler$Modifier" where data Modifier @@ -138,3 +141,6 @@ instanceOfTest :: Variable -> (Resource -> Boolean) instanceOfTest self = do typeResource = singleObject (represents $ parent self) MOD.InstanceOfTest.HasType (\r -> isInstanceOf r typeResource) + +type BrowseNodeRule a = VariableOrResource -> a + \ No newline at end of file diff --git a/bundles/org.simantics.modeling/scl/Simantics/Ontologies.scl b/bundles/org.simantics.modeling/scl/Simantics/Ontologies.scl index 30a482ffc..6a1ed9842 100644 --- a/bundles/org.simantics.modeling/scl/Simantics/Ontologies.scl +++ b/bundles/org.simantics.modeling/scl/Simantics/Ontologies.scl @@ -1,6 +1,7 @@ include "Simantics/DB" include "http://www.simantics.org/Layer0-1.1" as L0 +include "http://www.simantics.org/Layer0X-1.1" as L0X include "http://www.simantics.org/Structural-1.2" as STR include "http://www.simantics.org/Diagram-2.2" as DIA include "http://www.simantics.org/Modeling-1.2" as MOD @@ -10,4 +11,5 @@ include "http://www.simantics.org/Spreadsheet-1.2" as SHEET include "http://www.simantics.org/Image2-1.2" as IMAGE include "http://www.simantics.org/Document-1.2" as DOCUMENT include "http://www.simantics.org/Event-1.2" as EVENT -include "http://www.simantics.org/Project-1.2" as PROJECT \ No newline at end of file +include "http://www.simantics.org/Project-1.2" as PROJECT +include "http://www.simantics.org/Issue-1.2" as ISSUE diff --git a/bundles/org.simantics.platform.ui.ontology/build.properties b/bundles/org.simantics.platform.ui.ontology/build.properties index cda1dacf9..0a96411a7 100644 --- a/bundles/org.simantics.platform.ui.ontology/build.properties +++ b/bundles/org.simantics.platform.ui.ontology/build.properties @@ -2,5 +2,6 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - graph.tg + graph.tg,\ + scl/ src.includes = graph/ diff --git a/bundles/org.simantics.platform.ui.ontology/graph/PlatformUI.pgraph b/bundles/org.simantics.platform.ui.ontology/graph/PlatformUI.pgraph index 11b07f80e..78f9204cf 100644 --- a/bundles/org.simantics.platform.ui.ontology/graph/PlatformUI.pgraph +++ b/bundles/org.simantics.platform.ui.ontology/graph/PlatformUI.pgraph @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2019 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - reorganization + *******************************************************************************/ L0 = PROJECT = MOD = @@ -17,8 +29,7 @@ PlatformUI = : L0.Ontology L0.IsLinkedTo MOD PlatformUI.SCLMain : L0.SCLModule - L0.SCLModule.definition _ : L0.String - @L0.loadString "scl/SCLMain.scl" + L0.SCLModule.definition """ include "Simantics/PlatformUI" """ PlatformUI.NameLabelMode (String -> Maybe String) -> String useSelectedHandler input parameters = do @@ -84,4 +98,48 @@ standardPropertiesElementTransformation var = do Nothing -> var Just component -> resourceVariable component else var - \ No newline at end of file + +configureButtonClickHandler :: Resource -> CommandContext -> Maybe CommandResult +configureButtonClickHandler indexRoot context = do + showIssueConfigurationDialog indexRoot + Nothing + +configureButtonClick :: Variable -> AbstractEventHandler +configureButtonClick self = do + indexRoot = represents $ contextVariable self + eventHandler2 $ configureButtonClickHandler indexRoot + +validateButtonClickHandler :: Resource -> CommandContext -> Maybe CommandResult +validateButtonClickHandler indexRoot context = do + runActiveValidations (createNullProgressMonitor ()) indexRoot + Nothing + +validateButtonClick :: Variable -> AbstractEventHandler +validateButtonClick self = do + indexRoot = represents $ contextVariable self + eventHandler2 $ validateButtonClickHandler indexRoot + +issueSourceExplorerCheckHandler :: Resource -> CommandContext -> Maybe CommandResult +issueSourceExplorerCheckHandler indexRoot context = match possibleValue context "item" with + Nothing -> Nothing + Just issueSource -> match possibleValue context "checked" with + Nothing -> Nothing + Just value -> if value then do + syncWrite $ \_ -> claim issueSource ISSUE.IssueSource.Selected (parent issueSource) + Nothing + else do + syncWrite $ \_ -> denyByPredicate issueSource ISSUE.IssueSource.Selected + Nothing + +issueSourceExplorerCheck :: Variable -> AbstractEventHandler +issueSourceExplorerCheck self = do + indexRoot = represents $ contextVariable self + eventHandler2 $ issueSourceExplorerCheckHandler indexRoot + +usedIssueSources :: Resource -> [Resource] +usedIssueSources indexRoot = do + objectsWithType indexRoot L0.ConsistsOf ISSUE.IssueSource + +checkedStateRule :: BrowseNodeRule CheckedState +checkedStateRule (ResourceX r) = if existsStatement3 r ISSUE.IssueSource.Selected (parent r) then CHECKED else NOT_CHECKED + \ No newline at end of file -- 2.47.1