<reference
definitionId="isShowExperimentalFeatures">
</reference>
- <reference
- definitionId="isClassification">
- </reference>
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
+ </test>
</and>
</visibleWhen>
</command>
<reference
definitionId="isShowExperimentalFeatures">
</reference>
- <reference
- definitionId="isClassification">
- </reference>
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
+ </test>
</and>
</visibleWhen>
</command>
<reference
definitionId="isTaxonNode">
</reference>
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
+ </test>
+ </not>
</and>
</visibleWhen>
</command>
style="push">
<visibleWhen
checkEnabled="true">
- <reference
- definitionId="isTaxonNode">
- </reference>
+ <and>
+ <reference
+ definitionId="isTaxonNode">
+ </reference>
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
+ </test>
+ </not>
+ </and>
</visibleWhen>
</command>
<command
<reference
definitionId="isTaxonNode">
</reference>
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
+ </test>
+ </not>
+
</and>
</visibleWhen>
</command>
labelProvider="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodeLabelProvider"
name="%navigatorContent.name.0">
<triggerPoints>
- <or>
+
<instanceof
value="eu.etaxonomy.cdm.model.taxon.TaxonNode">
</instanceof>
- <and>
- <instanceof
- value="eu.etaxonomy.cdm.model.taxon.Classification">
- </instanceof>
- <test
- forcePluginActivation="true"
- property="eu.etaxonomy.taxeditor.propertytests.hasTaxa">
- </test>
- </and>
- </or>
+
+
</triggerPoints>
<dropAssistant
class="eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapterAssistant"
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
- id="eu.etaxonomy.taxeditor.propertytests.navigatorPropertyTester"
- namespace="eu.etaxonomy.taxeditor.propertytests"
- properties="hasSynonyms"
- type="eu.etaxonomy.cdm.model.taxon.TaxonNode">
+ id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
+ namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
+ properties="hasSynonyms, isClassification"
+ type="java.lang.Object">
</propertyTester>
- <propertyTester
- class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
- id="eu.etaxonomy.taxeditor.propertytests.navigatorPropertyTester"
- namespace="eu.etaxonomy.taxeditor.propertytests"
+
+ <propertyTester
+ class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
+ id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
+ namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
properties="hasTaxa"
type="eu.etaxonomy.cdm.model.taxon.TaxonomicTree">
</propertyTester>
<propertyTester
- class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
- id="eu.etaxonomy.taxeditor.propertytests.navigatorPropertyTester"
- namespace="eu.etaxonomy.taxeditor.propertytests"
+ class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
+ id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
+ namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
properties="hasTaxa"
- type="eu.etaxonomy.cdm.model.taxon.Classification">
+ type="eu.etaxonomy.cdm.model.taxon.TaxonNode">
</propertyTester>
<propertyTester
class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
</iterate>
</with>
</definition>
- <definition
- id="isClassification">
- <with
- variable="selection">
- <iterate
- ifEmpty="false">
- <instanceof
- value="eu.etaxonomy.cdm.model.taxon.Classification">
- </instanceof>
- </iterate>
- </with>
- </definition>
+
<definition
id="isChecklistEditorEnabled">
<with
*/
package eu.etaxonomy.taxeditor.navigation.navigator;
+import java.util.ArrayList;
+import java.util.Collection;
+
import org.eclipse.core.expressions.PropertyTester;
import eu.etaxonomy.cdm.model.taxon.Classification;
private static final Object HAS_SYNONYMS = "hasSynonyms"; //$NON-NLS-1$
private static final Object HAS_TAXA = "hasTaxa"; //$NON-NLS-1$
+ private static final Object IS_CLASSIFICATION = "isClassification"; //$NON-NLS-1$
/** {@inheritDoc} */
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
+ if (receiver instanceof Collection){
+ if (((Collection)receiver).iterator().hasNext()){
+ receiver = ((Collection)receiver).iterator().next();
+ }
+ }
if (receiver instanceof TaxonNode && HAS_SYNONYMS.equals(property)) {
Taxon taxon = ((TaxonNode) receiver).getTaxon();
if(taxon != null){
}
}
- if (receiver instanceof Classification && HAS_TAXA.equals(property)) {
- Classification taxononomicTree = (Classification) receiver;
- return taxononomicTree.getChildNodes().size() > 0;
+ if (receiver instanceof TaxonNode && HAS_TAXA.equals(property)) {
+ TaxonNode node = (TaxonNode) receiver;
+ if (!node.hasTaxon()){
+ return node.getChildNodes().size() > 0;
+ }else{
+ return false;
+ }
+ }
+ if (receiver instanceof TaxonNode && IS_CLASSIFICATION.equals(property)) {
+ TaxonNode node = (TaxonNode) receiver;
+ return !node.hasTaxon();
}
return false;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
if (currentSelection instanceof IStructuredSelection) {
Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
- if (selectedElement instanceof Classification) {
- Classification classification = (Classification) selectedElement;
+ if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
+ Classification classification = ((TaxonNode)selectedElement).getClassification();
TaxonNavigator taxonNavigator = (TaxonNavigator)AbstractUtility.showView(TaxonNavigator.ID);
CloneClassificationWizard wizard = new CloneClassificationWizard(classification);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);