Package ghidra.app.util

# Class FileOpenDropHandler

java.lang.Object
ghidra.app.util.FileOpenDropHandler

All Implemented Interfaces:
  `Droppable`, `DropTargetHandler`, `ContainerListener`, `EventListener`

public class FileOpenDropHandler extends Object implements DropTargetHandler, Droppable, 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, Component component)`
  Construct a new FileOpenDropHandler.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(Object obj, DropTargetDropEvent e, DataFlavor f)`
  Add the object to the droppable component.
  `static void`
  `addDataFlavorHandler(DataFlavor dataFlavor, FileOpenDataFlavorHandler handler)`
  `void`
  `componentAdded(ContainerEvent e)`
  `void`
  `componentRemoved(ContainerEvent e)`
  `void`
  `dispose()`
  Dispose this drop handler.
  `boolean`
  `isDropOk(DropTargetDragEvent e)`
  Return true if is OK to drop the transferable at the location specified the event
  `static FileOpenDataFlavorHandler`
  `removeDataFlavorHandler(DataFlavor dataFlavor)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface docking.dnd.Droppable

  `dragUnderFeedback, undoDragUnderFeedback`

- ## Constructor Details

  - ### FileOpenDropHandler

    public FileOpenDropHandler(PluginTool tool, Component component)
    Construct a new FileOpenDropHandler.
    Parameters:
      `tool` - plugin tool
      `component` - component that is the drop target

- ## Method Details

  - ### dispose

    public void dispose()
    Dispose this drop handler.
    Specified by:
      `dispose` in interface `DropTargetHandler`

  - ### isDropOk

    public boolean isDropOk(DropTargetDragEvent e)
    Description copied from interface: `Droppable`
    Return true if is OK to drop the transferable at the location specified the event
    Specified by:
      `isDropOk` in interface `Droppable`
    Parameters:
      `e` - event that has current state of drag and drop operation
    Returns:
      true if OK

  - ### add

    public void add(Object obj, DropTargetDropEvent e, DataFlavor f)
    Description copied from interface: `Droppable`
    Add the object to the droppable component. The DropTargetAdapter calls this method from its drop() method.
    Specified by:
      `add` in interface `Droppable`
    Parameters:
      `obj` - Transferable object that is to be dropped.
      `e` - has current state of drop operation
      `f` - represents the opaque concept of a data format as would appear on a clipboard, during drag and drop.

  - ### componentAdded

    public void componentAdded(ContainerEvent e)
    Specified by:
      `componentAdded` in interface `ContainerListener`

  - ### componentRemoved

    public void componentRemoved(ContainerEvent e)
    Specified by:
      `componentRemoved` in interface `ContainerListener`

  - ### addDataFlavorHandler

    public static void addDataFlavorHandler(DataFlavor dataFlavor, FileOpenDataFlavorHandler handler)

  - ### removeDataFlavorHandler

    public static FileOpenDataFlavorHandler removeDataFlavorHandler(DataFlavor dataFlavor)