From ee031e1f1a61169a45d79dfcf3ea4c6a74e06fca Mon Sep 17 00:00:00 2001 From: luukkainen Date: Thu, 14 Aug 2014 12:01:33 +0000 Subject: [PATCH] Fix Sysdyn drop operations. refs #5170 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30066 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/jfreechart/chart/ge/AxisDropAction.java | 2 +- .../org/simantics/jfreechart/chart/ge/SeriesDropAction.java | 2 +- .../sysdyn/ui/browser/actions/drop/ChartDropAction.java | 2 +- .../sysdyn/ui/browser/actions/drop/FunctionDropAction.java | 2 +- .../org/simantics/sysdyn/ui/elements/profiles/ShadowStyle.java | 3 +++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/AxisDropAction.java b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/AxisDropAction.java index 20f79bb0..40bca222 100644 --- a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/AxisDropAction.java +++ b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/AxisDropAction.java @@ -34,7 +34,7 @@ import org.simantics.utils.ui.AdaptionUtils; public class AxisDropAction implements DropActionFactory { @Override - public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException { + public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException { // Make sure that both target and source are resources Resource t = AdaptionUtils.adaptToSingle(target, Resource.class); Resource s = AdaptionUtils.adaptToSingle(source, Resource.class); diff --git a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/SeriesDropAction.java b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/SeriesDropAction.java index 5870cd52..41c6bb69 100644 --- a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/SeriesDropAction.java +++ b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ge/SeriesDropAction.java @@ -38,7 +38,7 @@ import org.simantics.utils.ui.AdaptionUtils; public class SeriesDropAction implements DropActionFactory { @Override - public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException { + public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException { // Make sure that both target and source are resources Resource t = AdaptionUtils.adaptToSingle(target, Resource.class); Resource s = AdaptionUtils.adaptToSingle(source, Resource.class); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java index 27c0272c..e5e308ac 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java @@ -40,7 +40,7 @@ import org.simantics.utils.ui.AdaptionUtils; public class ChartDropAction implements DropActionFactory { @Override - public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException { + public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException { final Resource targetChart = AdaptionUtils.adaptToSingle(target, Resource.class); if(targetChart == null || source == null || !(source instanceof IStructuredSelection)) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java index 354f25b3..cb3e1626 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java @@ -30,7 +30,7 @@ import org.simantics.utils.ui.AdaptionUtils; public class FunctionDropAction implements DropActionFactory { @Override - public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException { + public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException { Resource t = AdaptionUtils.adaptToSingle(target, Resource.class); Resource s = AdaptionUtils.adaptToSingle(source, Resource.class); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/profiles/ShadowStyle.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/profiles/ShadowStyle.java index 5e5f981c..ee0f442b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/profiles/ShadowStyle.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/profiles/ShadowStyle.java @@ -50,6 +50,9 @@ public class ShadowStyle extends StyleBase { AffineTransform transform = DiagramGraphUtil.getAffineTransform(graph, element); Resource component = graph.getPossibleObject(element, MOD.ElementToComponent); + + if (component == null) + return new ShadowResult(Style.NONE, transform); Resource original = graph.getPossibleObject(component, SR.Shadow_original); Collection shadows = graph.getObjects(component, SR.Shadow_original_Inverse); -- 2.47.1