Project

General

Profile

Download (5.4 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2009 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
 * @see CommonDragAdapter
32
 * @see CommonDragAdapterAssistant
33
 * @see CommonDropAdapter
34
 * @see CommonDropAdapterAssistant
35
 * @see CommonViewer
36
 * @see INavigatorContentService#getDnDService()
37
 * @see <a
38
 *      href="http://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html">Drag
39
 *      and Drop: Adding Drag and Drop to an SWT Application</a>
40
 * @see <a
41
 *      href="http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html">Drag
42
 *      and Drop in the Eclipse UI (Custom Transfer Types)</a>
43
 * 
44
 * @noimplement This interface is not intended to be implemented by clients.
45
 * @noextend This interface is not intended to be extended by clients.
46
 * @since 3.2
47
 * 
48
 * 
49
 */
50
public interface INavigatorDnDService {
51

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

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

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

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