]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Better structure, context menus and icons to model browser
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 18 May 2010 11:05:53 +0000 (11:05 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 18 May 2010 11:05:53 +0000 (11:05 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@15769 ac1ea38d-2e2b-0410-8846-a27921b304fc

18 files changed:
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/icons/brick.png [new file with mode: 0644]
org.simantics.sysdyn.ui/icons/chart_organisation.png [new file with mode: 0644]
org.simantics.sysdyn.ui/icons/folder.png [new file with mode: 0644]
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationImager.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiments.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentsImager.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelChildren.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelImager.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/OperatingInterfaces.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableImager.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ConfigurationNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynDiagramEditor.java

index fda0571f19321cc846fd43a2b0b875d4c17b2900..62f8e6df267677ba1624d941d9798ed37c040c96 100644 (file)
@@ -25,5 +25,5 @@
                        <graph />\r
                        <this />\r
                </type>\r
-       </target>\r      \r       <target\r                interface="org.simantics.sysdyn.ui.browser.nodes.AbstractNode">\r                <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                  class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r                       <this />\r               </type>\r                \r               <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/Variable"\r                     class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r                    <this />\r               </type>\r        </target>\r      \r
+       </target>\r      \r       <target\r                interface="org.simantics.sysdyn.ui.browser.nodes.AbstractNode">\r                <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                  class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r                       <this />\r               </type>\r                \r               <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/IndependentVariable"\r                  class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r                    <this />\r               </type>\r        </target>\r      \r
 </adapters>
\ No newline at end of file
diff --git a/org.simantics.sysdyn.ui/icons/brick.png b/org.simantics.sysdyn.ui/icons/brick.png
new file mode 100644 (file)
index 0000000..7851cf3
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/brick.png differ
diff --git a/org.simantics.sysdyn.ui/icons/chart_organisation.png b/org.simantics.sysdyn.ui/icons/chart_organisation.png
new file mode 100644 (file)
index 0000000..c32d25c
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/chart_organisation.png differ
diff --git a/org.simantics.sysdyn.ui/icons/folder.png b/org.simantics.sysdyn.ui/icons/folder.png
new file mode 100644 (file)
index 0000000..784e8fa
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/folder.png differ
index 39699954ddadd63931ea701b31f29529c01e3528..5fd3e91f1e1ffd0d439c043212e437a7106ddbdc 100644 (file)
             <with\r
                   variable="selection">\r
                <test\r
-                     args="http://www.simantics.org/Sysdyn-1.0/Configuration"\r
-                     property="org.simantics.graph.resourceType">\r
+                     args="org.simantics.sysdyn.ui.browser.nodes.ModelNode"\r
+                     property="org.simantics.sysdyn.ui.nodeClass">\r
                </test>\r
             </with>\r
          </activeWhen>\r
             <with\r
                   variable="selection">\r
                <test\r
-                     args="http://www.simantics.org/Sysdyn-1.0/Configuration"\r
-                     property="org.simantics.graph.resourceType">\r
+                     args="org.simantics.sysdyn.ui.browser.nodes.ModelNode"\r
+                     property="org.simantics.sysdyn.ui.nodeClass">\r
                </test>\r
             </with>\r
          </activeWhen>\r
          point="org.simantics.browsing.ui.common.viewpointContributionBinding">\r
       <binding\r
             browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
-         <implementation\r
-               class="org.simantics.sysdyn.ui.browser.contributions.Configuration"\r
-               preference="1.0">\r
-         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.Variable"\r
                preference="1.0">\r
          </implementation>\r
-         <implementation\r
-               class="org.simantics.sysdyn.ui.browser.contributions.Experiments"\r
-               preference="1.0">\r
-         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.Model"\r
                preference="1.0">\r
          </implementation>\r
          <implementation\r
-               class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfaces"\r
-               preference="1.0">\r
+               class="org.simantics.sysdyn.ui.browser.contributions.ModelChildren"\r
+               preference="2.0">\r
          </implementation>\r
       </binding>\r
    </extension>\r
             browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ConfigurationLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
          </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.VariableLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
          </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ExperimentsLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
          </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ModelLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
          </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ModulesLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
          </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.OperatingInterfacesLabeler"\r
-               preference="1.0">\r
+               preference="2.0">\r
+         </implementation>\r
+      </binding>\r
+   </extension>\r
+   <extension\r
+         point="org.simantics.browsing.ui.common.imagerBinding">\r
+      <binding\r
+            browseContext="http://www.simantics.org/Sysdyn-1.0/Browser">\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.AbstractNodeImager"\r
+               preference="2.0">\r
+         </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.ModelImager"\r
+               preference="2.0">\r
+         </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.ConfigurationImager"\r
+               preference="2.0">\r
+         </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.VariableImager"\r
+               preference="2.0">\r
          </implementation>\r
       </binding>\r
+   </extension>\r
+   <extension\r
+         point="org.eclipse.core.expressions.propertyTesters">\r
+      <propertyTester\r
+            class="org.simantics.browsing.ui.swt.NodePropertyTester"\r
+            id="org.simantics.browsing.ui.nodePropertyTester"\r
+            namespace="org.simantics.sysdyn.ui"\r
+            properties="nodeClass"\r
+            type="org.eclipse.jface.viewers.IStructuredSelection">\r
+      </propertyTester>\r
    </extension>
 </plugin>\r
index 20d0e65b6c9f3b595bd5f4949ab7921970cf8904..54140cc4541d7b9f8eb01d13f27f0e8690532298 100644 (file)
@@ -23,6 +23,9 @@ public class Activator extends AbstractUIPlugin {
 \r
     // The plug-in ID\r
     public static final String PLUGIN_ID = "org.simantics.sysdyn.ui";\r
+    \r
+    // The shared instance\r
+    private static Activator plugin;\r
 \r
     @Override\r
     public void start(BundleContext context) throws Exception {\r
@@ -31,6 +34,16 @@ public class Activator extends AbstractUIPlugin {
             new ConsoleAppender(new SimpleLayout());\r
         BasicConfigurator.configure(appender);\r
         Logger.getRootLogger().setLevel(Level.WARN);\r
+        plugin = this;\r
+    }\r
+    \r
+    @Override\r
+    public void stop(BundleContext context) throws Exception {\r
+        plugin = null;\r
+        super.stop(context);\r
     }\r
 \r
+    public static Activator getDefault() {\r
+        return plugin;\r
+    }\r
 }\r
index f055782507e2d4bdea81464af68eb6e1dd7cff10..977d54e8f4be77888a6ee676503d09dec3f043dd 100644 (file)
@@ -15,17 +15,23 @@ import org.eclipse.jface.resource.ImageDescriptor;
 import org.simantics.browsing.ui.swt.ImagerContributor;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.Activator;\r
 import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.ui.icons.ImageDescriptorProvider;\r
+import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
 \r
 public class AbstractNodeImager extends ImagerContributor<AbstractNode> {\r
 \r
     @Override\r
     public ImageDescriptor getDescriptor(ReadGraph graph, AbstractNode node) throws DatabaseException {\r
-        if (!graph.hasStatement(node.resource))\r
-            return null;\r
-        ImageDescriptorProvider provider = graph.adapt(node.resource, ImageDescriptorProvider.class);\r
-        return provider != null ? provider.get() : null;\r
+        \r
+        if (node instanceof ExperimentsFolder || \r
+                node instanceof OperatingInterfacesFolder || \r
+                node instanceof ModulesNode)\r
+            return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/folder.png"));\r
+            \r
+        return null;\r
     }\r
 \r
 }\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java
deleted file mode 100644 (file)
index 171280e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.sysdyn.ui.browser.contributions;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class Configuration extends ViewpointContributor<ModelNode> {\r
-\r
-    @Override\r
-    public Collection<?> getContribution(ReadGraph graph, ModelNode model)\r
-    throws DatabaseException {\r
-        return new DataContainer<AbstractNode>(new ConfigurationNode(\r
-                graph.getSingleObject(\r
-                        model.resource, \r
-                        graph.getBuiltins().HasConfiguration))\r
-        );\r
-\r
-    }\r
-\r
-    @Override\r
-    public String getViewpointId() {\r
-        return "Standard";\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationImager.java
new file mode 100644 (file)
index 0000000..e8f1f91
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
+\r
+public class ConfigurationImager extends ImagerContributor<ConfigurationNode> {\r
+\r
+    @Override\r
+    public ImageDescriptor getDescriptor(ReadGraph graph, ConfigurationNode node) throws DatabaseException {\r
+        return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/bricks.png"));\r
+    }\r
+}\r
index d80b03135201894f85dad38ba44f1258b4814433..4d5766a47b0f0ef5e07d7206726b35b7fb96da61 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.sysdyn.ui.browser.contributions;\r
 \r
 import java.util.Collection;\r
+import java.util.Collections;\r
 \r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
 import org.simantics.db.ReadGraph;\r
@@ -23,7 +24,7 @@ public class Experiment extends ViewpointContributor<ExperimentsFolder> {
     @Override\r
     public Collection<?> getContribution(ReadGraph graph, ExperimentsFolder input) throws DatabaseException {\r
         // hasExperiment or something\r
-        return null;\r
+        return Collections.EMPTY_LIST;\r
     }\r
 \r
     @Override\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiments.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiments.java
deleted file mode 100644 (file)
index 1efed43..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.simantics.sysdyn.ui.browser.contributions;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class Experiments extends ViewpointContributor<ModelNode> {\r
-\r
-    @Override\r
-    public Collection<?> getContribution(ReadGraph graph, ModelNode model) throws DatabaseException {\r
-        return new DataContainer<AbstractNode>(new ExperimentsFolder(model.resource));\r
-    }\r
-\r
-    @Override\r
-    public String getViewpointId() {\r
-        return "Standard";\r
-    }\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentsImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentsImager.java
new file mode 100644 (file)
index 0000000..beb1e80
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
+\r
+public class ExperimentsImager extends ImagerContributor<ExperimentsFolder> {\r
+\r
+    @Override\r
+    public ImageDescriptor getDescriptor(ReadGraph graph, ExperimentsFolder node) throws DatabaseException {\r
+        return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/folder.png"));\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelChildren.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelChildren.java
new file mode 100644 (file)
index 0000000..d5dc863
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
+\r
+public class ModelChildren  extends ViewpointContributor<ModelNode> {\r
+\r
+    @Override\r
+    public Collection<?> getContribution(ReadGraph graph, ModelNode model)\r
+    throws DatabaseException {\r
+        ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+        result.add(new ConfigurationNode(\r
+                graph.getSingleObject(\r
+                        model.resource, \r
+                        graph.getBuiltins().HasConfiguration))\r
+        );\r
+        result.add(new ExperimentsFolder(model.resource));\r
+        result.add(new OperatingInterfacesFolder(model.resource));\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public String getViewpointId() {\r
+        return "Standard";\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelImager.java
new file mode 100644 (file)
index 0000000..00e386b
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
+\r
+public class ModelImager extends ImagerContributor<ModelNode> {\r
+\r
+    @Override\r
+    public ImageDescriptor getDescriptor(ReadGraph graph, ModelNode node) throws DatabaseException {\r
+        return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_organisation.png"));\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/OperatingInterfaces.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/OperatingInterfaces.java
deleted file mode 100644 (file)
index a0394ae..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.simantics.sysdyn.ui.browser.contributions;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
-import org.simantics.sysdyn.ui.browser.nodes.OperatingInterfacesFolder;\r
-import org.simantics.utils.DataContainer;\r
-\r
-public class OperatingInterfaces extends ViewpointContributor<ModelNode> {\r
-\r
-    @Override\r
-    public Collection<?> getContribution(ReadGraph graph, ModelNode model) throws DatabaseException {\r
-        return new DataContainer<AbstractNode>(new OperatingInterfacesFolder(model.resource));\r
-    }\r
-\r
-    @Override\r
-    public String getViewpointId() {\r
-        return "Standard";\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableImager.java
new file mode 100644 (file)
index 0000000..3dc6c4c
--- /dev/null
@@ -0,0 +1,16 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.VariableNode;\r
+\r
+public class VariableImager extends ImagerContributor<VariableNode> {\r
+\r
+    @Override\r
+    public ImageDescriptor getDescriptor(ReadGraph graph, VariableNode node) throws DatabaseException {\r
+        return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/brick.png"));\r
+    }\r
+}\r
index 1bde861e78c266633ebed49155211a1b44773981..1f44cfd1dba8d6598397959d0ed11ae8432a3456 100644 (file)
 package org.simantics.sysdyn.ui.browser.nodes;\r
 \r
 import org.simantics.browsing.ui.common.node.IDeletable;\r
-import org.simantics.browsing.ui.common.node.IModifiableNode;\r
-import org.simantics.browsing.ui.content.Labeler.Modifier;\r
-import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
 import org.simantics.db.Resource;\r
-import org.simantics.ui.SimanticsUI;\r
 \r
-public class ConfigurationNode  extends AbstractNode implements IDeletable, IModifiableNode {\r
+public class ConfigurationNode  extends AbstractNode implements IDeletable {\r
 \r
     public ConfigurationNode(Resource resource) {\r
         super(resource);\r
     }\r
     \r
-    @Override\r
-    public Modifier getModifier(String columnId) {\r
-        LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), resource) {\r
-            @Override\r
-            public String isValid(String label) {\r
-                if (label.isEmpty())\r
-                    return "Empty label not allowed";\r
-                if (label.contains(" "))\r
-                    return "Spaces are not allowed";\r
-                return null;\r
-            }\r
-        };\r
-        return modifier;\r
-    }\r
 }\r
index 90ea71c3708c638e838465dd261987a36a88d315..1da86b7c3161251f8c2e0539a14f42c3bf3a247e 100644 (file)
@@ -90,7 +90,6 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                        for(IElement element : diagram.getElements())\r
                            element.addListener(elementUpdateListener);\r
                } catch (MappingException e) {\r
-                       // TODO Auto-generated catch block\r
                        e.printStackTrace();\r
                }\r
                \r
@@ -112,7 +111,6 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                                 }                                \r
                             });\r
                         } catch (DatabaseException e) {\r
-                            // TODO Auto-generated catch block\r
                             e.printStackTrace();\r
                         }                        \r
                     }\r
@@ -134,7 +132,6 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                                 }\r
                             });\r
                         } catch (DatabaseException e) {\r
-                            // TODO Auto-generated catch block\r
                             e.printStackTrace();\r
                         }          \r
                     }\r
@@ -175,7 +172,17 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                        });\r
                        \r
                        SimanticsUI.getSession().asyncRequest(\r
-                               new TitleRequest(site.getId(), getResourceInput()),\r
+                               new TitleRequest(site.getId(), getResourceInput()) {\r
+                                   @Override\r
+                                   public String perform(ReadGraph graph) throws DatabaseException {\r
+                                       Resource r = graph.getSingleObject(\r
+                                               getResourceInput().getResource(),\r
+                                               graph.getBuiltins().IsConfigurationOf);\r
+                                       String n = null;\r
+                                       n = graph.adapt(r, String.class);\r
+                                       return n;\r
+                                   }\r
+                               },\r
                                new TitleUpdater(site.getShell().getDisplay(), new Callback<String>() {\r
                                    @Override\r
                                    public void run(String partName) {\r
@@ -188,7 +195,6 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                                    }\r
                                }));\r
                } catch (DatabaseException e) {\r
-                       // TODO Auto-generated catch block\r
                        e.printStackTrace();\r
                }               \r
        }\r