Revision 860fc861
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
20 | 20 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
21 | 21 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
22 | 22 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
23 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4; |
|
23 | 24 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; |
24 | 25 |
|
25 | 26 |
/** |
... | ... | |
29 | 30 |
*/ |
30 | 31 |
public class DescriptionElementDragListener extends DragSourceAdapter { |
31 | 32 |
|
32 |
private DescriptiveViewPart part;
|
|
33 |
private FactualDataPartE4 part;
|
|
33 | 34 |
private DescriptionBase description; |
34 |
|
|
35 |
public DescriptionElementDragListener(DescriptiveViewPart part){
|
|
35 |
|
|
36 |
public DescriptionElementDragListener(FactualDataPartE4 part){
|
|
36 | 37 |
this.part = part; |
37 | 38 |
} |
38 |
|
|
39 |
|
|
39 | 40 |
/** |
40 | 41 |
* Method declared on DragSourceListener |
41 | 42 |
*/ |
42 |
public void dragFinished(DragSourceEvent event) { |
|
43 |
if (!event.doit) |
|
44 |
return; |
|
43 |
@Override |
|
44 |
public void dragFinished(DragSourceEvent event) { |
|
45 |
if (!event.doit) { |
|
46 |
return; |
|
47 |
} |
|
45 | 48 |
// FIXME what to do here? |
46 | 49 |
if (event.detail != DND.DROP_NONE) { |
47 | 50 |
//IStructuredSelection selection = (IStructuredSelection) part.getViewer().getSelection(); |
48 | 51 |
part.getViewer().refresh(); |
49 |
|
|
52 |
|
|
50 | 53 |
part.changed(null); |
51 | 54 |
} |
52 | 55 |
} |
53 |
|
|
56 |
|
|
54 | 57 |
/** |
55 | 58 |
* Method declared on DragSourceListener |
56 | 59 |
*/ |
57 |
public void dragSetData(DragSourceEvent event) { |
|
60 |
@Override |
|
61 |
public void dragSetData(DragSourceEvent event) { |
|
58 | 62 |
IStructuredSelection selection = (IStructuredSelection) part.getViewer() |
59 | 63 |
.getSelection(); |
60 | 64 |
List<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>(); |
... | ... | |
64 | 68 |
descriptionElements.addAll(((DescriptionBase) object).getElements()); |
65 | 69 |
} |
66 | 70 |
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class); |
67 |
|
|
71 |
|
|
68 | 72 |
}else if(object instanceof FeatureNodeContainer){ |
69 | 73 |
descriptionElements.addAll(((FeatureNodeContainer) object).getDescriptionElements()); |
70 | 74 |
}else if(object instanceof DescriptionElementBase){ |
71 | 75 |
descriptionElements.add((DescriptionElementBase)object); |
72 | 76 |
} |
73 |
|
|
77 |
|
|
74 | 78 |
} |
75 | 79 |
if (DescriptionElementTransfer.getInstance().isSupportedType( |
76 | 80 |
event.dataType)) { |
77 | 81 |
if (!descriptionElements.isEmpty()){ |
78 | 82 |
event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]); |
79 | 83 |
} |
80 |
|
|
84 |
|
|
81 | 85 |
} |
82 |
|
|
86 |
|
|
83 | 87 |
} |
84 |
|
|
88 |
|
|
85 | 89 |
/** |
86 | 90 |
* Method declared on DragSourceListener |
87 | 91 |
*/ |
88 |
public void dragStart(DragSourceEvent event) { |
|
92 |
@Override |
|
93 |
public void dragStart(DragSourceEvent event) { |
|
89 | 94 |
event.doit = !part.getViewer().getSelection().isEmpty(); |
90 | 95 |
} |
91 |
|
|
96 |
|
|
92 | 97 |
} |
Also available in: Unified diff
ref #6907 Migrate factual data view