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/detail/DetailsViewPart.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
*/
......
19 19

  
20 20
import eu.etaxonomy.cdm.model.common.CdmBase;
21 21
import eu.etaxonomy.cdm.model.description.Feature;
22
import eu.etaxonomy.taxeditor.model.AbstractUtility;
22 23
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
24
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
23 25
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
24
import eu.etaxonomy.taxeditor.store.StoreUtil;
25 26
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
26
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
27 27

  
28 28
/**
29 29
 * <p>DetailsViewPart class.</p>
......
33 33
 * @version 1.0
34 34
 */
35 35
public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartContentHasSupplementalData{
36
	
36

  
37 37
	/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked}</code> */
38 38
	public static String ID = "eu.etaxonomy.taxeditor.view.detail";
39 39

  
......
43 43
	@Override
44 44
	public void createViewer(Composite parent) {
45 45
		//selectionService.addPostSelectionListener(this);
46
		
46

  
47 47
		viewer = new DetailsViewer(parent, this);
48 48
		getSite().setSelectionProvider(viewer);
49 49
	}
50 50

  
51 51
	/** {@inheritDoc} */
52
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
53
		if(StoreUtil.getActiveEditor() == null){
52
	@Override
53
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
54
		if(AbstractUtility.getActiveEditor() == null){
54 55
			showEmptyPage();
55 56
			return;
56 57
		}
57
		
58

  
58 59
		if(part == this){
59 60
			return;
60 61
		}
61
		
62

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

  
66 67
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
67
		
68
		if((part instanceof IEditorPart) || (part instanceof AbstractCdmViewPart)) {
68

  
69
		if((part instanceof IEditorPart) || (part instanceof IPartContentHasDetails)) {
69 70
			if(structuredSelection.size() != 1){
70 71
				showEmptyPage();
71 72
				return;
72 73
			}
73
			
74
			// do not show details for feature nodes TODO really? 
74

  
75
			// do not show details for feature nodes TODO really?
75 76
			if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
76 77
				// do show the map for distributions
77 78
				Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature();
......
80 81
					return;
81 82
				}
82 83
			}
83
			
84

  
84 85
			showViewer(part, structuredSelection);
85 86
		}else{
86
			showEmptyPage();		
87
		}	
87
			showEmptyPage();
88
		}
88 89
	}
89
	
90

  
90 91
	/** {@inheritDoc} */
91 92
	@Override
92 93
	public boolean postOperation(CdmBase objectAffectedByOperation) {
93
		
94

  
94 95
		viewer.setInput(objectAffectedByOperation);
95
		
96

  
96 97
		return super.postOperation(objectAffectedByOperation);
97 98
	}
98
	
99
	
99

  
100

  
100 101
	/** {@inheritDoc} */
101 102
	@Override
102 103
	public Viewer getViewer() {
103 104
		return viewer;
104 105
	}
105 106

  
106
	
107

  
107 108
	/** {@inheritDoc} */
108 109
	@Override
109 110
	public void dispose() {
......
116 117
	 *
117 118
	 * @return a boolean.
118 119
	 */
119
	public boolean onComplete() {
120
	@Override
121
    public boolean onComplete() {
120 122
		return true;
121 123
	}
122 124
}

Also available in: Unified diff