<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
<meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]"> | |
<meta name="Author" content="Build"> | |
<title>Eclipse Workbench Extension Point: Drop Actions</title> | |
</head> | |
<body link="#0000FF" vlink="#800080"> | |
<center> | |
<h1> | |
Drop Actions</h1></center> | |
<b><i>Identifier: </i></b>org.eclipse.ui.dropActions | |
<p><b><i>Description: </i></b>This extension point is used to add drop | |
behaviour to views defined by other plugins. | |
<p>Due to the UI layering imposed by the plugin mechanism, views are often | |
not aware of the content and nature of other views. This can make drag | |
and drop operations between plugins difficult. For example, one may wish | |
to provide Java refactoring support whereby the user drags a method from | |
the Java editors content outliner into another java file in the resource | |
navigator. Since the resource navigator doesnt know anything about | |
Java content, it doesnt know how to behave when java methods are dropped | |
onto it. Similarly, an ISV may want to drop some of their content | |
into one of the Java viewers. | |
<p>The org.eclipse.ui.dropActions extension point is provided by the Platform to address | |
these situations. This mechanism delegates the drop behaviour back to the | |
originator of the drag operation. This behaviour is contained in an action | |
that must implement org.eclipse.ui.part.IDropActionDelegate. | |
The viewer that is the source of the drag operation must support the org.eclipse.ui.part.PluginTransfer | |
transfer type, and place a org.eclipse.ui.part.PluginTransferData object in the drag event. | |
See org.eclipse.jface.viewers.StructuredViewer#addDragSupport to learn how | |
to add drag support to a viewer. | |
<p><b><i>Configuration Markup:</i></b> | |
<p><tt> <!ELEMENT dropContribution (action)*></tt><tt></tt> | |
<p><tt> <!ELEMENT action*></tt> | |
<br><tt> <!ATTLIST action</tt> | |
<br><tt> id | |
CDATA #REQUIRED</tt> | |
<br><tt> class CDATA #REQUIRED</tt> | |
<br><tt> ></tt> | |
<ul> | |
<li> | |
<b>id</b> - a unique identifier that can be used to reference this action</li> | |
<li> | |
<b>class</b> - the name of the fully qualified class that implements org.eclipse.ui.part.IDropActionDelegate.</li> | |
</ul> | |
<p><br><b><i>Examples:</i></b> | |
<p>The following is an example of a drop action extension: | |
<p><tt> <extension point="org.eclipse.ui.dropActions"></tt> | |
<br><tt> <action></tt> | |
<br><tt> id="my_drop_action"</tt> | |
<br><tt> class="com.xyz.eclipse.TestDropAction"</tt> | |
<br><tt> </action></tt> | |
<br><tt> </extension></tt><tt></tt> | |
<p>Here is an example of a drag listener that makes use of the drop action | |
defined above. | |
<p><tt>class MyDragListener extends DragSourceAdapter {</tt> | |
<br><tt> public void dragSetData(DragSourceEvent event) | |
{</tt> | |
<br><tt> if (PluginTransfer.getInstance().isSupportedType(event.dataType)) | |
{</tt> | |
<br><tt> | |
byte[] dataToSend = ...//enter the data to be sent.</tt> | |
<br><tt> | |
event.data = new PluginTransferData(</tt> | |
<br><tt> | |
"my_drop_action", dataToSend);</tt> | |
<br><tt> }</tt> | |
<br><tt> }</tt> | |
<br><tt>}</tt><tt></tt> | |
<p>For a more complete example, see the Platform readme example | |
where drop action is defined in ReadmeDropActionDelegate, | |
and it is used by ReadmeContentOutlineDragListener. | |
<p><b><i>API Information: </i></b>The value of the <tt>class</tt> attribute | |
must be a fully qualified name of a Java class that implements <tt>org.eclipse.ui.part.IDropActionDelegate</tt>. | |
This class is loaded as late as possible to avoid loading the entire | |
plug-in before it is really needed. | |
<p><b><i>Supplied Implementation:</i></b> The workbench does not provide an implementation for this extension point. | |
Plug-ins can contribute to this extension point to add drop behavior to views defined by other plugins. | |
<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001" BORDER=0 height=12 width=195></a> | |
</body> | |
</html> |