com.aptana.ide.editor.css.contentassist
Class CSSContentAssistProcessor

java.lang.Object
  extended by com.aptana.ide.editors.unified.contentassist.UnifiedContentAssistProcessor
      extended by com.aptana.ide.editor.css.contentassist.CSSContentAssistProcessor
All Implemented Interfaces:
IUnifiedContentAssistProcessor, org.eclipse.jface.text.contentassist.IContentAssistProcessor

public class CSSContentAssistProcessor
extends UnifiedContentAssistProcessor
implements org.eclipse.jface.text.contentassist.IContentAssistProcessor


Field Summary
static java.lang.String ARG_ASSIST
          ARG_ASSIST indicates we are between a : and a ;
static java.lang.String ERROR
          ERROR indicates we in a problem state, and should bail
static java.lang.String INSIDE_RULE
          INSIDE_RULE indicates we are between a { and a } Here we show the full list of CSS properties, or filtered by what is already typed
static java.lang.String OUTSIDE_RULE
          OUTSIDE_RULE indicates we are between two rules (between a } and a {
 
Fields inherited from class com.aptana.ide.editors.unified.contentassist.UnifiedContentAssistProcessor
DEFAULT_CHARACTER, unifiedViewer
 
Constructor Summary
CSSContentAssistProcessor(EditorFileContext context)
          Provides code assist information for CSS.
 
Method Summary
 boolean addColon(Lexeme currentLexeme, LexemeList lexemeList)
          addColon
 org.eclipse.jface.text.contentassist.ICompletionProposal[] computeInnerCompletionProposals(org.eclipse.jface.text.ITextViewer viewer, int offset, int position, LexemeList lexemeList, char activationChar, char previousChar)
          Generates the completion proposals for code assist
 org.eclipse.jface.text.contentassist.IContextInformation[] computeInnerContextInformation(java.lang.String documentSource, int offset, int position, LexemeList lexemeList)
          Generates the context information for code assist
 org.eclipse.jface.text.contentassist.ICompletionProposal[] getAllPropertiesCompletionProposals(java.lang.String prefix, Lexeme currentLexeme, boolean addColon)
          Returns a set of valid completion proposals.
 char[] getCompletionProposalAutoActivationCharacters()
          The characters that triggers competion proposals (dot for completion, and space for "new XX" in our case)
 int[] getCompletionProposalIdleActivationTokens()
          The token types that triggers competion proposals on idle
 int[] getCompletionProposalSeparatorLexemes()
          The characters that triggers completion proposals (dot for completion, and space for "new XX" in our case)
 org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
           
 CSSOffsetMapper getCSSOffsetMapper()
          getOffsetMapper
 Lexeme getCurrentLexeme(int offset)
          Calculates the current lexeme in the document
 org.eclipse.jface.text.contentassist.ICompletionProposal[] getElementCompletionProposals(java.lang.String prefix, char activationChar, Lexeme currentLexeme)
          Returns a set of valid completion proposals.
 java.lang.String getErrorMessage()
           
 java.lang.String getLocation(int offset, int currentLexemePosition, LexemeList ll, char activationCharacter)
          Returns the "location" we are currently in.
 int getOffsetForInsertion(int offset, Lexeme currentLexeme)
          Gets the offset for inserting a new item into the document
 IOffsetMapper getOffsetMapper()
          Returns a reference to the current offsetMapper
protected  org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
          Returns the current preference store
 java.lang.String getPropertyPrefix()
          getPropertyPrefix
 java.util.Comparator getProposalComparator()
          The proposal comparator
 org.eclipse.jface.text.contentassist.ICompletionProposal[] getSpecificPropertyCompletionProposals(int offset, java.lang.String propertyName, java.lang.String valueName, Lexeme currentLexeme)
          Returns a set of valid completion proposals.
 java.lang.String getValuePrefix()
          getValuePrefix
static boolean insertColon(org.eclipse.jface.preference.IPreferenceStore store)
          Do we insert a colon?
static boolean insertSemicolon(org.eclipse.jface.preference.IPreferenceStore store)
          Do we insert a semicolon?
 void setPrefixes(java.lang.String location)
          setPrefixes
 
Methods inherited from class com.aptana.ide.editors.unified.contentassist.UnifiedContentAssistProcessor
addCompletionProposalContributor, combine, computeCompletionProposals, computeCompletionProposals, computeContextInformation, computeCurrentLexemeIndex, computeCurrentLexemeIndex, containsExactProposalMatch, getActivationChar, getActivationChar, getAllUserAgentImages, getCompletionProposalAllActivationCharacters, getCompletionProposalContributors, getCompletionProposalPrivateActivationCharacters, getContextInformationAutoActivationCharacters, getDefaultUserAgents, getGreyUserAgentImages, getPreviousChar, getPreviousLexeme, getPreviousLexemeOfType, getPreviousLexemeOfType, getUserAgentImages, getUserAgentImages, getUserAgents, isValidIdleActivationLocation, isValidIdleActivationToken, removeCompletionProposalContributor, resetViewerState, setSelection, setSelectionUnsorted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
computeCompletionProposals, computeContextInformation, getContextInformationAutoActivationCharacters
 

Field Detail

INSIDE_RULE

public static java.lang.String INSIDE_RULE
INSIDE_RULE indicates we are between a { and a } Here we show the full list of CSS properties, or filtered by what is already typed


OUTSIDE_RULE

public static java.lang.String OUTSIDE_RULE
OUTSIDE_RULE indicates we are between two rules (between a } and a {


ARG_ASSIST

public static java.lang.String ARG_ASSIST
ARG_ASSIST indicates we are between a : and a ;


ERROR

public static java.lang.String ERROR
ERROR indicates we in a problem state, and should bail

Constructor Detail

CSSContentAssistProcessor

public CSSContentAssistProcessor(EditorFileContext context)
Provides code assist information for CSS.

Parameters:
context -
Method Detail

getCompletionProposalAutoActivationCharacters

public char[] getCompletionProposalAutoActivationCharacters()
The characters that triggers competion proposals (dot for completion, and space for "new XX" in our case)

Specified by:
getCompletionProposalAutoActivationCharacters in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
Overrides:
getCompletionProposalAutoActivationCharacters in class UnifiedContentAssistProcessor
Returns:
Returns the trigger characters for code completion.

getCompletionProposalSeparatorLexemes

public int[] getCompletionProposalSeparatorLexemes()
The characters that triggers completion proposals (dot for completion, and space for "new XX" in our case)

Overrides:
getCompletionProposalSeparatorLexemes in class UnifiedContentAssistProcessor
Returns:
Returns the trigger characters for code completion.

computeInnerCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] computeInnerCompletionProposals(org.eclipse.jface.text.ITextViewer viewer,
                                                                                                  int offset,
                                                                                                  int position,
                                                                                                  LexemeList lexemeList,
                                                                                                  char activationChar,
                                                                                                  char previousChar)
Description copied from class: UnifiedContentAssistProcessor
Generates the completion proposals for code assist

Specified by:
computeInnerCompletionProposals in class UnifiedContentAssistProcessor
offset - The integer offset of the current insertion point
Returns:
An array of completion proposals, or null if not valid
See Also:
UnifiedContentAssistProcessor.computeInnerCompletionProposals(org.eclipse.jface.text.ITextViewer, int, int, com.aptana.ide.lexer.LexemeList, char, char)

setPrefixes

public void setPrefixes(java.lang.String location)
setPrefixes

Parameters:
location -

getLocation

public java.lang.String getLocation(int offset,
                                    int currentLexemePosition,
                                    LexemeList ll,
                                    char activationCharacter)
Returns the "location" we are currently in. What this means in the end is that it helps us figure out which of three states we are in. This also sets the current name hash (which should be moved to CSSOffsetMapper eventually)

Parameters:
offset - The current offset
currentLexemePosition -
ll -
activationCharacter -
Returns:
One of the location enumerations

getContextInformationValidator

public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator()
Specified by:
getContextInformationValidator in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getContextInformationValidator()

getCompletionProposalIdleActivationTokens

public int[] getCompletionProposalIdleActivationTokens()
Description copied from interface: IUnifiedContentAssistProcessor
The token types that triggers competion proposals on idle

Specified by:
getCompletionProposalIdleActivationTokens in interface IUnifiedContentAssistProcessor
Specified by:
getCompletionProposalIdleActivationTokens in class UnifiedContentAssistProcessor
Returns:
Returns the trigger tokens for code completion.
See Also:
IUnifiedContentAssistProcessor.getCompletionProposalIdleActivationTokens()

getErrorMessage

public java.lang.String getErrorMessage()
Specified by:
getErrorMessage in interface org.eclipse.jface.text.contentassist.IContentAssistProcessor
See Also:
IContentAssistProcessor.getErrorMessage()

getElementCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] getElementCompletionProposals(java.lang.String prefix,
                                                                                                char activationChar,
                                                                                                Lexeme currentLexeme)
