KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > breakpoints > BreakpointsDropAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.views.breakpoints;
12
13 import org.eclipse.jface.viewers.IStructuredSelection;
14 import org.eclipse.jface.viewers.ViewerDropAdapter;
15 import org.eclipse.swt.dnd.DropTargetEvent;
16 import org.eclipse.swt.dnd.TransferData;
17 import org.eclipse.swt.widgets.Item;
18 import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
19
20 /**
21  * BreakpointsDropAdapter
22  */

23 public class BreakpointsDropAdapter extends ViewerDropAdapter {
24
25     private Item fTarget = null;
26     
27     /**
28      * @param viewer
29      */

30     protected BreakpointsDropAdapter(BreakpointsViewer viewer) {
31         super(viewer);
32         setFeedbackEnabled(false);
33     }
34
35     /**
36      * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
37      */

38     public boolean performDrop(Object JavaDoc data) {
39         return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
40     }
41
42     /**
43      * @see org.eclipse.jface.viewers.ViewerDropAdapter#determineTarget(org.eclipse.swt.dnd.DropTargetEvent)
44      */

45     protected Object JavaDoc determineTarget(DropTargetEvent event) {
46         fTarget = (Item) event.item;
47         return fTarget;
48     }
49     
50     /**
51      * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
52      */

53     public boolean validateDrop(Object JavaDoc target, int operation, TransferData transferType) {
54         return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
55     }
56 }
57
Popular Tags