From 101c20793101bccac5da5fdc68118f0cae613718 Mon Sep 17 00:00:00 2001 From: miettinen Date: Wed, 20 Feb 2013 12:17:18 +0000 Subject: [PATCH] Added the new function icons to the functions under the model browser as well (refs #4086). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26820 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../contributions/AbstractNodeImager.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java index 7d94c4d5..805ab140 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java @@ -36,6 +36,7 @@ import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode; import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode; import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder; import org.simantics.sysdyn.ui.browser.nodes.FunctionLibraryNode; +import org.simantics.sysdyn.ui.browser.nodes.FunctionNode; import org.simantics.sysdyn.ui.browser.nodes.FunctionsFolder; import org.simantics.sysdyn.ui.browser.nodes.InputNode; import org.simantics.sysdyn.ui.browser.nodes.ModelNode; @@ -81,7 +82,28 @@ public class AbstractNodeImager extends ImagerContributor image = "icons/brick_link.png"; else if (node instanceof ModelNode) image = "icons/chart_organisation.png"; - else if (node instanceof VariableNode) + else if (node instanceof FunctionNode) { + Layer0 l0 = Layer0.getInstance(graph); + SysdynResource sr = SysdynResource.getInstance(graph); + if (graph.hasStatement(node.data, l0.PartOf, sr.Built$in_Functions)) { + // Sysdyn functions + image = "icons/sysdynFunction.png"; + } else if (graph.hasStatement(node.data, l0.PartOf, sr.Built$in_Functions_Modelica_Functions)) { + image = "icons/modelicaFunction.png"; + } else if (graph.hasStatement(node.data, l0.PartOf, sr.Built$in_Functions_Modelica_Array_Functions)) { + image = "icons/modelicaArrayFunction.png"; + } else if (graph.hasStatement(node.data, l0.PartOf, sr.Built$in_Functions_Vensim_Functions)) { + image = "icons/vensimFunction.png"; + } else { + Resource r = graph.getPossibleObject(node.data, l0.PartOf); + if (r != null && graph.isInstanceOf(r, sr.SharedFunctionOntology)) { + image = "icons/functionLink.png"; + } else { + image = "icons/function.png"; + } + } + } else if (node instanceof VariableNode) + // Must be queried after FunctionNode image = "icons/brick.png"; else if (node instanceof BookNode) image = "icons/table_multiple.png"; -- 2.47.1