--- /dev/null
+/**
+* Copyright (C) 2016 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.key.polytomous;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+
+/**
+ * @author k.luther
+ * @date 23.11.2016
+ *
+ */
+public class PolytomousKeyPropertyTester extends PropertyTester {
+ private static final String KEYNODE = "isKeyNode";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(receiver instanceof IStructuredSelection){
+
+ IStructuredSelection selection = (IStructuredSelection) receiver;
+
+ Object selectedElement = selection.getFirstElement();
+ if(KEYNODE.equals(property)){
+ return isKeyNode(selectedElement);
+ }
+ }
+ return false;
+ }
+
+ private boolean isKeyNode(Object selectedElement) {
+ return (selectedElement instanceof PolytomousKeyNode) ? true : false;
+ }
+
+
+}