Project

General

Profile

« Previous | Next » 

Revision 5ff3332c

Added by Patrick Plitzner over 9 years ago

  • added property tester for context menu entries for media view (#3339)

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
9 9
import eu.etaxonomy.cdm.model.description.DescriptionBase;
10 10
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
11 11
import eu.etaxonomy.cdm.model.media.Media;
12
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
13
import eu.etaxonomy.taxeditor.model.AbstractUtility;
12 14
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
13 15

  
14 16
/**
......
26 28
	private static final String DESCRIPTION_ELEMENT = "isDescriptionElement";
27 29
	private static final String DELETABLE = "isDeletable";
28 30
	private static final String IMAGE_GALLERY = "isImageGallery";
31
	private static final String TAXON_EDITOR = "isTaxonEditor";
29 32

  
30 33
	/* (non-Javadoc)
31 34
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
......
35 38
    public boolean test(Object receiver, String property, Object[] args,
36 39
			Object expectedValue) {
37 40

  
38
		Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
41
	    if(TAXON_EDITOR.equals(property)){
42
	        return isTaxonEditor();
43
	    }
39 44

  
40
		if(selectedElements.length == 0){
45
	    Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
46

  
47
	    if(selectedElements.length == 0){
41 48
			// nothing selected so all tests should fail
42 49
			return false;
43 50
		}
......
127 134
		}
128 135
		return true;
129 136
	}
137

  
138
	private boolean isTaxonEditor() {
139
	    if(AbstractUtility.getActiveEditor() instanceof MultiPageTaxonEditor){
140
	        return true;
141
	    }
142
	    return false;
143
	}
130 144
}

Also available in: Unified diff