Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.ceditor
Class DropHandlerPlugin

java.lang.Object
  extended by oracle.ide.ceditor.DropHandlerPlugin

All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, EditorPlugin

public abstract class DropHandlerPlugin
extends java.lang.Object
implements EditorPlugin

The DropHandlerPlugin is an abstract class that allows code editor clients to extend the drop functionality of Drag & Drop for the code editor to support additional data flavors or even custom drop behavior.

Since this is an EditorPlugin implementation, it should be installed into an editor through an EditorPluginsFactory instance.


Constructor Summary
DropHandlerPlugin()
          Constructs a new DropHandlerPlugin instance.

 

Method Summary
protected  void cancelDragEvent(java.awt.dnd.DropTargetEvent event)
          Hook called when the drop area has been exited or the drop is over.
 void deinstall(BasicEditorPane editor)
          Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
protected  BasicDocument getDocument()
          Fetch the document of the editor.
protected  java.awt.Point getDropLocationToPaint(java.awt.dnd.DropTargetDragEvent event)
          Gets the location in the code editor's BasicEditorPane where the drop location should be painted.
protected  BasicEditorPane getEditorPane()
          Fetch the editor.
 void install(BasicEditorPane editor)
          Called when this plugin is being installed into the BasicEditorPane.
protected abstract  boolean performDrop(java.awt.dnd.DropTargetDropEvent event)
          Perform the actual drop operation for the given drop event.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
protected  void raiseEditorToFront()
          Utility routine which will raise the window containing the editor to the front, and place focus in the editor.
protected abstract  int shouldAllowDrag(java.awt.dnd.DropTargetDragEvent event)
          Hook for the plugin to decide whether it would like to handle a drop with the given data at the given spot.
protected abstract  int shouldAllowDrop(java.awt.dnd.DropTargetDropEvent event)
          Hook for the plugin to decide whether it would like to handle a drop with the given data at the given spot.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

DropHandlerPlugin

public DropHandlerPlugin()
Constructs a new DropHandlerPlugin instance.

Method Detail

install

public final void install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane.
Specified by:
install in interface EditorPlugin
Parameters:
editor - the editor pane

deinstall

public void deinstall(BasicEditorPane editor)
Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
Specified by:
deinstall in interface EditorPlugin
Parameters:
editor - the editor pane

getEditorPane

protected final BasicEditorPane getEditorPane()
Fetch the editor.
Returns:
the editor

getDocument

protected final BasicDocument getDocument()
Fetch the document of the editor.
Returns:
the editor document

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed.

raiseEditorToFront

protected final void raiseEditorToFront()
Utility routine which will raise the window containing the editor to the front, and place focus in the editor.

shouldAllowDrag

protected abstract int shouldAllowDrag(java.awt.dnd.DropTargetDragEvent event)
Hook for the plugin to decide whether it would like to handle a drop with the given data at the given spot. This is called during drag, before drop. Note that this method must not call acceptDrag or rejectDrag; the code editor takes care of this.
Parameters:
event - Drag event in question
Returns:
DnDConstants.ACTION_NONE to say that we don't want to allow this drop, or a mask of DnDConstants actions that we want to accept.

shouldAllowDrop

protected abstract int shouldAllowDrop(java.awt.dnd.DropTargetDropEvent event)
Hook for the plugin to decide whether it would like to handle a drop with the given data at the given spot. This is called after the drop. Note that this method must not call acceptDrop, rejectDrop, or dropComplete; the code editor takes care of this.
Parameters:
event - Drop event in question
Returns:
DnDConstants.ACTION_NONE to say that we don't want to handle the drop, or the single specific action constant (copy, move, link) of the want to accept.

cancelDragEvent

protected void cancelDragEvent(java.awt.dnd.DropTargetEvent event)
Hook called when the drop area has been exited or the drop is over. This is for cleanup purposes. Note that this could be called more than once for a single drag.
Parameters:
event - drop event

getDropLocationToPaint

protected java.awt.Point getDropLocationToPaint(java.awt.dnd.DropTargetDragEvent event)
Gets the location in the code editor's BasicEditorPane where the drop location should be painted. This is only called on the plugin that returned non-zero from shouldAllowDrag(java.awt.dnd.DropTargetDragEvent) during drag. The default implementation just returns the location of the event. Subclasses may override this to show a different location, like if the drop will actually occur somewhere else nearby. They may also return null to indicate not to paint the drop location.
Parameters:
event - drag event
Returns:
location to paint the drop feedback, or null for none

performDrop

protected abstract boolean performDrop(java.awt.dnd.DropTargetDropEvent event)
Perform the actual drop operation for the given drop event. Note that this is called when the drop actually occurs (user released mouse), and will be called only when this plugin returned non-zero from shouldAllowDrop(java.awt.dnd.DropTargetDropEvent). Note that this method must not call acceptDrop, rejectDrop, or dropComplete; the code editor takes care of this.
Parameters:
event - drop event

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.