]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18016 ac1ea38d-2e2b...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 21 Sep 2010 07:47:17 +0000 (07:47 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 21 Sep 2010 07:47:17 +0000 (07:47 +0000)
org.simantics.sysdyn.ontology/graph.tg
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
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportModelHandler.java

index dc2924524a27fd59de8c26c6c3e29cda70495a82..c972fb75d69faad63dd8b0d37302476a1f9dad36 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index e8b22350f0bdee32526d1ca1fe325b4a295d857b..034a1be633a929c6b0a21944124b9f749e2c74e6 100644 (file)
@@ -20,7 +20,7 @@ public class ExperimentsFolder extends AbstractNode<Resource> {
         super(resource);\r
     }\r
     \r
-    @SuppressWarnings("unchecked")\r
+    @SuppressWarnings("rawtypes")\r
     @Override\r
     public Object getAdapter(Class adapter) {\r
         if(clazz == adapter) // There is no resource for this node..\r
index d52ab4f2cf832ad5723a3e1c59e0f4debd4e5442..f3c0e3f0c402cdec30eeabef0885d1a0e6c8fa0c 100644 (file)
@@ -20,7 +20,7 @@ public class ModulesNode extends AbstractNode<Resource> {
         super(resource);\r
     }\r
 \r
-    @SuppressWarnings("unchecked")\r
+    @SuppressWarnings("rawtypes")\r
     @Override\r
     public Object getAdapter(Class adapter) {\r
         if(clazz == adapter) // There is no resource for this node..\r
index 3f65256cdccc93245c97cae0d5b30fc734d45153..d7617ba7db2d8d6787fdfb5ea034bebf18953390 100644 (file)
@@ -42,24 +42,30 @@ public class ExportModelHandler extends AbstractHandler {
         \r
         // FIXME: Model browser doesn't change its selection even if the selected object is removed,\r
         // so you can try to export a removed model \r
-               boolean isRemoved = true;\r
+               String name = null;\r
                try {\r
-                       isRemoved = SimanticsUI.getSession().syncRequest(new Read<Boolean>() {\r
+                       name = SimanticsUI.getSession().syncRequest(new Read<String>() {\r
 \r
                                @Override\r
-                               public Boolean perform(ReadGraph graph) throws DatabaseException {\r
-                                       return !graph.hasStatement(model, Layer0.getInstance(graph).PartOf);\r
+                               public String perform(ReadGraph graph) throws DatabaseException {\r
+                                       if (!graph.hasStatement(model, Layer0.getInstance(graph).PartOf))\r
+                                               return null;\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
+                                       String name = graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, StringBindingDefault.INSTANCE ));\r
+                                       return name;\r
+                                       \r
                                }\r
                                \r
                        });\r
                } catch (DatabaseException e1) {\r
                        e1.printStackTrace();\r
                }\r
-               if(isRemoved) return null;\r
+               if(name == null) return null;\r
                \r
                Shell shell = HandlerUtil.getActiveShellChecked(event);\r
                FileDialog fd = new FileDialog(shell, SWT.SAVE);\r
                fd.setText("Export..");\r
+               fd.setFileName(name);\r
                fd.setFilterPath(Platform.getLocation().toOSString());\r
                String[] filterExt = {"*.tg"};\r
                fd.setFilterExtensions(filterExt);\r
@@ -92,7 +98,6 @@ public class ExportModelHandler extends AbstractHandler {
                                \r
                        }\r
                });\r
-       \r
 \r
                return null;\r
        }\r