3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
;
12 import org
.eclipse
.jface
.util
.LocalSelectionTransfer
;
13 import org
.eclipse
.jface
.viewers
.ISelection
;
14 import org
.eclipse
.swt
.dnd
.DragSourceAdapter
;
15 import org
.eclipse
.swt
.dnd
.DragSourceEvent
;
17 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
18 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
25 public class DerivateDragListener
extends DragSourceAdapter
{
27 private final DerivateView derivateView
;
32 public DerivateDragListener(DerivateView derivateView
) {
33 this.derivateView
= derivateView
;
37 public void dragSetData(DragSourceEvent event
) {
38 if (LocalSelectionTransfer
.getTransfer().isSupportedType(event
.dataType
)) {
39 DerivateViewSelection derivateViewSelection
= new DerivateViewSelection(derivateView
.getViewer().getSelection(), derivateView
);
40 LocalSelectionTransfer
.getTransfer().setSelection(derivateViewSelection
);
45 public void dragStart(DragSourceEvent event
) {
46 if(derivateView
.isDirty()){
48 MessagingUtils
.warningDialog(DerivateView
.VIEW_HAS_UNSAVED_CHANGES
, this, DerivateView
.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION
);
51 ISelection selection
= derivateView
.getViewer().getSelection();
52 if(EditorUtil
.getTreeNodeOfSelection(selection
)!=null){