Returns a set of valid completion proposals.

Parameters:
prefix - The text already typed (to filter on)
activationChar - The char used to activate the code assist
currentLexeme -
Returns:
Returns an array of completion proposals.

getSpecificPropertyCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] getSpecificPropertyCompletionProposals(int offset,
                                                                                                         java.lang.String propertyName,
                                                                                                         java.lang.String valueName,
                                                                                                         Lexeme currentLexeme)
Returns a set of valid completion proposals.

Parameters:
offset -
propertyName - The text already typed for the "property"
valueName - The text already typed for the "value"
currentLexeme -
Returns:
Returns an array of completion proposals.

getOffsetForInsertion

public int getOffsetForInsertion(int offset,
                                 Lexeme currentLexeme)
Gets the offset for inserting a new item into the document

Parameters:
offset -
currentLexeme -
Returns:
The index at which to insert

addColon

public boolean addColon(Lexeme currentLexeme,
                        LexemeList lexemeList)
addColon

Parameters:
currentLexeme -
lexemeList -
Returns:
boolean

getAllPropertiesCompletionProposals

public org.eclipse.jface.text.contentassist.ICompletionProposal[] getAllPropertiesCompletionProposals(java.lang.String prefix,
                                                                                                      Lexeme currentLexeme,
                                                                                                      boolean addColon)
