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=2b0b4802184fb22d36950276d03d6c185b43cd6b;hb=9ad91ae4a059a4c7b219d2560c5b8b8ed1c5f184;hp=22b6bc6efdbdc7393b588b699cc8f3103a0b0b82;hpb=477a3eae417fe71addfcf8f87dab41f87151a384;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..2b0b4802 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. + * Copyright (c) 2007- VTT Technical Research Centre of Finland. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -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