Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.codeassist.cobol
Class CompletionProcessor

java.lang.Object
  extended by com.ibm.etools.iseries.edit.codeassist.cobol.CompletionProcessor
Direct Known Subclasses:
CobolCompletionProcessor

public abstract class CompletionProcessor
extends Object

Abstract class for code assist on LPEX editor. This class implements IContentAssistProcessor, which prepares code assist functions. Subclass should be implemented for each language.

LPEX editor uses methods of this class or subclass's methods for code assist.

See Also:
IContentAssistProcessor

Field Summary
protected  LpexParser _oldParser
           
protected  boolean _parserChanged
           
protected static boolean fDebug
          Flag if debug information is outputted.
 
Constructor Summary
CompletionProcessor(LpexSourceViewer sourceViewer)
          Construct an object of CompletionProcessor.
 
Method Summary
 ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset)
          Return a list of completion proposals based on the specified location within the document that corresponds to the current cursor position within the text viewer.
 IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset)
          Return a list of information about possible contexts, based on the specified location within the document that corresponds to the current cursor position within the text viewer.
 char[] getCompletionProposalAutoActivationCharacters()
          Return the characters which, when entered by the user, should automatically trigger the presentation of possible completions.
 char[] getContextInformationAutoActivationCharacters()
          Return the characters which, when entered by the user, should automatically trigger the presentation of context information.
 IContextInformationValidator getContextInformationValidator()
          Return a validator used to determine when displayed context information should be dismissed.
 String getErrorMessage()
          Return the reason why this content assist processor was unable to produce any completion proposals or context information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fDebug

protected static boolean fDebug
Flag if debug information is outputted.


_oldParser

protected LpexParser _oldParser

_parserChanged

protected boolean _parserChanged
Constructor Detail

CompletionProcessor

public CompletionProcessor(LpexSourceViewer sourceViewer)
Construct an object of CompletionProcessor.

This method creates a new processor, and also creates a language parser used for parsing the source file and syntax libraries for check the language syntax.

Parameters:
lpexEditor - - LPEX editor to use this processor.
Method Detail

computeCompletionProposals

public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
                                                        int documentOffset)
Return a list of completion proposals based on the specified location within the document that corresponds to the current cursor position within the text viewer. LPEX currently ignores documentOffset, assuming the current cursor position.

When the user requests code assist, LPEX invokes this method and presents the returned proposals.

This method gets the current statement string from the parser, and gets the possible syntax elements by using syntax library, and then creats the proposals based on defined syntax elements in the source file.

Parameters:
viewer - the LpexTextViewer requesting content-assist proposals.
documentOffset - ignored (LPEX's content assist will probably always pass a -1 here anyway), content assist at the current cursor position is assumed.
Returns:
an arry of complition proposals, or null if no proposals are possible.
See Also:
IContentAssistProcessor#computeCompletionProposals(ITextViewer, int).

computeContextInformation

public IContextInformation[] computeContextInformation(ITextViewer viewer,
                                                       int documentOffset)
Return a list of information about possible contexts, based on the specified location within the document that corresponds to the current cursor position within the text viewer. LPEX currently ignores documentOffset, assuming the current cursor position. Current implementation always returns null.

When the user requests syntax assist, LPEX invokes this method and presents the returned information

This method will be implemented in the future.

Parameters:
viewer - the LpexTextViewer requesting information about possible contexts.
documentOffset - ignored (LPEX's content assist will probably always pass a -1 here anyway), content assist at the current cursor position is assumed.
Returns:
an arry of information about possible contexts, or null if no information are possible.
See Also:
IContentAssistProcessor#computeContextInformation(ITextViewer, int).

getCompletionProposalAutoActivationCharacters

public char[] getCompletionProposalAutoActivationCharacters()
Return the characters which, when entered by the user, should automatically trigger the presentation of possible completions. Current implementation always returns null.

Returns:
the auto activation characters for completion proposal, or null if no auto activation is desired.
See Also:
IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()

getContextInformationAutoActivationCharacters

public char[] getContextInformationAutoActivationCharacters()
Return the characters which, when entered by the user, should automatically trigger the presentation of context information. Current implementation always returns null.

Returns:
the auto activation characters for context information, or null if no auto activation is desired.
See Also:
IContentAssistProcessor#getContextInformationAutoActivationCharacters()

getErrorMessage

public String getErrorMessage()
Return the reason why this content assist processor was unable to produce any completion proposals or context information.

Returns:
an error message, or null if no error occurred.
See Also:
IContentAssistProcessor#getErrorMessage()

getContextInformationValidator

public IContextInformationValidator getContextInformationValidator()
Return a validator used to determine when displayed context information should be dismissed. May only return null if the processor is incapable of computing context information. Current implementation always returns null.

Returns:
a context information validator, or null if the processor is incapable of computing context information.
See Also:
IContentAssistProcessor#getContextInformationValidator()

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.