]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Move contents of SCLMain in PlatformUI from pgraph to scl-file 50/3150/4
authorAntti Villberg <antti.villberg@semantum.fi>
Sun, 25 Aug 2019 10:35:15 +0000 (13:35 +0300)
committerAntti Villberg <antti.villberg@semantum.fi>
Sun, 25 Aug 2019 11:31:44 +0000 (14:31 +0300)
gitlab #361

Change-Id: I45fa44cc708a0292b0b68dfe2015cd4aef3e462a

bundles/org.simantics.modeling.ui/scl/Simantics/Testing/BrowseContext.scl
bundles/org.simantics.modeling/scl/Simantics/Ontologies.scl
bundles/org.simantics.platform.ui.ontology/build.properties
bundles/org.simantics.platform.ui.ontology/graph/PlatformUI.pgraph
bundles/org.simantics.platform.ui.ontology/scl/Simantics/PlatformUI.scl [moved from bundles/org.simantics.platform.ui.ontology/graph/scl/SCLMain.scl with 54% similarity]

index 590ddd21ce8f658d40b133dd6cb0fddd3be8607d..d051042d5f4258b6c92acbace7b52eeec2a9114b 100644 (file)
@@ -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 -> <ReadGraph> (Resource -> <ReadGraph> Boolean)
 instanceOfTest self = do
   typeResource = singleObject (represents $ parent self) MOD.InstanceOfTest.HasType
   (\r -> isInstanceOf r typeResource) 
+
+type BrowseNodeRule a = VariableOrResource -> <ReadGraph,Proc> a  
+  
\ No newline at end of file
index 30a482ffc6d068cfcbc45bdd93dba4490a081c52..6a1ed98425149af507f17e6ab3360df7e40d35b1 100644 (file)
@@ -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
index cda1dacf966eb0b731d8df17785754decdbc2b0d..0a96411a7e286c5cfcbdf337444a7d29929746a3 100644 (file)
@@ -2,5 +2,6 @@ source.. = src/
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               graph.tg
+               graph.tg,\
+               scl/
 src.includes = graph/
index 11b07f80eba5ab9520a20a9582a9f3d0d47fb0af..78f9204cf4b1070b838c1ca1f19941d6b6fb0e29 100644 (file)
@@ -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 = <http://www.simantics.org/Layer0-1.1>
 PROJECT = <http://www.simantics.org/Project-1.2>
 MOD = <http://www.simantics.org/Modeling-1.2>
@@ -17,8 +29,7 @@ PlatformUI = <http://www.simantics.org/PlatformUI-1.0> : 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 <T L0.String
     @L0.tag L0.Enumeration
similarity index 54%
rename from bundles/org.simantics.platform.ui.ontology/graph/scl/SCLMain.scl
rename to bundles/org.simantics.platform.ui.ontology/scl/Simantics/PlatformUI.scl
index 44c53d80e4cfa35e9320f51ae3b93227eac94dbe..07309cb7b2876ea7a233439edea2e57d00e5c0d9 100644 (file)
@@ -1,5 +1,19 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
 include "Simantics/All"
 include "SWT/All"
+import "UI/Progress"
+import "Simantics/IssueUI"
 
 useSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> 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 -> <Proc> Maybe CommandResult
+configureButtonClickHandler indexRoot context = do
+    showIssueConfigurationDialog indexRoot 
+    Nothing
+      
+configureButtonClick :: Variable -> <ReadGraph,Proc> AbstractEventHandler
+configureButtonClick self = do
+  indexRoot = represents $ contextVariable self
+  eventHandler2 $ configureButtonClickHandler indexRoot
+
+validateButtonClickHandler :: Resource -> CommandContext -> <Proc> Maybe CommandResult
+validateButtonClickHandler indexRoot context = do
+    runActiveValidations (createNullProgressMonitor ()) indexRoot
+    Nothing
+
+validateButtonClick :: Variable -> <ReadGraph,Proc> AbstractEventHandler
+validateButtonClick self = do
+  indexRoot = represents $ contextVariable self
+  eventHandler2 $ validateButtonClickHandler indexRoot
+
+issueSourceExplorerCheckHandler :: Resource -> CommandContext -> <Proc> 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 -> <ReadGraph,Proc> AbstractEventHandler
+issueSourceExplorerCheck self = do
+  indexRoot = represents $ contextVariable self
+  eventHandler2 $ issueSourceExplorerCheckHandler indexRoot
+
+usedIssueSources :: Resource -> <ReadGraph> [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