Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Drop Actions

Identifier:
org.eclipse.ui.dropActions

Description:
This extension point is used to add drop behaviour to views defined by other plugins.

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.

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 PluginTransferData object in the drag event. See org.eclipse.jface.viewers.StructuredViewer#addDragSupport to learn how to add drag support to a viewer.

Configuration Markup:

<!ELEMENT extension ( action*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED

>

  • point - a fully qualified identifier of the target extension point
  • id - an optional identifier of the extension instance
  • name - an optional name of the extension instance

<!ELEMENT action EMPTY>

<!ATTLIST action

id    CDATA #REQUIRED

class CDATA #REQUIRED

>

  • id - a unique identifier that can be used to reference this action
  • class - the name of the fully qualified class that implements org.eclipse.ui.part.IDropActionDelegate.

Examples:
The following is an example of a drop action extension:


    <extension point=
"org.eclipse.ui.dropActions"
> 
        <action 
            id=
"my_drop_action"
 
            class=
"com.xyz.eclipse.TestDropAction"
> 
        </action> 
    </extension>  

Here is an example of a drag listener that makes use of the drop action defined above.

 
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( 
                "my_drop_action", dataToSend); 
        } 
    } 
} 

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.

Supplied Implementation:
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.


Copyright (c) 2002, 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v10.html


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire