2 * Copyright (C) 2011 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
.view
.uses
;
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
;
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
;
26 * The Class create a specific Use View to keep the taxonomic view clean
28 * @created mar 13, 2012
31 public class UsesViewPart
extends DescriptiveViewPart
{
35 public UsesViewPart() {
37 UseObjectManager useManager
= new UseObjectManager();
40 /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */
41 public static final String ID
= "eu.etaxonomy.taxeditor.editor.view.uses";
44 public void createViewer(Composite parent
) {
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);
54 Transfer
[] transfers
= new Transfer
[] { DescriptionElementTransfer
.getInstance() };
55 viewer
.addDragSupport(dndOperations
, transfers
, new DescriptionElementDragListener(
57 viewer
.addDropSupport(dndOperations
, transfers
,
58 new DescriptionElementDropAdapter(viewer
));
60 // Propagate selection from viewer
61 getSite().setSelectionProvider(viewer
);
63 showAllElementsAction
= new ToggleDescriptionAction(false);
64 hideAllElementsAction
= new ToggleDescriptionAction(true);
66 // Add context menu to tree
75 public boolean postOperation(CdmBase objectAffectedByOperation
) {
77 return super.postOperation(objectAffectedByOperation
);