Project

General

Profile

Download (2.59 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.editor.view.supplementaldata;
12

    
13
import org.apache.log4j.Logger;
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.jface.viewers.Viewer;
17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.ui.IWorkbenchPart;
19
import org.eclipse.ui.part.EditorPart;
20

    
21
import eu.etaxonomy.taxeditor.editor.EditorUtil;
22
import eu.etaxonomy.taxeditor.editor.view.AbstractCdmEditorViewPart;
23
import eu.etaxonomy.taxeditor.model.AbstractCdmViewPart;
24
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
25

    
26

    
27
/**
28
 * <p>SupplementalDataViewPart class.</p>
29
 *
30
 * @author n.hoffmann
31
 * @created Jun 10, 2010
32
 * @version 1.0
33
 */
34
public class SupplementalDataViewPart extends AbstractCdmEditorViewPart {
35
	private static final Logger logger = Logger
36
			.getLogger(SupplementalDataViewPart.class);
37

    
38
	/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.supp"{trunked}</code> */
39
	public static final String ID = "eu.etaxonomy.taxeditor.editor.view.supplementalData";
40

    
41
	private SupplementalDataViewer supplementalDataViewer;
42
	
43
	/* (non-Javadoc)
44
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
45
	 */
46
	/** {@inheritDoc} */
47
	@Override
48
	public void createViewer(Composite parent) {
49
		supplementalDataViewer = new SupplementalDataViewer(parent, this);
50
	}
51

    
52

    
53
	/** {@inheritDoc} */
54
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
55
		if(EditorUtil.getActiveEditor() == null){
56
			showEmptyPage();
57
			return;
58
		}
59
		
60
		if((part instanceof EditorPart) || (part instanceof AbstractCdmViewPart)) {
61
			if(((IStructuredSelection) selection).size() != 1){
62
				showEmptyPage();
63
				return;
64
			}
65
			
66
			// do not show supplemental data for feature nodes
67
			if(((IStructuredSelection) selection).getFirstElement() instanceof FeatureNodeContainer){
68
				showEmptyPage();
69
				return;
70
			}
71
			
72
			showViewer(part, selection);
73
		}else{
74
			showEmptyPage();		
75
		}
76
	}
77
	
78
	/** {@inheritDoc} */
79
	@Override
80
	public void dispose() {
81
		super.dispose();
82
		selectionService.removePostSelectionListener(this);
83
	}
84

    
85

    
86
	/** {@inheritDoc} */
87
	@Override
88
	public Viewer getViewer() {
89
		return supplementalDataViewer;
90
	}
91

    
92
	/**
93
	 * <p>onComplete</p>
94
	 *
95
	 * @return a boolean.
96
	 */
97
	public boolean onComplete() {
98
		// TODO Auto-generated method stub
99
		return false;
100
	}
101
	
102
	
103
}
(1-1/2)