2 * Copyright (C) 2014 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
.derivate
;
11 import org
.eclipse
.jface
.util
.LocalSelectionTransfer
;
12 import org
.eclipse
.jface
.viewers
.ISelection
;
13 import org
.eclipse
.swt
.dnd
.DragSourceAdapter
;
14 import org
.eclipse
.swt
.dnd
.DragSourceEvent
;
16 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
17 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
24 public class DerivateDragListener
extends DragSourceAdapter
{
26 private final DerivateView derivateView
;
31 public DerivateDragListener(DerivateView derivateView
) {
32 this.derivateView
= derivateView
;
36 public void dragSetData(DragSourceEvent event
) {
37 if (LocalSelectionTransfer
.getTransfer().isSupportedType(event
.dataType
)) {
38 DerivateViewSelection derivateViewSelection
= new DerivateViewSelection(derivateView
.getViewer().getSelection(), derivateView
);
39 LocalSelectionTransfer
.getTransfer().setSelection(derivateViewSelection
);
44 public void dragStart(DragSourceEvent event
) {
45 if(derivateView
.isDirty()){
47 MessagingUtils
.warningDialog(DerivateView
.VIEW_HAS_UNSAVED_CHANGES
, this, DerivateView
.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION
);
50 ISelection selection
= derivateView
.getViewer().getSelection();
51 if(EditorUtil
.getTreeNodeOfSelection(selection
)!=null){