Project

General

Profile

Download (2.51 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2011 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9
package eu.etaxonomy.taxeditor.editor.view.uses;
10

    
11
import org.eclipse.jface.viewers.TreeViewer;
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.dnd.Transfer;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Tree;
16

    
17
import eu.etaxonomy.cdm.model.common.CdmBase;
18
import eu.etaxonomy.taxeditor.editor.UseObjectManager;
19
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
20
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
21
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
22
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
23

    
24

    
25
/**
26
 * The Class create a specific Use View to keep the taxonomic view clean
27
 * @author a.theys
28
 * @created mar 13, 2012
29
 * @version 1.0
30
 */
31
public class UsesViewPart extends DescriptiveViewPart {
32

    
33
	
34
	
35
	public UsesViewPart() {
36
		super();
37
		UseObjectManager useManager = new UseObjectManager();
38
	}
39

    
40
	/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */
41
	public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses";
42
	/** {@inheritDoc} */
43
	@Override
44
	public void createViewer(Composite parent) {
45

    
46
		viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
47
				| SWT.V_SCROLL | SWT.FULL_SELECTION));
48
		viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
49
		viewer.setLabelProvider(new UsesLabelProvider());
50
		viewer.setAutoExpandLevel(2);
51

    
52

    
53

    
54
		Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
55
		viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
56
				this));
57
		viewer.addDropSupport(dndOperations, transfers,
58
				new DescriptionElementDropAdapter(viewer));
59

    
60
		// Propagate selection from viewer
61
		getSite().setSelectionProvider(viewer);
62

    
63
		showAllElementsAction = new ToggleDescriptionAction(false);
64
		hideAllElementsAction = new ToggleDescriptionAction(true);
65

    
66
		// Add context menu to tree
67
		createMenu();
68

    
69
		createToolbar();
70

    
71
	}
72

    
73
	/** {@inheritDoc} */
74
	@Override
75
	public boolean postOperation(CdmBase objectAffectedByOperation) {
76
		viewer.refresh();
77
		return super.postOperation(objectAffectedByOperation);
78
	}
79

    
80

    
81

    
82
}
(3-3/3)