KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > navigator > INavigatorDnDService


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.ui.navigator;
13
14 import org.eclipse.jface.viewers.IStructuredSelection;
15 import org.eclipse.swt.dnd.TransferData;
16
17 /**
18  *
19  * Provides instances of {@link CommonDragAdapterAssistant} and
20  * {@link CommonDropAdapterAssistant} for the associated
21  * {@link INavigatorContentService}.
22  *
23  * <p>
24  * Clients should only take note of this Service they are are using the
25  * {@link INavigatorContentService} in the context of a viewer which is not or
26  * does not extend {@link CommonViewer}. Clients should take a look at the
27  * initialization of the DND support in the {@link CommonViewer} if they wish to
28  * support this capability in their own viewers.
29  * </p>
30  *
31  * <p>
32  * This interface is not intended to be implemented by clients.
33  * </p>
34  *
35  * @see CommonDragAdapter
36  * @see CommonDragAdapterAssistant
37  * @see CommonDropAdapter
38  * @see CommonDropAdapterAssistant
39  * @see CommonViewer
40  * @see INavigatorContentService#getDnDService()
41  * @see <a
42  * HREF="http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html">Drag
43  * and Drop: Adding Drag and Drop to an SWT Application</a>
44  * @see <a
45  * HREF="http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html">Drag
46  * and Drop in the Eclipse UI (Custom Transfer Types)</a>
47  *
48  * @since 3.2
49  *
50  *
51  */

52 public interface INavigatorDnDService {
53
54     /**
55      *
56      * As part of the <b>org.eclipse.ui.navigator.viewer</b> extension point,
57      * clients may explicit extend the support Transfer Types of a particular
58      * viewer using the <b>dragAssistant</b> element. This element defines a
59      * class which extends {@link CommonDragAdapterAssistant} and can direct the
60      * viewer on how to provide different kinds of DND Transfer Types. The array
61      * is returned in no particular order.
62      *
63      * @return An array of {@link CommonDragAdapterAssistant} or an empty array.
64      */

65     CommonDragAdapterAssistant[] getCommonDragAssistants();
66
67     /**
68      * Clients may choose to programmatically bind drag assistants to an
69      * instance of the DND Service. A programmatic binding is not persisted
70      * between sessions and is not propagated to other instances of
71      * {@link INavigatorContentService} with the same id.
72      *
73      * @param anAssistant The assistant to bind.
74      */

75     void bindDragAssistant(CommonDragAdapterAssistant anAssistant);
76
77     /**
78      *
79      * This method returns an array of {@link CommonDropAdapterAssistant} from
80      * content extensions that are <i>visible</i> and <i>active</i> for the
81      * associated {@link INavigatorContentService}. The array is sorted by
82      * priority, with overrides taken into account.
83      *
84      * <p>
85      * The array should be processed from the first element to the last, asking
86      * each extension to
87      * {@link CommonDropAdapterAssistant#validateDrop(Object, int, org.eclipse.swt.dnd.TransferData)}.
88      * The first to successfully validate the drop operation will have the
89      * opportunity to
90      * {@link CommonDropAdapterAssistant#handleDrop(CommonDropAdapter, org.eclipse.swt.dnd.DropTargetEvent, Object) handle the drop}
91      * </p>
92      *
93      * @param aDropTarget
94      * The target element in the viewer of the drop operation.
95      * @param theTransferType
96      * The transfer type of the current drop operation.
97      * @return An array of {@link CommonDropAdapterAssistant}s that are defined
98      * by the set of
99      * <b>org.eclipse.ui.navigator.navigatorContent/navigatorContent</b>
100      * extensions that provide a <b>possibleChildren</b> expression
101      * that matches the given drop target.
102      */

103     CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
104             Object JavaDoc aDropTarget, TransferData theTransferType);
105
106     /**
107      *
108      * This method returns an array of {@link CommonDropAdapterAssistant} from
109      * content extensions that are <i>visible</i> and <i>active</i> for the
110      * associated {@link INavigatorContentService}.
111      *
112      * <p>
113      * The array should be processed from the first element to the last, asking
114      * each extension to
115      * {@link CommonDropAdapterAssistant#validateDrop(Object, int, org.eclipse.swt.dnd.TransferData)}.
116      * The first to successfully validate the drop operation will have the
117      * opportunity to
118      * {@link CommonDropAdapterAssistant#handleDrop(CommonDropAdapter, org.eclipse.swt.dnd.DropTargetEvent, Object) handle the drop}
119      * </p>
120      *
121      * @param aDropTarget
122      * The target element in the viewer of the drop operation.
123      * @param theDragSelection
124      * The drag selection of the current drop operation.
125      * @return An array of {@link CommonDropAdapterAssistant}s that are defined
126      * by the set of
127      * <b>org.eclipse.ui.navigator.navigatorContent/navigatorContent</b>
128      * extensions that provide a <b>possibleChildren</b> expression
129      * that matches the given drop target.
130      */

131     CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
132             Object JavaDoc aDropTarget, IStructuredSelection theDragSelection);
133 }
134
Popular Tags