Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

com.ibm.lpex.alef.contentassist
Class ContentAssistant

java.lang.Object
  extended bycom.ibm.lpex.alef.contentassist.ContentAssistant

All Implemented Interfaces:
IContentAssistant, org.eclipse.jface.text.IWidgetTokenKeeper


public class ContentAssistant
extends Object
implements IContentAssistant, org.eclipse.jface.text.IWidgetTokenKeeper

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
          The presentation type for the context information hover .
static int LAYOUT_CONTEXT_SELECTOR
          The presentation type for the context selection popup.
static int LAYOUT_PROPOSAL_SELECTOR
          The presentation type for the proposal selection popup.
static String STORE_SIZE_X
          Dialog store constants.
static String STORE_SIZE_Y
           
static int WIDGET_PRIORITY
          The popup priority: > linked position proposals and hover popups.
 
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()
          Create a new content assistant.
 
Method Summary
protected  void contextInformationClosed()
          Callback to signal this content assistant that the presentation of the context information has been stopped.
 void enableAutoActivation(boolean enabled)
          Enable the content assistant's auto activation mode.
 void enableAutoInsert(boolean enabled)
          Enable the content assistant's auto insertion mode.
 IContentAssistProcessor getContentAssistProcessor(String contentType)
          Return the content assist processor which was registered to be used for the given content type.
 String getDocumentPartitioning()
          Returns the document partitioning this content assistant is using.
 boolean hasProposalPopupFocus()
          Returns whether the content assistant proposal popup has the focus.
protected  void hide()
          Hides any open popups.
 void install(org.eclipse.jface.text.ITextViewer textViewer)
          Install content-assist support on the given LpexTextViewer.
 boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner owner)
          The given widget token owner requests the widget token from this token keeper.
 boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner owner, int priority)
          The given widget token owner requests the widget token from this token keeper.
 void setAutoActivationDelay(int delay)
          Set the delay after which the content assistant is automatically invoked if the cursor is behind an auto activation character.
 void setContentAssistProcessor(IContentAssistProcessor processor, String contentType)
          Register a given content assist processor for a particular content type.
 void setContextInformationPopupBackground(org.eclipse.swt.graphics.Color background)
          Set the context information popup's background color.
 void setContextInformationPopupForeground(org.eclipse.swt.graphics.Color foreground)
          Set the context information popup's foreground color.
 void setContextInformationPopupOrientation(int orientation)
          Set the context information popup's orientation.
 void setContextSelectorBackground(org.eclipse.swt.graphics.Color background)
          Set the context selector's background color.
 void setContextSelectorForeground(org.eclipse.swt.graphics.Color foreground)
          Set the context selector's foreground color.
 void setDocumentPartitioning(String partitioning)
          Sets the document partitioning this content assistant is using.
 void setInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator creator)
          Set the information control creator for the additional information control.
 void setProposalPopupOrientation(int orientation)
          Set the proposal popups' orientation.
 void setProposalSelectorBackground(org.eclipse.swt.graphics.Color background)
          Set the proposal selector's background color.
 void setProposalSelectorForeground(org.eclipse.swt.graphics.Color foreground)
          Set the proposal's foreground color.
 String showContextInformation()
          Show context information for the content at the viewer's cursor position.
 String showPossibleCompletions()
          Show all possible completions of the content at the viewer's cursor position.
 String showProposals(boolean autoActivated)
          Bring up the proposals window.
 void uninstall()
          Uninstall content-assist support from the text viewer it was previously installed on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

 

Field Detail

 

 

STORE_SIZE_X

public static final String STORE_SIZE_X

Dialog store constants.

See Also:
Constant Field Values


 

 

STORE_SIZE_Y

public static final String STORE_SIZE_Y

See Also:
Constant Field Values


 

 

LAYOUT_PROPOSAL_SELECTOR

public static final int LAYOUT_PROPOSAL_SELECTOR

The presentation type for the proposal selection popup.

See Also:
Constant Field Values


 

 

LAYOUT_CONTEXT_SELECTOR

public static final int LAYOUT_CONTEXT_SELECTOR

The presentation type for the context selection popup.

See Also:
Constant Field Values


 

 

LAYOUT_CONTEXT_INFO_POPUP

public static final int LAYOUT_CONTEXT_INFO_POPUP

The presentation type for the context information hover .

See Also:
Constant Field Values


 

 

WIDGET_PRIORITY

public static final int WIDGET_PRIORITY

The popup priority: > linked position proposals and hover popups. Default value: 20.

See Also:
Constant Field Values
Constructor Detail

 

 

ContentAssistant

public ContentAssistant()

Create 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 500ms delay. It uses the default partitioning.

Method Detail

 

 

setDocumentPartitioning

public void setDocumentPartitioning(String partitioning)

Sets the document partitioning this content assistant is using.

Parameters:
partitioning - the document partitioning for this content assistant


 

 

getDocumentPartitioning

public String getDocumentPartitioning()

Returns the document partitioning this content assistant is using.

Returns:
the document partitioning this content assistant is using
See Also:
org.eclipse.jface.text.contentassist.IContentAssistantExtension#getDocumentPartitioning()


 

 

setContentAssistProcessor

public void setContentAssistProcessor(IContentAssistProcessor processor,
                                      String contentType)

Register 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. Use the document-parser language, as defined in LpexCommonParser.getLanguage(LpexDocumentLocation), as content type.

Parameters:
processor - the content assist processor to register, or null to remove an existing one
contentType - the document content type under which to register


 

 

getContentAssistProcessor

public IContentAssistProcessor getContentAssistProcessor(String contentType)

Return the content assist processor which was registered to be used for the given content type.

