Project

General

Profile

Download (2.05 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 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

    
11
package eu.etaxonomy.taxeditor.bulkeditor.command;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.core.expressions.PropertyTester;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.ui.IEditorInput;
17

    
18
import eu.etaxonomy.cdm.model.common.Group;
19
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
20
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
21
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
22

    
23
/**
24
 * <p>BulkEditorPropertyTester class.</p>
25
 *
26
 * @author p.ciardelli
27
 * @created 21.09.2009
28
 * @version 1.0
29
 */
30
public class BulkEditorPropertyTester extends PropertyTester {
31
	private static final Logger logger = Logger
32
			.getLogger(BulkEditorPropertyTester.class);
33

    
34
	private static final String GROUP = "isGroup";
35
	/* (non-Javadoc)
36
	 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
37
	 */
38
	/** {@inheritDoc} */
39
	public boolean test(Object receiver, String property, Object[] args,
40
			Object expectedValue) {
41
		BulkEditor bulkEditor = (BulkEditor) receiver;
42
			
43
		if ("isMergingEnabled".equals(property)) {			
44
			IEditorInput input = bulkEditor.getEditorInput();
45
			if (input instanceof AbstractBulkEditorInput) {
46
				return ((AbstractBulkEditorInput) input).isMergingEnabled();
47
			}			
48
		}
49
		if(GROUP.equals(property)){
50
			return isGroup(bulkEditor);
51
		}
52
//		if (("isPublishFlagEditingEnabled").equals(property)) {
53
//			IEditorInput input = bulkEditor.getEditorInput();
54
//			if (input instanceof NameEditorInput) {
55
//				return ((NameEditorInput) input).isPublishFlagEnabled();
56
//			}
57
//		}
58
		return false;
59
	}
60
	
61
	private boolean isGroup(BulkEditor bulkEditor) {
62
		IEditorInput input = bulkEditor.getEditorInput();
63
		return (input instanceof GroupEditorInput) ? true : false;
64
	}
65
}
(1-1/5)