]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
ModelBrowser prepared to support images
authorjplaine <jplaine@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 10 Sep 2010 13:37:12 +0000 (13:37 +0000)
committerjplaine <jplaine@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 10 Sep 2010 13:37:12 +0000 (13:37 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17870 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/icons/image_add.png [new file with mode: 0644]
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentsFolder.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModulesNode.java

diff --git a/org.simantics.sysdyn.ui/icons/image_add.png b/org.simantics.sysdyn.ui/icons/image_add.png
new file mode 100644 (file)
index 0000000..fc5d613
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/image_add.png differ
index ebd755762b8606beee7e83dc9172615d4b9e0a1b..9c1f08f31a9d1db56419811180d239b290a4a81f 100644 (file)
                </visibleWhen>\r
             </command>\r
          </menu>\r
+         <command\r
+               commandId="org.simantics.image.ui.importImage"\r
+               icon="icons/image_add.png"\r
+               label="Import Image"\r
+               style="push">\r
+                <visibleWhen checkEnabled="true">\r
+                   <with\r
+                         variable="selection">\r
+                     <test\r
+                          args="org.simantics.image.ui.modelBrowser.ImagesNode"\r
+                           property="org.simantics.modeling.ui.nodeClass">\r
+                     </test>\r
+                   </with>\r
+                </visibleWhen>\r
+         </command>\r
          <dynamic\r
                class="org.simantics.ui.contribution.OpenWithMenuContribution"\r
                id="org.simantics.sysdyn.ui.browser.openWithMenu">\r
                         args="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                   </test>\r
+                  <test\r
+                        args="org.simantics.image.ui.modelBrowser.ImageNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
                </or>\r
             </with>\r
          </activeWhen>\r
index 97b57c675d8add1d5390500e0a0d39e004f36294..bfb49594e90c2c09e87cdfa54accb3c62b08815f 100644 (file)
@@ -38,7 +38,7 @@ import org.simantics.utils.datastructures.hints.IHintContext;
 public class SysdynBrowser extends GraphExplorerView {\r
     \r
 //  private static final Set<String> browseContexts  = Collections.singleton("http://www.simantics.org/Sysdyn-1.0/Browser");\r
-    private static final Set<String> browseContexts  = new HashSet<String>(Arrays.asList("http://www.simantics.org/Sysdyn-1.0/Browser", "http://www.simantics.org/Operating-1.0/Browser"));    \r
+    private static final Set<String> browseContexts  = new HashSet<String>(Arrays.asList("http://www.simantics.org/Sysdyn-1.0/Browser", "http://www.simantics.org/Operating-1.0/Browser", "http://www.simantics.org/Image-1.0/Browser"));    \r
 \r
     private BinaryFunction<Object[], GraphExplorer, Object[]> selectionTransformation = new BinaryFunction<Object[], GraphExplorer, Object[]>() {\r
 \r
index 82626d467c6326161c5ca488aa39f673539ada67..e8b22350f0bdee32526d1ca1fe325b4a295d857b 100644 (file)
@@ -19,5 +19,13 @@ public class ExperimentsFolder extends AbstractNode<Resource> {
     public ExperimentsFolder(Resource resource) {\r
         super(resource);\r
     }\r
+    \r
+    @SuppressWarnings("unchecked")\r
+    @Override\r
+    public Object getAdapter(Class adapter) {\r
+        if(clazz == adapter) // There is no resource for this node..\r
+            return null;\r
+        return super.getAdapter(adapter);\r
+    }\r
 \r
 }\r
index 4132b9214596c5a821d3c44932eabe3ee837183e..d52ab4f2cf832ad5723a3e1c59e0f4debd4e5442 100644 (file)
@@ -20,5 +20,12 @@ public class ModulesNode extends AbstractNode<Resource> {
         super(resource);\r
     }\r
 \r
+    @SuppressWarnings("unchecked")\r
+    @Override\r
+    public Object getAdapter(Class adapter) {\r
+        if(clazz == adapter) // There is no resource for this node..\r
+            return null;\r
+        return super.getAdapter(adapter);\r
+    }\r
 \r
 }\r