|
Extension SDK 9.0.5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jdeveloper.ceditor.DropHandlerPlugin
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 | |
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 abstract java.awt.datatransfer.DataFlavor[] |
getDataFlavors()
Fetch an array of supported DataFlavor objects, indicating what flavors the data can be provided in. |
protected BasicDocument |
getDocument()
Fetch the document of the editor. |
protected EditDescriptor |
getDropDescriptor()
Fetch the edit descriptor that should be used for the undoable event associated with this drop operation. |
protected BasicEditorPane |
getEditorPane()
Fetch the editor. |
protected abstract java.lang.String |
getTransferText(java.awt.datatransfer.Transferable transferable)
Fetch the text to drop in the editor based on the transferable in the drag and drop operation. |
protected void |
insertDropText(java.awt.datatransfer.Transferable transferable,
int offset)
Perform the actual insertion of text for the drop operation. |
void |
install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane. |
protected boolean |
performDrop(java.awt.datatransfer.Transferable transferable,
int offset)
Perform the actual drop operation for the given transferable and offset. |
protected void |
postInsertDropText(java.awt.datatransfer.Transferable transferable,
int offset)
Perform any additional text editing within the same undo as the drop (which has already been performed.) This allows any implementations to perform any extra text edits (such as adding import-type statements) associated with the text that was dropped. |
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 boolean |
shouldAllowDrag(java.awt.datatransfer.DataFlavor dataFlavor,
int offset)
Fetch whether the drag of the given transferable data flavor should be allowed over the given offset location. |
protected boolean |
shouldPaintDragLocation(java.awt.datatransfer.DataFlavor dataFlavor)
Fetch whether the drag target location should be painted for the given data flavor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DropHandlerPlugin()
DropHandlerPlugin
instance.
Method Detail |
public final void install(BasicEditorPane editor)
install
in interface EditorPlugin
editor
- the editor panepublic void deinstall(BasicEditorPane editor)
deinstall
in interface EditorPlugin
editor
- the editor paneprotected final BasicEditorPane getEditorPane()
protected final BasicDocument getDocument()
public void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.protected final void raiseEditorToFront()
protected abstract java.awt.datatransfer.DataFlavor[] getDataFlavors()
protected abstract java.lang.String getTransferText(java.awt.datatransfer.Transferable transferable)
transferable
- the transferable involved
protected boolean shouldPaintDragLocation(java.awt.datatransfer.DataFlavor dataFlavor)
In general, drops that will insert text into the code editor should paint the target location. If you add extra data flavors that may not result in an edit (i.e., open an editor), then false should be returned here for those data flavors.
dataFlavor
- the current data flavorprotected boolean shouldAllowDrag(java.awt.datatransfer.DataFlavor dataFlavor, int offset)
In general, drags should be allowed unless your data flavor has restrictions on where in the container the drop can be allowed.
dataFlavor
- the current data flavoroffset
- the offset location that is the drop locationprotected boolean performDrop(java.awt.datatransfer.Transferable transferable, int offset)
Implementations should not need to override this routine unless the drop operation is some other task besides dropping the text content of the transferable (such as opening another window.)
transferable
- the transferable associated with the dropoffset
- the location of the dropprotected void insertDropText(java.awt.datatransfer.Transferable transferable, int offset) throws javax.swing.text.BadLocationException
transferable
- the transferable associated with the dropoffset
- the offset associated with the drop
javax.swing.text.BadLocationException
protected void postInsertDropText(java.awt.datatransfer.Transferable transferable, int offset) throws javax.swing.text.BadLocationException
transferable
- the transferable that was droppedoffset
- the offset where the drop had occurred
javax.swing.text.BadLocationException
protected EditDescriptor getDropDescriptor()
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.