X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.proconf.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fbase%2FSelectionAdapter.java;h=f3f9df914585e1a7f63be1a2cd93083bf4e84747;hb=87cee3d9fefb2d9d238527b6fd5267e215eb1960;hp=22b6bc6efdbdc7393b588b699cc8f3103a0b0b82;hpb=f0c68c79e94801e057802556c16281d5c92400b5;p=simantics%2F3d.git diff --git a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java index 22b6bc6e..f3f9df91 100644 --- a/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java +++ b/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/base/SelectionAdapter.java @@ -43,6 +43,8 @@ public abstract class SelectionAdapter implements ISelectionProvider{ private Gizmo currentGizmo = null; public SelectionAdapter(ScenegraphAdapter adapter) { + if (adapter == null) + throw new NullPointerException("Scenegraph adapter must no be null"); this.adapter = adapter; } @@ -393,7 +395,11 @@ public abstract class SelectionAdapter implements ISelectionProvider{ * @param s * @return the filtered selection */ - protected abstract StructuredResourceSelection filterSelection(ISelection s); + protected StructuredResourceSelection filterSelection(ISelection s) { + if (!(selection instanceof StructuredResourceSelection)) + return new StructuredResourceSelection(); + return (StructuredResourceSelection) selection; + } /** * Updates visual part of selection event. Use getCurrentSelection() to get