]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixes after changes
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 10 Apr 2014 08:48:20 +0000 (08:48 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 10 Apr 2014 08:48:20 +0000 (08:48 +0000)
refs #4810

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29274 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/AdjustableTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/LabelPropertyTabContributor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/CommentTab.java

index da4bae8ca8eea43d1bd19b0f3f174b402608b556..f9c30701c82a67cad85960fca64dbaecc164b54e 100644 (file)
@@ -98,10 +98,10 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
         */\r
        protected abstract void createControlLayoutHorizontal(boolean wideScreen);\r
 \r
-       @Override\r
-       public void dispose() {\r
-               if(controlListener != null && spp != null)\r
-                       spp.removeControlListener(controlListener);\r
-       }\r
+//     @Override\r
+//     public void dispose() {\r
+//             if(controlListener != null && spp != null)\r
+//                     spp.removeControlListener(controlListener);\r
+//     }\r
 \r
 }\r
index 045b4d3147f8ed504bd6ec4cdfa6e75d0dbfa200..8c0441c48b42ee73c745a9d6f30665d51d51aa9d 100644 (file)
 package org.simantics.jfreechart.chart.properties;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.events.DisposeEvent;\r
-import org.eclipse.swt.events.DisposeListener;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchSite;\r
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
-import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.procedure.AsyncListener;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.selectionview.PropertyTabContributorImpl;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.datastructures.Callback;\r
 import org.simantics.utils.ui.AdaptionUtils;\r
 \r
 public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
 \r
-    private boolean isDisposed = false;\r
-\r
-\r
-    public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
-        super.createControl(parent, site, context, support);\r
-\r
-        // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
-        parent.addDisposeListener(new DisposeListener() {\r
-\r
-            @Override\r
-            public void widgetDisposed(DisposeEvent e) {\r
-                LabelPropertyTabContributor.this.dispose();\r
-            }\r
-        });\r
-    }\r
-\r
     @Override\r
-    public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
-               final Variable variable = AdaptionUtils.adaptToSingle(forSelection, Variable.class);\r
-        final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
-        if(resource == null && variable == null) {\r
-            updateCallback.run("Selection properties");\r
-            return;\r
-        }\r
+    public Read<String> getPartNameReadRequest(final ISelection forSelection) {\r
 \r
-        SimanticsUI.getSession().asyncRequest(new Read<String>() {\r
+        return new Read<String>() {\r
 \r
             @Override\r
             public String perform(ReadGraph graph) throws DatabaseException {\r
                 Layer0 l0 = Layer0.getInstance(graph);\r
                 ModelingResources mr = ModelingResources.getInstance(graph);\r
+\r
+                       final Variable variable = AdaptionUtils.adaptToSingle(forSelection, Variable.class);\r
+                final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
+                if(resource == null && variable == null) {\r
+                       return "Selection";\r
+                }\r
                 \r
                 Resource r;\r
                 if(variable != null) {\r
@@ -84,27 +58,9 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
                     return label;\r
                 return "No name for selection";\r
             }\r
-        }, new AsyncListener<String>() {\r
-\r
-            @Override\r
-            public void execute(AsyncReadGraph graph, String result) {\r
-                updateCallback.run(result);\r
-            }\r
-\r
-            @Override\r
-            public void exception(AsyncReadGraph graph, Throwable throwable) {\r
-\r
-            }\r
-\r
-            @Override\r
-            public boolean isDisposed() {\r
-                return isDisposed;\r
-            }\r
-        });\r
+            \r
+        };\r
+        \r
     }\r
 \r
-    @Override\r
-    protected void dispose() {\r
-        this.isDisposed = true;\r
-    }\r
 }\r
index 3d7183e610e68e448b9bae0cb86d61aa16d8690d..0b6c00c10031eed1bb4fa0a49f88d3e0c3bacaea 100644 (file)
@@ -25,7 +25,6 @@ import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
-import org.simantics.utils.datastructures.Callback;\r
 \r
 /**\r
  * Tab for editing diagram comments\r
@@ -35,10 +34,10 @@ import org.simantics.utils.datastructures.Callback;
  */\r
 public class CommentTab extends LabelPropertyTabContributor {\r
 \r
-    @Override\r
-    public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
-        updateCallback.run("Comment");\r
-    }\r
+       @Override\r
+       public String getPartName(ISelection forSelection) {\r
+               return "Comment";\r
+       }\r
         \r
     @Override\r
     public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r