Returns a set of valid completion proposals.

Parameters:
prefix - The text already typed (to filter on)
currentLexeme -
addColon -
Returns:
Returns an array of completion proposals.

getCSSOffsetMapper

public CSSOffsetMapper getCSSOffsetMapper()
getOffsetMapper

Returns:
CSSOffsetMapper

getOffsetMapper

public IOffsetMapper getOffsetMapper()
Returns a reference to the current offsetMapper

Specified by:
getOffsetMapper in interface IUnifiedContentAssistProcessor
Specified by:
getOffsetMapper in class UnifiedContentAssistProcessor
Returns:
The reference to the mapper

getCurrentLexeme

public Lexeme getCurrentLexeme(int offset)
Calculates the current lexeme in the document

Parameters:
offset - the offset of the current insertion point
Returns:
The current lexeme, or null if not found

getPreferenceStore

protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
Description copied from class: UnifiedContentAssistProcessor
Returns the current preference store

Specified by:
getPreferenceStore in class UnifiedContentAssistProcessor
Returns:
The current preference store, or null if not found
See Also:
UnifiedContentAssistProcessor.getPreferenceStore()

getPropertyPrefix

public java.lang.String getPropertyPrefix()
getPropertyPrefix

Returns:
String

getValuePrefix

public java.lang.String getValuePrefix()
getValuePrefix

Returns:
String

computeInnerContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation[] computeInnerContextInformation(java.lang.String documentSource,
                                                                                                 int offset,
                                                                                                 int position,
                                                                                                 LexemeList lexemeList)
Description copied from class: UnifiedContentAssistProcessor
Generates the context information for code assist

Specified by:
computeInnerContextInformation in class UnifiedContentAssistProcessor
Parameters:
documentSource - The source text of the document
offset - The integer offset of the current insertion point
Returns:
An array of completion proposals, or null if not valid
See Also:
UnifiedContentAssistProcessor.computeInnerContextInformation(java.lang.String, int, int, com.aptana.ide.lexer.LexemeList)

insertColon

public static boolean insertColon(org.eclipse.jface.preference.IPreferenceStore store)
Do we insert a colon?

Parameters:
store -
Returns:
String

insertSemicolon

public static boolean insertSemicolon(org.eclipse.jface.preference.IPreferenceStore store)
Do we insert a semicolon?

Parameters:
store -
Returns:
String

getProposalComparator

public java.util.Comparator getProposalComparator()
Description copied from class: UnifiedContentAssistProcessor
The proposal comparator

Specified by:
getProposalComparator in class UnifiedContentAssistProcessor
Returns:
Comparator
See Also:
UnifiedContentAssistProcessor.getProposalComparator()