Package ghidra.app.util
Class FileOpenDropHandler
- java.lang.Object
-
- ghidra.app.util.FileOpenDropHandler
-
- All Implemented Interfaces:
Droppable
,DropTargetHandler
,java.awt.event.ContainerListener
,java.util.EventListener
public class FileOpenDropHandler extends java.lang.Object implements DropTargetHandler, Droppable, java.awt.event.ContainerListener
Handles drag/drop events on a given component such that a file dropped on the component from the front end tool will cause that file to be opened. Properly handles drop events with child components and listens for components being added/removed in order to properly support drag/drop with all components.
-
-
Constructor Summary
Constructors Constructor Description FileOpenDropHandler(PluginTool tool, java.awt.Component component)
Construct a new FileOpenDropHandler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object obj, java.awt.dnd.DropTargetDropEvent e, java.awt.datatransfer.DataFlavor f)
Add the object to the droppable component.static void
addDataFlavorHandler(java.awt.datatransfer.DataFlavor dataFlavor, FileOpenDataFlavorHandler handler)
void
componentAdded(java.awt.event.ContainerEvent e)
void
componentRemoved(java.awt.event.ContainerEvent e)
void
dispose()
Dispose this drop handler.void
dragUnderFeedback(boolean ok, java.awt.dnd.DropTargetDragEvent e)
Set drag feedback according to the ok parameterboolean
isDropOk(java.awt.dnd.DropTargetDragEvent e)
Return true if is OK to drop the transferable at the location specified the eventstatic FileOpenDataFlavorHandler
removeDataFlavorHandler(java.awt.datatransfer.DataFlavor dataFlavor)
void
undoDragUnderFeedback()
Revert back to normal if any drag feedback was set
-
-
-
Constructor Detail
-
FileOpenDropHandler
public FileOpenDropHandler(PluginTool tool, java.awt.Component component)
Construct a new FileOpenDropHandler.- Parameters:
tool
- plugin toolcomponent
- component that is the drop target
-
-
Method Detail
-
dispose
public void dispose()
Dispose this drop handler.- Specified by:
dispose
in interfaceDropTargetHandler
-
isDropOk
public boolean isDropOk(java.awt.dnd.DropTargetDragEvent e)
Description copied from interface:Droppable
Return true if is OK to drop the transferable at the location specified the event
-
add
public void add(java.lang.Object obj, java.awt.dnd.DropTargetDropEvent e, java.awt.datatransfer.DataFlavor f)
Description copied from interface:Droppable
Add the object to the droppable component. The DropTargetAdapter calls this method from its drop() method.
-
dragUnderFeedback
public void dragUnderFeedback(boolean ok, java.awt.dnd.DropTargetDragEvent e)
Description copied from interface:Droppable
Set drag feedback according to the ok parameter- Specified by:
dragUnderFeedback
in interfaceDroppable
- Parameters:
ok
- true means the drop action is OKe
- event that has current state of drag and drop operation
-
undoDragUnderFeedback
public void undoDragUnderFeedback()
Description copied from interface:Droppable
Revert back to normal if any drag feedback was set- Specified by:
undoDragUnderFeedback
in interfaceDroppable
-
componentAdded
public void componentAdded(java.awt.event.ContainerEvent e)
- Specified by:
componentAdded
in interfacejava.awt.event.ContainerListener
-
componentRemoved
public void componentRemoved(java.awt.event.ContainerEvent e)
- Specified by:
componentRemoved
in interfacejava.awt.event.ContainerListener
-
addDataFlavorHandler
public static void addDataFlavorHandler(java.awt.datatransfer.DataFlavor dataFlavor, FileOpenDataFlavorHandler handler)
-
removeDataFlavorHandler
public static FileOpenDataFlavorHandler removeDataFlavorHandler(java.awt.datatransfer.DataFlavor dataFlavor)
-
-