Specified by:
getContentAssistProcessor in interface IContentAssistant

Parameters:
contentType - the type of the content for which this content assistant is to be requested
Returns:
an instance content assist processor or null if none exists for the specified content type
See Also:
setContentAssistProcessor(com.ibm.lpex.alef.contentassist.IContentAssistProcessor, java.lang.String)


 

 

enableAutoActivation

public void enableAutoActivation(boolean enabled)

Enable the content assistant's auto activation mode.

Parameters:
enabled - indicates whether auto activation should be enabled or not


 

 

enableAutoInsert

public void enableAutoInsert(boolean enabled)

Enable the content assistant's auto insertion mode. If enabled, the content assistant inserts a proposal automatically if it is the only proposal. In the case of ambiguities, the user must make the choice.

Parameters:
enabled - indicates whether auto insertion should be enabled or not


 

 

setAutoActivationDelay

public void setAutoActivationDelay(int delay)

Set 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)

Set the proposal popups' orientation. The following values may be used:

  • PROPOSAL_OVERLAY - proposal popup windows should overlay each other
  • PROPOSAL_REMOVE - any currently shown proposal popup should be closed
  • PROPOSAL_STACKED - proposal popup windows should be vertically stacked, with no overlap, beneath the line containing the current cursor location.

Parameters:
orientation - the popup's orientation


 

 

setContextInformationPopupOrientation

public void setContextInformationPopupOrientation(int orientation)

Set the context information popup's orientation. The following values may be used:

  • CONTEXT_ABOVE - context information popup should always appear above the line containing the current cursor location
  • CONTEXT_BELOW - context information popup should always appear below the line containing the current cursor location.

Parameters:
orientation - the popup's orientation


 

 

setContextInformationPopupBackground

public void setContextInformationPopupBackground(org.eclipse.swt.graphics.Color background)

Set the context information popup's background color.


 

 

setContextInformationPopupForeground

public void setContextInformationPopupForeground(org.eclipse.swt.graphics.Color foreground)

Set the context information popup's foreground color.


 

 

setProposalSelectorBackground

public void setProposalSelectorBackground(org.eclipse.swt.graphics.Color background)

Set the proposal selector's background color.


 

 

setProposalSelectorForeground

public void setProposalSelectorForeground(org.eclipse.swt.graphics.Color foreground)

Set the proposal's foreground color.


 

 

setContextSelectorBackground

public void setContextSelectorBackground(org.eclipse.swt.graphics.Color background)

Set the context selector's background color.


 

 

setContextSelectorForeground

public void setContextSelectorForeground(org.eclipse.swt.graphics.Color foreground)

Set the context selector's foreground color.


 

 

setInformationControlCreator

public void setInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator creator)

Set the information control creator for the additional information control.


 

 

install

public void install(org.eclipse.jface.text.ITextViewer textViewer)

Description copied from interface: IContentAssistant
Install content-assist support on the given LpexTextViewer.

Specified by:
install in interface IContentAssistant

Parameters:
textViewer - the LpexTextViewer on which content assist will work


 

 

uninstall

public void uninstall()

Description copied from interface: IContentAssistant
Uninstall content-assist support from the text viewer it was previously installed on.

Specified by:
uninstall in interface IContentAssistant


 

 

showPossibleCompletions

public String showPossibleCompletions()

Show all possible completions of the content at the viewer's cursor position. Called by LpexSourceViewer#doOperation() on the registered ContentAssistant, when an action defined with the operation code ISourceViewer.CONTENTASSIST_PROPOSALS is explicitly selected by the user.

The implementation of this method calls showProposals(false).

Specified by:
showPossibleCompletions in interface IContentAssistant

Returns:
an optional error message if no proposals can be computed
See Also:
IContentAssistant.showPossibleCompletions()


 

 

showProposals

public String showProposals(boolean autoActivated)

Bring up the proposals window. Shows all the possible completions of the content at the viewer's cursor position.

Called:

  • on automatic content-assist triggering (autoActivated = true)
  • by method showPossibleCompletions() on explicit content-assist invocation by the user (autoActivated = false).

Since:
LPEX 3.0.0


 

 

contextInformationClosed

protected void contextInformationClosed()

Callback to signal this content assistant that the presentation of the context information has been stopped.


 

 

showContextInformation

public String showContextInformation()

Show context information for the content at the viewer's cursor position. Called by LpexSourceViewer#doOperation() on the registered ContentAssistant, when an action defined with the operation code ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION is selected.

Specified by:
showContextInformation in interface IContentAssistant

Returns:
an optional error message if no context information can be computed
See Also:
IContentAssistant.showContextInformation()


 

 

requestWidgetToken

public boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner owner)

The given widget token owner requests the widget token from this token keeper. The default implementation of this method does nothing except return false (the token has not been released).

Specified by:
requestWidgetToken in interface org.eclipse.jface.text.IWidgetTokenKeeper

See Also:
IWidgetTokenKeeper.requestWidgetToken(IWidgetTokenOwner)


 

 

requestWidgetToken

public boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner owner,
                                  int priority)

The given widget token owner requests the widget token from this token keeper. Returns true if the token is released by this token keeper. Note, the keeper must not call releaseWidgetToken(IWidgetTokenKeeper) explicitly.

The general contract is that the receiver should release the token if priority exceeds the receiver's priority.

See Also:
IWidgetTokenKeeperExtension.requestWidgetToken(org.eclipse.jface.text.IWidgetTokenOwner, int)


 

 

hide

protected void hide()

Hides any open popups.


 

 

hasProposalPopupFocus

public boolean hasProposalPopupFocus()

Returns whether the content assistant proposal popup has the focus.

Returns:
true if the proposal popup has the focus


 

Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD