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 * @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
40 public void dragSetData(DragSourceEvent event
) {
41 if (LocalSelectionTransfer
.getTransfer().isSupportedType(event
.dataType
)) {
42 DerivateViewSelection derivateViewSelection
= new DerivateViewSelection(derivateView
.getViewer().getSelection(), derivateView
);
43 LocalSelectionTransfer
.getTransfer().setSelection(derivateViewSelection
);
48 * @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
51 public void dragStart(DragSourceEvent event
) {
52 if(derivateView
.isDirty()){
54 MessagingUtils
.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
57 ISelection selection
= derivateView
.getViewer().getSelection();
58 if(EditorUtil
.getTreeNodeOfSelection(selection
)!=null){