Project

General

Profile

Download (1.34 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2015 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.bulkeditor.command;
10

    
11
import org.eclipse.core.expressions.PropertyTester;
12
import org.eclipse.jface.viewers.IStructuredSelection;
13

    
14
import eu.etaxonomy.cdm.model.agent.Person;
15
import eu.etaxonomy.cdm.model.agent.Team;
16

    
17
/**
18
 * @author k.luther
19
 * @date 13.05.2015
20
 *
21
 */
22
public class BulkEditorMenuPropertyTester extends PropertyTester {
23

    
24

    
25
	private static final String IS_TEAM = "isTeam";
26
	private static final String IS_PERSON = "isPerson";
27
	
28
	public BulkEditorMenuPropertyTester(){
29
	}
30
	/**
31
	 * {@inheritDoc}
32
	 */
33
	@Override
34
	public boolean test(Object receiver, String property, Object[] args,
35
			Object expectedValue) {
36
		if(receiver instanceof IStructuredSelection){
37
			IStructuredSelection selection = (IStructuredSelection) receiver;
38
			Object selectedElement = selection.getFirstElement();
39
			if (property.equals(IS_PERSON) && selectedElement instanceof Person){
40
				return true;
41
			} 
42
			if (property.equals(IS_TEAM) && selectedElement instanceof Team){
43
				return true;
44
			}
45
			return false;
46
		
47
		}
48
		return false;
49
	}
50

    
51
}
(1-1/7)