From: luukkainen Date: Mon, 17 Feb 2014 11:08:19 +0000 (+0000) Subject: Fixed variable proposal bug (executed setInput within read transaction) X-Git-Tag: 1.8.1~136 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=cc0406ccf6913b218dca4910e7e16ec7d04dec57;p=simantics%2Fsysdyn.git Fixed variable proposal bug (executed setInput within read transaction) fixes #4718 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28866 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java index cf11899b..75c6b609 100644 --- a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java +++ b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java @@ -18,6 +18,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Spinner; @@ -279,13 +280,20 @@ public class BarAxisTab extends LabelPropertyTabContributor implements Widget { JFreeChartResource jfree = JFreeChartResource.getInstance(graph); Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot)); if(plot == null) return; - Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis); - if(rangeAxis == null) return; - rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis)); - - Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis); - if(domainAxis == null) return; - domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis)); + final Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis); + final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis); + if(rangeAxis == null && domainAxis == null) return; + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + if (rangeAxis != null) + rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis)); + if (domainAxis != null) + domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis)); + + } + }); } }); } diff --git a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java index 51bd7136..749bcb53 100644 --- a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java +++ b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java @@ -22,6 +22,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbenchSite; @@ -231,9 +232,15 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl JFreeChartResource jfree = JFreeChartResource.getInstance(graph); Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot)); if(plot == null) return; - Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis); + final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis); if(domainAxis == null) return; - domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis)); + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis)); + } + }); + } }); }