Eclipse Platform
Release 3.0

org.eclipse.ui.texteditor.templates
Class TemplateVariableProposal

java.lang.Object
  extended byorg.eclipse.ui.texteditor.templates.TemplateVariableProposal
All Implemented Interfaces:
ICompletionProposal

public class TemplateVariableProposal
extends Object
implements ICompletionProposal

A proposal for insertion of template variables.

This class should not be used by clients and may become package visible in the future.

Since:
3.0

Constructor Summary
TemplateVariableProposal(TemplateVariableResolver variable, int offset, int length, ITextViewer viewer)
          Creates a template variable proposal.
 
Method Summary
 void apply(IDocument document)
          Inserts the proposed completion into the given document.
 String getAdditionalProposalInfo()
          Returns optional additional information about the proposal.
 IContextInformation getContextInformation()
          Returns optional context information associated with this proposal.
 String getDisplayString()
          Returns the string to be displayed in the list of completion proposals.
 Image getImage()
          Returns the image to be displayed in the list of completion proposals.
 Point getSelection(IDocument document)
          Returns the new selection after the proposal has been applied to the given document in absolute document coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateVariableProposal

public TemplateVariableProposal(TemplateVariableResolver variable,
                                int offset,
                                int length,
                                ITextViewer viewer)
Creates a template variable proposal.

Parameters:
variable - the template variable
offset - the offset to replace
length - the length to replace
viewer - the viewer
Method Detail

apply

public void apply(IDocument document)
Description copied from interface: ICompletionProposal
Inserts the proposed completion into the given document.

Specified by:
apply in interface ICompletionProposal
Parameters:
document - the document into which to insert the proposed completion

getSelection

public Point getSelection(IDocument document)
Description copied from interface: ICompletionProposal
Returns the new selection after the proposal has been applied to the given document in absolute document coordinates. If it returns null, no new selection is set. A document change can trigger other document changes, which have to be taken into account when calculating the new selection. Typically, this would be done by installing a document listener or by using a document position during ICompletionProposal.apply(IDocument).

Specified by:
getSelection in interface ICompletionProposal
Parameters:
document - the document into which the proposed completion has been inserted
Returns:
the new selection in absolute document coordinates

getAdditionalProposalInfo

public String getAdditionalProposalInfo()
Description copied from interface: ICompletionProposal
Returns optional additional information about the proposal. The additional information will be presented to assist the user in deciding if the selected proposal is the desired choice.

Specified by:
getAdditionalProposalInfo in interface ICompletionProposal
Returns:
the additional information or null

getDisplayString

public String getDisplayString()
Description copied from interface: ICompletionProposal
Returns the string to be displayed in the list of completion proposals.

Specified by:
getDisplayString in interface ICompletionProposal
Returns:
the string to be displayed

getImage

public Image getImage()
Description copied from interface: ICompletionProposal
Returns the image to be displayed in the list of completion proposals. The image would typically be shown to the left of the display string.

Specified by:
getImage in interface ICompletionProposal
Returns:
the image to be shown or null if no image is desired

getContextInformation

public IContextInformation getContextInformation()
Description copied from interface: ICompletionProposal
Returns optional context information associated with this proposal. The context information will automatically be shown if the proposal has been applied.

Specified by:
getContextInformation in interface ICompletionProposal
Returns:
the context information for this proposal or null

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.