com.ibm.lpex.alef.contentassist
Class ContentAssistant

java.lang.Object
  |
  +--com.ibm.lpex.alef.contentassist.ContentAssistant
All Implemented Interfaces:
IContentAssistant

public class ContentAssistant
extends java.lang.Object
implements IContentAssistant

An LPEX-based implementation of the IContentAssistant interface. Usually, clients instantiate this class and configure it before using it.


Field Summary
static int LAYOUT_CONTEXT_INFO_POPUP
           
static int LAYOUT_CONTEXT_SELECTOR
           
static int LAYOUT_PROPOSAL_SELECTOR
           
 
Fields inherited from interface com.ibm.lpex.alef.contentassist.IContentAssistant
CONTEXT_INFO_ABOVE, CONTEXT_INFO_BELOW, PROPOSAL_OVERLAY, PROPOSAL_REMOVE, PROPOSAL_STACKED
 
Constructor Summary
ContentAssistant()
          Creates a new content assistant.
 
Method Summary
 void enableAutoActivation(boolean enabled)
          Sets the content assistant's auto activation state.
 IContentAssistProcessor getContentAssistProcessor(java.lang.String contentType)
          Return the content assist processor which was registered to be used for the given content type.
 void install(org.eclipse.jface.text.ITextViewer textViewer)
          Installs content assist support on the given text viewer.
 void setAutoActivationDelay(int delay)
          Sets the delay after which the content assistant is automatically invoked if the cursor is behind an auto activation character.
 void setContentAssistProcessor(IContentAssistProcessor processor, java.lang.String contentType)
          Registers a given content assist processor for a particular content type.
 void setContextInformationPopupBackground(org.eclipse.swt.graphics.Color background)
          Sets the context information popup's background color.
 void setContextInformationPopupOrientation(int orientation)
          Sets the context information popup's orientation The following values may be used: CONTEXT_ABOVE
 void setProposalPopupOrientation(int orientation)
          Sets the proposal popups' orientation The following values may be used: PROPOSAL_OVERLAY
 java.lang.String showContextInformation()
          Shows context information for the content at the viewer's cursor position.
 java.lang.String showPossibleCompletions()
          Shows all possible completions of the content at the viewer's cursor position.
 void uninstall()
          Uninstalls content assist support from the text viewer it has previously be installed on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAYOUT_PROPOSAL_SELECTOR

public static final int LAYOUT_PROPOSAL_SELECTOR

LAYOUT_CONTEXT_SELECTOR

public static final int LAYOUT_CONTEXT_SELECTOR

LAYOUT_CONTEXT_INFO_POPUP

public static final int LAYOUT_CONTEXT_INFO_POPUP
Constructor Detail

ContentAssistant

public ContentAssistant()
Creates a new content assistant. The content assistant is not automatically activated, overlays the completion proposals with context information list if necessary, and shows the context information above the location at which it was activated. If auto activation will be enabled, without further configuration steps, this content assistant is activated after a 500 ms delay.
Method Detail

setContentAssistProcessor

public void setContentAssistProcessor(IContentAssistProcessor processor,
                                      java.lang.String contentType)
Registers a given content assist processor for a particular content type. If there is already a processor registered for this type, the new processor is registered instead of the old one.
Parameters:
processor - the content assist processor to register, or null to remove an existing one
contentType - the content type under which to register

getContentAssistProcessor

public IContentAssistProcessor getContentAssistProcessor(java.lang.String contentType)
Return the content assist processor which was registered to be used for the given content type.
Specified by:
getContentAssistProcessor in interface IContentAssistant
See Also:
IContentAssistant.getContentAssistProcessor(java.lang.String)

enableAutoActivation

public void enableAutoActivation(boolean enabled)
Sets the content assistant's auto activation state.
Parameters:
enabled - indicates whether auto activation is enabled or not

setAutoActivationDelay

public void setAutoActivationDelay(int delay)
Sets the delay after which the content assistant is automatically invoked if the cursor is behind an auto activation character.
Parameters:
delay - the auto activation delay

setProposalPopupOrientation

public void setProposalPopupOrientation(int orientation)
Sets the proposal popups' orientation The following values may be used:
Parameters:
orientation - the popup's orientation

setContextInformationPopupOrientation

public void setContextInformationPopupOrientation(int orientation)
Sets the context information popup's orientation The following values may be used:
Parameters:
orientation - the popup's orientation

setContextInformationPopupBackground

public void setContextInformationPopupBackground(org.eclipse.swt.graphics.Color background)
Sets the context information popup's background color.
Parameters:
background - the background color

install

public void install(org.eclipse.jface.text.ITextViewer textViewer)
Description copied from interface: IContentAssistant
Installs content assist support on the given text viewer.
Specified by:
install in interface IContentAssistant
Following copied from interface: com.ibm.lpex.alef.contentassist.IContentAssistant
Parameters:
textViewer - the text viewer on which content assist will work

uninstall

public void uninstall()
Description copied from interface: IContentAssistant
Uninstalls content assist support from the text viewer it has previously be installed on.
Specified by:
uninstall in interface IContentAssistant

showPossibleCompletions

public java.lang.String showPossibleCompletions()
Description copied from interface: IContentAssistant
Shows all possible completions of the content at the viewer's cursor position.
Specified by:
showPossibleCompletions in interface IContentAssistant
Following copied from interface: com.ibm.lpex.alef.contentassist.IContentAssistant
Returns:
an optional error message if no proposals can be computed

showContextInformation

public java.lang.String showContextInformation()
Description copied from interface: IContentAssistant
Shows context information for the content at the viewer's cursor position.
Specified by:
showContextInformation in interface IContentAssistant
Following copied from interface: com.ibm.lpex.alef.contentassist.IContentAssistant
Returns:
an optional error message if no context information can be computed