Commit 4fad41da authored by Filip Reaboi's avatar Filip Reaboi
Browse files

YELLOW

parent b81cd9f5
ConnectionCompositionDropTargetListener.java ba861adbef5ca39644386be53826a939be5110a3 RED
ElementCompositionDropTargetListener.java ab0fd4910f84790d72ec76ad20d87542019ed206 RED
ConnectionCompositionDropTargetListener.java 502736cffbe766ee4df5fec44e90b6d9d49584a8 YELLOW
ElementCompositionDropTargetListener.java 1fda888c2229eab3f20ea0d32be27520eeed9519 YELLOW
......@@ -25,7 +25,6 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalDNDTransfer;
import org.fortiss.tooling.kernel.ui.dnd.ConnectionCompositionSource;
// TODO(SB,6) (x2)
/**
* This class implements a drop target listener for {@link EditPartViewer}s,
* which creates {@link CreateConnectionCompositionRequest}s. The request
......@@ -34,13 +33,10 @@ import org.fortiss.tooling.kernel.ui.dnd.ConnectionCompositionSource;
* which completes the DND operation with the target information. It then relays
* the completed DND operation to the {@link IConnectionCompositorService}.
* <p>
* This class mimics the behavior of the kernel's SWT-based
*
* {@link ConnectionCompositionDropTargetAdapter}, but uses the GEF abstraction
* {@link AbstractTransferDropTargetListener} super class.
*
* @see RelayCreateCommandEditPolicyBase
* @see ConnectionCompositionDropTargetAdapter
*
* @author hoelzl
*/
......@@ -68,14 +64,12 @@ public class ConnectionCompositionDropTargetListener extends AbstractTransferDro
ConnectionCompositionSource sourceData = null;
if(getCurrentEvent().data instanceof ConnectionCompositionSource) {
sourceData = (ConnectionCompositionSource)getCurrentEvent().data;
// TODO(SB,20)
} else if(CompositionServiceLocalDNDTransfer.getInstance().getObject() instanceof ConnectionCompositionSource) {
// there have been reports about SWT platform inconsistencies:
// on OSX getCurrentEvent().data might be null during dragging
// while it is not null on other platforms. Therefore, we use this
// fallback.
sourceData =
// TODO(SB,20)
(ConnectionCompositionSource)CompositionServiceLocalDNDTransfer.getInstance()
.getObject();
}
......
......@@ -25,7 +25,6 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalDNDTransfer;
import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionSource;
// TODO(SB,6) (x2)
/**
* This class implements a drop target listener for {@link EditPartViewer}s,
* which creates {@link CreateElementCompositionRequest}s. The request contains
......@@ -34,16 +33,14 @@ import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionSource;
* the DND operation with the target information. It then relays the completed
* DND operation to the {@link IElementCompositorService}.
* <p>
* This class mimics the behavior of the kernel's SWT-based // TODO(SB,20)
*
* {@link ElementCompositionDropTargetAdapter}, but uses the GEF abstraction
* {@link AbstractTransferDropTargetListener} super class.
*
* @see RelayCreateCommandEditPolicyBase
* @see ElementCompositionDropTargetAdapter
*
* @author hoelzl
*/
public class ElementCompositionDropTargetListener extends AbstractTransferDropTargetListener {
/** Constructor. */
......@@ -67,13 +64,11 @@ public class ElementCompositionDropTargetListener extends AbstractTransferDropTa
ElementCompositionSource sourceData = null;
if(getCurrentEvent().data instanceof ElementCompositionSource) {
sourceData = (ElementCompositionSource)getCurrentEvent().data;
// TODO(SB,20)
} else if(CompositionServiceLocalDNDTransfer.getInstance().getObject() instanceof ElementCompositionSource) {
// there have been reports about SWT platform inconsistencies:
// on OSX getCurrentEvent().data might be null during dragging
// while it is not null on other platforms. Therefore, we use this
// fallback.
// TODO(SB,20)
sourceData =
(ElementCompositionSource)CompositionServiceLocalDNDTransfer.getInstance()
.getObject();
......
ViewerElementCompositionDropAdapter.java 7f3adb61b8e7caba17e501a7260f72853f995606 RED
ViewerElementCompositionDropAdapter.java 255646545e2c72055c1c090396525f21491f70e4 YELLOW
......@@ -24,24 +24,18 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalDNDTransfer;
import org.fortiss.tooling.kernel.ui.util.DragAndDropUtils;
//TODO(SB,6) (x2)
/**
* {@link ViewerDropAdapter} implementation for a JFace {@link TreeViewer}. This
* implementation mimics the behavior of SWT-based {@link ElementCompositionDropTargetAdapter}, but
* uses the JFace super class {@link ViewerDropAdapter} instead of SWT's {@link DropTargetAdapter}.
*
* @see ElementCompositionDropTargetAdapter
*
* {@link ViewerDropAdapter} implementation for a JFace {@link TreeViewer}.
*
* @author hoelzl
*/
public class ViewerElementCompositionDropAdapter extends ViewerDropAdapter {
/** Remember the last target. */
......@@ -77,15 +71,14 @@ public class ViewerElementCompositionDropAdapter extends ViewerDropAdapter {
public boolean performDrop(Object data) {
if(lastTarget instanceof EObject) {
final EObject target = (EObject)lastTarget;
// TODO(SB,25)
final EObject dropped = DragAndDropUtils.extractDroppedEObject(data);
// TODO(SB,20)
if(IElementCompositorService.getInstance().canCompose(target, dropped, null)) {
final EObject dropped = extractDroppedEObject(data);
IElementCompositorService instance = IElementCompositorService.getInstance();
if(instance.canCompose(target, dropped, null)) {
runAsCommand(target, new Runnable() {
@Override
public void run() {
// TODO(SB,20)
IElementCompositorService.getInstance().compose(target, dropped, null);
instance.compose(target, dropped, null);
}
});
return true;
......
......@@ -7,4 +7,4 @@ DiagramKeyHandler.java 9c59eca862c9f878da7cbf7c220f26b38737095c GREEN
FormsEditorBase.java 50934d36124dea9b16ac45fe3621d878afb48bc7 GREEN
GEFEditorBase.java 7cc55eaf9c9ffa351b683512832273a4b54a3830 GREEN
StyledTextCellEditor.java 3e678e4e8dbadb8463201bc62e7a67003acae8a8 GREEN
TreeViewerEditorBase.java 8cff2f2c65d61d267513a787b76d991dda7ff317 GREEN
TreeViewerEditorBase.java 5d2f159b59a1785cf118ac95cf4ad99b475efbe2 YELLOW
......@@ -38,6 +38,7 @@ import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
*
* @author hoelzl
*/
public abstract class TreeViewerEditorBase<T extends EObject> extends EditorBase<T> {
/** Stores the {@link TreeViewer}. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment