KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > presentations > StackDropResult


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.ui.presentations;
12
13 import org.eclipse.swt.graphics.Rectangle;
14
15 /**
16  * This structure describes a drop event that will cause a dragged part
17  * to be stacked in a position currently occupied by another part.
18  *
19  * @since 3.0
20  */

21 public final class StackDropResult {
22
23     private Rectangle snapRectangle;
24
25     private Object JavaDoc cookie;
26
27     /**
28      * Creates a drop result
29      *
30      * @param snapRectangle region that should be highlighted by the tracking
31      * rectangle (display coordinates)
32      * @param cookie the presentation may attach an object to this drop result
33      * in order to identify the drop location. This object will be passed back into the
34      * presentation's add method.
35      */

36     public StackDropResult(Rectangle snapRectangle, Object JavaDoc cookie) {
37         this.snapRectangle = snapRectangle;
38         this.cookie = cookie;
39     }
40
41     /**
42      * Returns a rectangle (screen coordinates) describing the target location
43      * for this drop operation. While dragging, the tracking rectangle will
44      * snap to this position.
45      *
46      * @return a snap rectangle (not null)
47      */

48     public Rectangle getSnapRectangle() {
49         return snapRectangle;
50     }
51
52     /**
53      * Returns the cookie for this drop result. This object provided by the presentation,
54      * but is remembered by the workbench. It will be given back to the presentation's add
55      * method to indicate that a part is being added as a result of a drop operation.
56      *
57      * @return the drop cookie for this drop result
58      */

59     public Object JavaDoc getCookie() {
60         return cookie;
61     }
62
63 }
64
Popular Tags