org.eclipse.wst.common.snippets.ui
Interface ISnippetInsertion

All Known Implementing Classes:
DefaultSnippetInsertion

public interface ISnippetInsertion

An insertion class is responsible for inserting a snippet item's contents into editors. Implementors are responsible for supporting the drag-and-drop mechanism and inserting the snippet's text into a given editor part.

Clients may implement this interface.

Since:
1.0

Method Summary
 void dragSetData(org.eclipse.swt.dnd.DragSourceEvent event, ISnippetItem item)
          The data is required from the drag source.
 org.eclipse.swt.dnd.Transfer[] getTransfers()
          The Transfer types to support from a drag source.
 void insert(org.eclipse.ui.IEditorPart editorPart)
          Insert the current ISnippetItem's insertion String to the given IEditorPart.
 void setEditorPart(org.eclipse.ui.IEditorPart targetPart)
          The target editorpart in the workbench window.
 void setItem(ISnippetItem item)
          Use this ISnippetItem
 

Method Detail

dragSetData

void dragSetData(org.eclipse.swt.dnd.DragSourceEvent event,
                 ISnippetItem item)
The data is required from the drag source.

The following fields in the DragSourceEvent should be examined/updated by the Insertion object:

Subclasses should check which Transfer types are supported and set the data accordingly.

Parameters:
event - - the information associated with the drag set data event
item - - the ISnippetItem instance from which to derive the data

getTransfers

org.eclipse.swt.dnd.Transfer[] getTransfers()
The Transfer types to support from a drag source. May be null. Required to do anything more complicated than a simple text drop with DND, a matching IDropAction should be registered to handle the insertion at drop-time.

Returns:
the list of valid transfer types during Drag and Drop

insert

void insert(org.eclipse.ui.IEditorPart editorPart)
Insert the current ISnippetItem's insertion String to the given IEditorPart. Used by double-click behavior.

Parameters:
editorPart - the editor part into which to insert

setEditorPart

void setEditorPart(org.eclipse.ui.IEditorPart targetPart)
The target editorpart in the workbench window. May be used as a hint for determining which Transfer types to allow and what transfer data to set during Drag and Drop operations.

Parameters:
targetPart - the target editor part

setItem

void setItem(ISnippetItem item)
Use this ISnippetItem

Parameters:
item - the item to insert