]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed variable proposal bug (executed setInput within read transaction)
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 17 Feb 2014 11:08:19 +0000 (11:08 +0000)
committerluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 17 Feb 2014 11:08:19 +0000 (11:08 +0000)
fixes #4718

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

org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java

index cf11899bafa9902acbe62727ebb40be90c824d82..75c6b6094caefea586967a3ea0badda3802b1e88 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;\r
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
 import org.eclipse.swt.widgets.Group;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.swt.widgets.Spinner;\r
@@ -279,13 +280,20 @@ public class BarAxisTab extends LabelPropertyTabContributor implements Widget {
                 JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
                 Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
                 if(plot == null) return;\r
-                Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis);\r
-                if(rangeAxis == null) return;\r
-                rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis));\r
-\r
-                Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
-                if(domainAxis == null) return;\r
-                domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+                final Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis);\r
+                final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+                if(rangeAxis == null && domainAxis == null) return;\r
+                Display.getDefault().asyncExec(new Runnable() {\r
+                                       \r
+                                       @Override\r
+                                       public void run() {\r
+                                               if (rangeAxis != null)\r
+                                                       rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis));\r
+                                               if (domainAxis != null)\r
+                                                       domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+                                               \r
+                                       }\r
+                               });\r
             }\r
         });\r
     }\r
index 51bd71361ad4d04cd19af69a34383cf387f7e181..749bcb53f35d93b9d02412e635008aebcd47aee7 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;\r
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
 import org.eclipse.swt.widgets.Group;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.ui.IWorkbenchSite;\r
@@ -231,9 +232,15 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl
                 JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
                 Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
                 if(plot == null) return;\r
-                Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+                final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
                 if(domainAxis == null) return;\r
-                domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+                Display.getDefault().asyncExec(new Runnable() {\r
+                                       @Override\r
+                                       public void run() {\r
+                                               domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+                                       }\r
+                               });\r
+                \r
             }\r
         });\r
     }\r