blob: 640fa8839edc6ab9ac13925845f96484805c0a60 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<HTML>
<BODY>
<H1><CENTER>Drop Actions</CENTER></H1>
<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 editor's content outliner
into another java file in the resource navigator.
Since the resource navigator doesn't know anything
about Java content, it doesn't 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 <samp>org.eclipse.ui.dropActions</samp> 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
<samp>org.eclipse.ui.part.IDropActionDelegate</samp>.
The viewer that is the source of the drag
operation must support
<samp>the org.eclipse.ui.part.PluginTransfer</samp>
transfer type, and place a
<samp>PluginTransferData</samp> 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>
<p><samp>&nbsp;&nbsp; &lt;!ELEMENT extension (dropContribution*)&gt;</samp>
<br><br><samp>&nbsp;&nbsp; &lt;!ATTLIST extension</samp>
<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;CDATA #REQUIRED</samp>
<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #IMPLIED</samp>
<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;&nbsp;CDATA #IMPLIED</samp>
<br><samp>&nbsp;&nbsp; &gt;</samp>
<ul>
<li><b>point</b> - a fully qualified identifier of the target extension point</li><li><b>id</b> - an optional identifier of the extension instance</li><li><b>name</b> - an optional name of the extension instance</li></ul>
<p><samp>&nbsp;&nbsp; &lt;!ELEMENT dropContribution (action*)&gt;</samp>
<p><samp>&nbsp;&nbsp; &lt;!ELEMENT action EMPTY&gt;</samp>
<br><br><samp>&nbsp;&nbsp; &lt;!ATTLIST action</samp>
<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;&nbsp;&nbsp;&nbsp;CDATA #REQUIRED</samp>
<br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;CDATA #REQUIRED</samp>
<br><samp>&nbsp;&nbsp; &gt;</samp>
<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
<samp>org.eclipse.ui.part.IDropActionDelegate</samp>.</li></ul>
<b><i>Examples: </i></b>The following is an example of a drop action extension:
<p>
<pre>
&lt;extension point=&quot;org.eclipse.ui.dropActions&quot;&gt;
&lt;action
id=&quot;my_drop_action&quot;
class=&quot;com.xyz.eclipse.TestDropAction&quot;&gt;
&lt;/action&gt;
&lt;/extension&gt;
</pre>
</p>
Here is an example of a drag listener that makes use of the drop
action defined above.
<p>
<pre>
class MyDragListener extends DragSourceAdapter {
public void dragSetData(DragSourceEvent event) {
if (PluginTransfer.getInstance().isSupportedType(event.dataType)) {
byte[] dataToSend = ...//enter the data to be sent.
event.data = new PluginTransferData(
&quot;my_drop_action&quot;, dataToSend);
}
}
}
</pre>
</p>
For a more complete example, see the Platform
readme example. In that example, a drop action is
defined in ReadmeDropActionDelegate, and it is used
by ReadmeContentOutlineDragListener.<p>
<b><i>API Information: </i></b>The value of the class attribute must be a fully qualified name of a Java class that implements <samp>org.eclipse.ui.part.IDropActionDelegate</samp>. 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>
<p>
Copyright (c) 2002 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html<p>
</BODY>
</HTML>