2 * Copyright (C) 2007 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
.dnd
;
11 import java
.util
.Iterator
;
13 import org
.eclipse
.jface
.util
.LocalSelectionTransfer
;
14 import org
.eclipse
.jface
.viewers
.ISelection
;
15 import org
.eclipse
.jface
.viewers
.TreeSelection
;
16 import org
.eclipse
.swt
.dnd
.DropTargetEvent
;
17 import org
.eclipse
.swt
.dnd
.DropTargetListener
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
20 import eu
.etaxonomy
.taxeditor
.ui
.group
.grantedauthority
.CdmAuthorityComposite
;
21 import eu
.etaxonomy
.taxeditor
.ui
.group
.grantedauthority
.CdmAuthorityCompositeViewer
;
24 * Drop listener for the {@link CdmAuthorityComposite}.
27 * @created Mar 28, 2013
30 public class CdmAuthorityTableDropTargetListener
implements DropTargetListener
{
32 private CdmAuthorityCompositeViewer viewer
;
35 public CdmAuthorityTableDropTargetListener(CdmAuthorityCompositeViewer viewer
) {
40 public void dragEnter(DropTargetEvent event
) {
44 public void dragLeave(DropTargetEvent arg0
) {
48 public void dragOperationChanged(DropTargetEvent arg0
) {
52 public void dragOver(DropTargetEvent arg0
) {
56 public void drop(DropTargetEvent dtevent
) {
57 ISelection selection
= LocalSelectionTransfer
.getTransfer().getSelection();
58 if (selection
instanceof TreeSelection
) {
60 Iterator
<?
> selectionIterator
= ((TreeSelection
) selection
).iterator();
62 while (selectionIterator
.hasNext()){
63 Object next
= selectionIterator
.next();
64 if(CdmBase
.class.isAssignableFrom(next
.getClass()) ) {
65 viewer
.addCdmAuthority((CdmBase
)next
);
72 public void dropAccept(DropTargetEvent arg0
) {