Skip to content

Package: ViewEditorDropAdapter

ViewEditorDropAdapter

nameinstructionbranchcomplexitylinemethod
ViewEditorDropAdapter()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
ViewEditorDropAdapter(EditingDomain, Viewer)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
dragOver(DropTargetEvent)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
drop(DropTargetEvent)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
dropAccept(DropTargetEvent)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * EclipseSource Muenchen - initial API and implementation
13: *
14: *******************************************************************************/
15: package org.eclipse.emf.ecp.ui.view.internal.editor.controls.legacy.handler;
16:
17: import org.eclipse.emf.ecp.ui.common.dnd.ECPDropAdapter;
18: import org.eclipse.emf.edit.domain.EditingDomain;
19: import org.eclipse.jface.viewers.Viewer;
20: import org.eclipse.swt.dnd.DropTargetEvent;
21:
22: /**
23: * Drop adapter for the view editor.
24: */
25: @SuppressWarnings("restriction")
26: public class ViewEditorDropAdapter extends ECPDropAdapter {
27:
28:         /**
29:          * Default constructor needed for extension point.
30:          */
31:         public ViewEditorDropAdapter() {
32:
33:         }
34:
35:         /**
36:          * Constructor.
37:          *
38:          * @param domain the {@link EditingDomain} to use
39:          * @param viewer the Viewer this {@link ECPDropAdapter} is applied to
40:          */
41:         public ViewEditorDropAdapter(EditingDomain domain, Viewer viewer) {
42:                 super(domain, viewer);
43:         }
44:
45:         @Override
46:         public void dragOver(DropTargetEvent event) {
47:                 // Object target = extractDropTarget(event.item);
48:                 // if (target == null) {
49:                 // return;
50:                 // }
51:                 // source = getDragSource(event);
52:                 //
53:                 // Object sourceObject = null;
54:                 //
55:                 // if (source == null) {
56:                 // ISelection selection = viewer.getSelection();
57:                 // if (selection instanceof IStructuredSelection) {
58:                 // sourceObject = ((IStructuredSelection) viewer.getSelection())
59:                 // .getFirstElement();
60:                 // }
61:                 //
62:                 // } else {
63:                 // sourceObject = source.iterator().next();
64:                 // }
65:                 super.dragOver(event);
66:         }
67:
68:         @Override
69:         public void dropAccept(DropTargetEvent event) {
70:                 super.dropAccept(event);
71:         }
72:
73:         @Override
74:         public void drop(final DropTargetEvent event) {
75:                 // source = getDragSource(event);
76:                 //
77:                 // Object sourceObject = null;
78:                 //
79:                 // if (source == null) {
80:                 // ISelection selection = viewer.getSelection();
81:                 // if (selection instanceof IStructuredSelection) {
82:                 // sourceObject = ((IStructuredSelection) viewer.getSelection())
83:                 // .getFirstElement();
84:                 // }
85:                 //
86:                 // } else {
87:                 // sourceObject = source.iterator().next();
88:                 // }
89:
90:                 // if (event.detail == DND.DROP_COPY) {
91:                 //
92:                 // TreeItem itemChild=(TreeItem) event.item;
93:                 // Composite composite=null;
94:                 // Composite compositeSource = null;
95:                 // if(Composite.class.isInstance(sourceObject)){
96:                 // compositeSource=(Composite) sourceObject;
97:                 // }
98:                 // if(Composite.class.isInstance(itemChild.getData())){
99:                 // composite=(Composite)itemChild.getData();
100:                 // }
101:                 // TreeItem parentItem=itemChild.getParentItem();
102:                 // if(composite!=null&&CompositeCollection.class.isInstance(parentItem.getData())){
103:                 // CompositeCollection compositeCollection=(CompositeCollection)parentItem.getData();
104:                 // int index=compositeCollection.getComposites().indexOf(composite);
105:                 // int indexSource=compositeCollection.getComposites().indexOf(compositeSource);
106:                 // if(index!=-1&&indexSource!=-1){
107:                 // domain.getCommandStack().execute(MoveCommand.create(domain, compositeCollection,
108:                 // ViewPackage.eINSTANCE.getCompositeCollection_Composites(), compositeSource, index));
109:                 // }
110:                 // }
111:                 // }
112:                 // else{
113:                 super.drop(event);
114:                 // if (event.detail == DND.DROP_LINK) {
115:                 // //TODO change to parameter
116:                 // ((StructuredViewer)viewer).refresh(((EObject)sourceObject).eContainer());
117:                 // }
118:                 // }
119:         }
120: }