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.l10n.Messages;
|
19
|
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
|
20
|
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
|
21
|
|
22
|
|
23
|
/**
|
24
|
* The Class create a specific Use View to keep the taxonomic view clean
|
25
|
* @author a.theys
|
26
|
* @created mar 13, 2012
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class UsesViewPart extends DescriptiveViewPart {
|
30
|
|
31
|
public UsesViewPart() {
|
32
|
super();
|
33
|
}
|
34
|
|
35
|
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */
|
36
|
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses"; //$NON-NLS-1$
|
37
|
/** {@inheritDoc} */
|
38
|
@Override
|
39
|
public void createViewer(Composite parent) {
|
40
|
|
41
|
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
|
42
|
| SWT.V_SCROLL | SWT.FULL_SELECTION));
|
43
|
viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
|
44
|
viewer.setLabelProvider(new UsesLabelProvider());
|
45
|
viewer.setAutoExpandLevel(2);
|
46
|
|
47
|
|
48
|
|
49
|
Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
|
50
|
// viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
|
51
|
// this));
|
52
|
// viewer.addDropSupport(dndOperations, transfers,
|
53
|
// new DescriptionElementDropAdapter(viewer));
|
54
|
|
55
|
// Propagate selection from viewer
|
56
|
getSite().setSelectionProvider(viewer);
|
57
|
|
58
|
showAllElementsAction = new ToggleDescriptionAction(false);
|
59
|
hideAllElementsAction = new ToggleDescriptionAction(true);
|
60
|
|
61
|
// Add context menu to tree
|
62
|
createMenu();
|
63
|
|
64
|
createToolbar();
|
65
|
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
protected String getViewName(){
|
70
|
return Messages.UsesViewPart_VIEWER_NAME;
|
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
|
}
|