]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Gave models labels and modified editor to use the label as its partName
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 20 May 2010 06:41:38 +0000 (06:41 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 20 May 2010 06:41:38 +0000 (06:41 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@15783 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynDiagramEditor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java

index 64dc4856278e488d09d543915eb34ef356c938f0..bb53b5942deb799a6fac5b2c8b1bfddb8fe232f8 100644 (file)
@@ -9,7 +9,7 @@ public class ModelLabeler extends LabelerContributor<ModelNode>{
 \r
     @Override\r
     public String getLabel(ReadGraph graph, ModelNode model) throws DatabaseException {\r
-        String name = graph.getPossibleRelatedValue(model.resource, graph.getBuiltins().HasName);\r
-        return name == null ? "Model (no name)" : name;\r
+        String label = graph.getPossibleRelatedValue(model.resource, graph.getBuiltins().HasLabel);\r
+        return label == null ? "Model (no name)" : label;\r
     }\r
 }\r
index 1da86b7c3161251f8c2e0539a14f42c3bf3a247e..1c795cfb3268648a8a3500cb865957405e121c9d 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;\r
 import org.eclipse.ui.IEditorSite;\r
 import org.eclipse.ui.PartInitException;\r
+import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
@@ -175,12 +176,12 @@ public class SysdynDiagramEditor extends ResourceEditorPart {
                                new TitleRequest(site.getId(), getResourceInput()) {\r
                                    @Override\r
                                    public String perform(ReadGraph graph) throws DatabaseException {\r
+                                       Builtins b = graph.getBuiltins();\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
+                                               b.IsConfigurationOf);\r
+                                       String label = graph.getPossibleRelatedValue(r, b.HasLabel);\r
+                                       return label;\r
                                    }\r
                                },\r
                                new TitleUpdater(site.getShell().getDisplay(), new Callback<String>() {\r
index 232e673c047b58fad8ffaf6f2999c842892e1c43..148bb34eb006a0b9e254722e4be23226a5c71fab 100644 (file)
@@ -24,6 +24,7 @@ public class NewModelHandler extends AbstractHandler {
                 SysdynResource sr = SysdynResource.getInstance(graph);\r
                 Resource model = graph.newResource();\r
                 graph.claimValue(model, b.HasName, "Model1");\r
+                graph.claimValue(model, b.HasLabel, "Model1");\r
                 graph.claim(model, b.InstanceOf, sr.SysdynModel);\r
                 graph.claim(model, b.PartOf, SimanticsUI.getProject().get());\r
                 \r
index 59fa382df9a15216da0d03aad5be96a5870a7151..1020b1cdf1c0550e25947521436415474efe19fc 100644 (file)
@@ -73,6 +73,7 @@ public class SysdynProject extends AbstractProjectFeature {
                 SysdynResource sr = SysdynResource.getInstance(g);\r
                 Resource model = g.newResource();\r
                 g.claimValue(model, b.HasName, "Model1");\r
+                g.claimValue(model, b.HasLabel, "Model1");\r
                 g.claim(model, b.InstanceOf, sr.SysdynModel);\r
                 g.claim(model, b.PartOf, library);\r
                 \r