Project

General

Profile

« Previous | Next » 

Revision b0ce5b17

Added by Patrick Plitzner over 10 years ago

merged trunk into branch

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
20 20

  
21 21
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
22 22
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
23
import eu.etaxonomy.taxeditor.model.AbstractUtility;
23 24
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
24
import eu.etaxonomy.taxeditor.store.StoreUtil;
25
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
25 26
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
26
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
27
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
28 27

  
29 28

  
30 29
/**
......
40 39
	public static final String ID = "eu.etaxonomy.taxeditor.view.supplementalData";
41 40

  
42 41
	private SupplementalDataViewer viewer;
43
	
42

  
44 43
	/* (non-Javadoc)
45 44
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
46 45
	 */
......
52 51

  
53 52

  
54 53
	/** {@inheritDoc} */
55
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
56
		if(StoreUtil.getActiveEditor() == null){
54
	@Override
55
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
56
		if(AbstractUtility.getActiveEditor() == null){
57 57
			showEmptyPage();
58 58
			return;
59 59
		}
60
		
61
		if(((part instanceof EditorPart) || (part instanceof AbstractCdmViewPart)) && selection instanceof IStructuredSelection) {
62
			IStructuredSelection structuredSelection = (IStructuredSelection) selection;
60

  
61
        if(!(selection instanceof IStructuredSelection)){
62
            return;
63
        }
64

  
65
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
66

  
67
		if((part instanceof EditorPart || part instanceof IPartContentHasSupplementalData)) {
63 68
			if(structuredSelection.size() != 1){
64 69
				showEmptyPage();
65 70
				return;
66 71
			}
67
			
72

  
68 73
			// do not show supplemental data for feature nodes
69 74
			if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
70 75
				showEmptyPage();
71 76
				return;
72 77
			}
73
			if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){
78
			else if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){
74 79
				return;
75 80
			}
76
			if(structuredSelection.getFirstElement() instanceof PolytomousKeyNode){
81
			else if(structuredSelection.getFirstElement() instanceof PolytomousKeyNode){
77 82
			    structuredSelection = new StructuredSelection(((PolytomousKeyNode)structuredSelection.getFirstElement()).getKey());
78 83
            }
79 84
			showViewer(part, structuredSelection);
80 85
		}else{
81
			showEmptyPage();		
86
			showEmptyPage();
82 87
		}
83 88
	}
84
	
89

  
85 90
	/** {@inheritDoc} */
86 91
	@Override
87 92
	public void dispose() {
......
101 106
	 *
102 107
	 * @return a boolean.
103 108
	 */
104
	public boolean onComplete() {
109
	@Override
110
    public boolean onComplete() {
105 111
		// TODO Auto-generated method stub
106 112
		return false;
107 113
	}
108
	
109
	
114

  
115

  
110 116
}

Also available in: Unified diff