Project

General

Profile

Download (2.35 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2017 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.view.e4.details;
11

    
12
import javax.annotation.PostConstruct;
13
import javax.annotation.PreDestroy;
14
import javax.inject.Inject;
15
import javax.inject.Named;
16

    
17
import org.eclipse.e4.core.di.annotations.Optional;
18
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19
import org.eclipse.e4.ui.services.IServiceConstants;
20
import org.eclipse.jface.viewers.IStructuredSelection;
21
import org.eclipse.jface.viewers.Viewer;
22
import org.eclipse.swt.widgets.Composite;
23

    
24
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
25
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
26
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
27
import eu.etaxonomy.taxeditor.l10n.Messages;
28

    
29
/**
30
 * @author pplitzner
31
 * @date 18.07.2017
32
 *
33
 */
34
public class DetailsPartE4 implements IConversationEnabled{
35

    
36
    private DetailsViewerE4 viewer;
37

    
38
    @Inject
39
    public DetailsPartE4() {
40
    }
41

    
42
    @PostConstruct
43
    public void create(Composite parent) {
44
        viewer = new DetailsViewerE4(parent);
45
    }
46

    
47
    @Inject
48
    @Optional
49
    public void selectionChanged(
50
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
51
            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
52
            MPart thisPart){
53
        showViewer(selection, activePart, thisPart);
54
    }
55

    
56
    protected String getViewName(){
57
        return Messages.DetailsViewPart_VIEWER_NAME;
58
    }
59

    
60
    public Viewer getViewer() {
61
        return viewer;
62
    }
63

    
64

    
65
    @PreDestroy
66
    public void dispose() {
67
    }
68

    
69
    public void showViewer(IStructuredSelection selection, MPart activePart, MPart thisPart){
70
        if(getViewer()!=null){
71
            Object element = selection.getFirstElement();
72
            if(selection.getFirstElement()!=null){
73
                getViewer().setInput(element);
74
            }
75
        }
76
    }
77

    
78
    /**
79
     * {@inheritDoc}
80
     */
81
    @Override
82
    public void update(CdmDataChangeMap arg0) {
83
        // TODO Auto-generated method stub
84

    
85
    }
86

    
87
    /**
88
     * {@inheritDoc}
89
     */
90
    @Override
91
    public ConversationHolder getConversationHolder() {
92
        return null;
93
    }
94
}
(2-2/3)