Project

General

Profile

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

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

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

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

    
25

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

    
53
}
(1-1/6)