org.eclipse.wst.common.snippets.ui
Class DefaultSnippetInsertion

java.lang.Object
  extended by org.eclipse.wst.common.snippets.ui.DefaultSnippetInsertion
All Implemented Interfaces:
ISnippetInsertion

public class DefaultSnippetInsertion
extends java.lang.Object
implements ISnippetInsertion

An insertion implementation that supports ISnippetVariables. The content string of the item can contain markers, in the form ${+variable+}, that will be replaced with user-supplied values at insertion time.

Clients may subclass this class.

Since:
1.0

Constructor Summary
DefaultSnippetInsertion()
          Default constructor.
 
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 editorPart)
          The target editorpart in the workbench window.
 void setItem(ISnippetItem item)
          Use this ISnippetItem
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSnippetInsertion

public DefaultSnippetInsertion()
Default constructor. Subclasses may call, but only the Snippets view should ever instantiate an insertion.

Method Detail

dragSetData

public void dragSetData(org.eclipse.swt.dnd.DragSourceEvent event,
                        ISnippetItem item)
Description copied from interface: ISnippetInsertion
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.

Specified by:
dragSetData in interface ISnippetInsertion
Parameters:
event - - the information associated with the drag set data event
item - - the ISnippetItem instance from which to derive the data

getTransfers

public org.eclipse.swt.dnd.Transfer[] getTransfers()
Description copied from interface: ISnippetInsertion
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.

Specified by:
getTransfers in interface ISnippetInsertion
Returns:
the list of valid transfer types during Drag and Drop

insert

public void insert(org.eclipse.ui.IEditorPart editorPart)
Description copied from interface: ISnippetInsertion
Insert the current ISnippetItem's insertion String to the given IEditorPart. Used by double-click behavior.

Specified by:
insert in interface ISnippetInsertion
Parameters:
editorPart - the editor part into which to insert

setEditorPart

public void setEditorPart(org.eclipse.ui.IEditorPart editorPart)
Description copied from interface: ISnippetInsertion
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.

Specified by:
setEditorPart in interface ISnippetInsertion
Parameters:
editorPart - the target editor part

setItem

public void setItem(ISnippetItem item)
Description copied from interface: ISnippetInsertion
Use this ISnippetItem

Specified by:
setItem in interface ISnippetInsertion
Parameters:
item - the item to insert