com.aptana.ide.editors.unified
Class BaseContributor

java.lang.Object
  extended by com.aptana.ide.editors.unified.BaseContributor
All Implemented Interfaces:
IUnifiedEditorContributor
Direct Known Subclasses:
CSSContributor, HTMLContributor, JSCommentContributor, JSContributor, ScriptDocContributor, XMLContributor

public abstract class BaseContributor
extends java.lang.Object
implements IUnifiedEditorContributor

BaseContributor


Field Summary
protected  IUnifiedEditorContributor parent
          parent
 
Constructor Summary
protected BaseContributor(java.lang.String language)
          Creates a new base contributor with a language type.
 
Method Summary
 void configLocalPresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler reconciler)
          configLocalPresentationReconciler
 void configPresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler reconciler)
          Configures the PresentationReconcilers for all the various languages in the editor
 void dispose()
          Disposes the contributor
 IUnifiedEditorContributor findChildContributor(java.lang.String contentType)
          Gets the language contributors for the specified mime type
 org.eclipse.jface.text.IAutoEditStrategy[] getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the AutoEditStrategies for all the various languages in the editor
 IUnifiedBracketInserter getBracketInserter(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the bracket inserter for all the various languages in the editor
 IUnifiedEditorContributor[] getChildContributors()
          Gets the language contributors for all the various languages in the editor
 org.eclipse.jface.text.contentassist.IContentAssistProcessor getContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the ContentAssistProcessor for all the various languages in the editor
 java.lang.String[] getContentTypes()
          Gets the MimeTypes for all the languages that exist in the editor
 org.eclipse.jface.text.ITextDoubleClickStrategy getDoubleClickStrategy(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Sets the default double-click strategy
 EditorFileContext getFileContext()
          Gets the FileContext for the editor
 java.lang.String[] getIndentPrefixes(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          This is for the way eclipse handles things like auto indent and multi line tabbing.
 java.lang.String getIndentString(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          A helper method that returns the indent string that should be used to prefix lines.
 org.eclipse.jface.text.IAutoEditStrategy[] getLocalAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the AutoEditStrategies for the local language type
 IUnifiedBracketInserter getLocalBracketInserter(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the local bracket isnerter for all the various languages in the editor
 org.eclipse.jface.text.contentassist.IContentAssistProcessor getLocalContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the ContentAssistProcessor for the local language type
 java.lang.String getLocalContentType()
          Returns the language specified in the BaseContributor(String language) constructor.
protected  java.lang.String[] getLocalIndentPrefixes()
          getLocalIndentPrefixes
 org.eclipse.jface.text.ITextHover getLocalTextHover(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Returns an instance of the TextHover class for the specified content type
 org.eclipse.jface.text.source.SourceViewerConfiguration getParentConfiguration()
          Gets the Parent SourceViewerConfiguration
 org.eclipse.jface.text.ITextHover getTextHover(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          Gets the text hover for the given content type
 boolean isAutoActivateContentAssist()
          Should content assist auto activate
 boolean isValidActivationCharacter(char c, int keyCode)
          isValidActivationCharacter
 boolean isValidIdentifier(char c, int keyCode)
          isValidIdentifier
 void setAllIndentPrefixes(java.lang.String[] prefixes, org.eclipse.jface.text.source.ISourceViewer sourceViewer)
          Sets index prefixes for all lanugages, overriding any current settings
 void setFileContext(EditorFileContext fileContext)
          Sets the current language service
 void setIndentPrefixes(java.lang.String[] prefixes, org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)
          The indent strings for a language, use this method to change the defaults at runtime for a specific language in an editor.
protected  void setLocalIndentPrefixes(java.lang.String[] prefixes)
          setLocalIndentPrefixes
 void setParent(IUnifiedEditorContributor parent)
          Sets the parent contributor
 void setParentConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration parentConfiguration)
          Sets the parent configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.aptana.ide.editors.unified.IUnifiedEditorContributor
getReconcilingStrategy
 

Field Detail

parent

protected IUnifiedEditorContributor parent
parent

Constructor Detail

BaseContributor

protected BaseContributor(java.lang.String language)
Creates a new base contributor with a language type. This constructor was added jointly with a default implementation of the getLocalContentType method thats returns the language parameter for this constructur making it no longer abstract.

Parameters:
language - - mime type
Method Detail

dispose

public void dispose()
Description copied from interface: IUnifiedEditorContributor
Disposes the contributor

Specified by:
dispose in interface IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.dispose()

isAutoActivateContentAssist

public boolean isAutoActivateContentAssist()
Description copied from interface: IUnifiedEditorContributor
Should content assist auto activate

Specified by:
isAutoActivateContentAssist in interface IUnifiedEditorContributor
Returns:
true to show, false to not
See Also:
IUnifiedEditorContributor.isAutoActivateContentAssist()

getLocalContentType

public java.lang.String getLocalContentType()
Returns the language specified in the BaseContributor(String language) constructor.

Specified by:
getLocalContentType in interface IUnifiedEditorContributor
Returns:
mimetype
See Also:
IUnifiedEditorContributor.getLocalContentType()

getIndentPrefixes

public java.lang.String[] getIndentPrefixes(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                            java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
This is for the way eclipse handles things like auto indent and multi line tabbing. The string are all possible chars that will make up the inital 'whitespace' to indent. The first string is used when right tabbing, it is what is inserted (nice of them to mention that). If you want to add to a specific language you should override this method for that language.

Specified by:
getIndentPrefixes in interface IUnifiedEditorContributor
Returns:
A string[] of indent prefixes to be used in autoedits
See Also:
IUnifiedEditorContributor.getIndentPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getIndentString

public java.lang.String getIndentString(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                        java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
A helper method that returns the indent string that should be used to prefix lines. In the case of 'space' this will be four spaces in the case of tabsize = 4 (rather than a single space).

Specified by:
getIndentString in interface IUnifiedEditorContributor
Returns:
the indent string.
See Also:
IUnifiedEditorContributor.getIndentString(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getLocalIndentPrefixes

protected java.lang.String[] getLocalIndentPrefixes()
getLocalIndentPrefixes

Returns:
String[]

setLocalIndentPrefixes

protected void setLocalIndentPrefixes(java.lang.String[] prefixes)
setLocalIndentPrefixes

Parameters:
prefixes -

setIndentPrefixes

public void setIndentPrefixes(java.lang.String[] prefixes,
                              org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                              java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
The indent strings for a language, use this method to change the defaults at runtime for a specific language in an editor. Note: if you wish to use four spaces as in indent, then the first character should be a srting of four spaces - eclipse does not look up the tab width in such situations.

Specified by:
setIndentPrefixes in interface IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.setIndentPrefixes(java.lang.String[], org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

setAllIndentPrefixes

public void setAllIndentPrefixes(java.lang.String[] prefixes,
                                 org.eclipse.jface.text.source.ISourceViewer sourceViewer)
Sets index prefixes for all lanugages, overriding any current settings

Specified by:
setAllIndentPrefixes in interface IUnifiedEditorContributor
Parameters:
prefixes -
sourceViewer -

getChildContributors

public IUnifiedEditorContributor[] getChildContributors()
Description copied from interface: IUnifiedEditorContributor
Gets the language contributors for all the various languages in the editor

Specified by:
getChildContributors in interface IUnifiedEditorContributor
Returns:
IUnifiedEditorContributor[]
See Also:
IUnifiedEditorContributor.getChildContributors()

findChildContributor

public IUnifiedEditorContributor findChildContributor(java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the language contributors for the specified mime type

Specified by:
findChildContributor in interface IUnifiedEditorContributor
Returns:
IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.findChildContributor(java.lang.String)

configLocalPresentationReconciler

public void configLocalPresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler reconciler)
configLocalPresentationReconciler

Parameters:
reconciler -

getLocalAutoEditStrategies

public org.eclipse.jface.text.IAutoEditStrategy[] getLocalAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                                             java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the AutoEditStrategies for the local language type

Specified by:
getLocalAutoEditStrategies in interface IUnifiedEditorContributor
Returns:
IAutoEditStrategy[]
See Also:
IUnifiedEditorContributor.getLocalAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getLocalContentAssistProcessor

public org.eclipse.jface.text.contentassist.IContentAssistProcessor getLocalContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                                                                   java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the ContentAssistProcessor for the local language type

Specified by:
getLocalContentAssistProcessor in interface IUnifiedEditorContributor
Returns:
IContentAssistProcessor
See Also:
IUnifiedEditorContributor.getLocalContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

configPresentationReconciler

public final void configPresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler reconciler)
Description copied from interface: IUnifiedEditorContributor
Configures the PresentationReconcilers for all the various languages in the editor

Specified by:
configPresentationReconciler in interface IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.configPresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

getContentTypes

public final java.lang.String[] getContentTypes()
Description copied from interface: IUnifiedEditorContributor
Gets the MimeTypes for all the languages that exist in the editor

Specified by:
getContentTypes in interface IUnifiedEditorContributor
Returns:
String[] of mime types
See Also:
IUnifiedEditorContributor.getContentTypes()

getContentAssistProcessor

public final org.eclipse.jface.text.contentassist.IContentAssistProcessor getContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                                                                    java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the ContentAssistProcessor for all the various languages in the editor

Specified by:
getContentAssistProcessor in interface IUnifiedEditorContributor
Returns:
IContentAssistProcessor
See Also:
IUnifiedEditorContributor.getContentAssistProcessor(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getBracketInserter

public final IUnifiedBracketInserter getBracketInserter(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                        java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the bracket inserter for all the various languages in the editor

Specified by:
getBracketInserter in interface IUnifiedEditorContributor
Returns:
IUnifiedBracketInserter
See Also:
IUnifiedEditorContributor.getBracketInserter(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

isValidIdentifier

public boolean isValidIdentifier(char c,
                                 int keyCode)
isValidIdentifier

Specified by:
isValidIdentifier in interface IUnifiedEditorContributor
Parameters:
c -
keyCode -
Returns:
boolean

isValidActivationCharacter

public boolean isValidActivationCharacter(char c,
                                          int keyCode)
isValidActivationCharacter

Specified by:
isValidActivationCharacter in interface IUnifiedEditorContributor
Parameters:
c -
keyCode -
Returns:
boolean

getTextHover

public final org.eclipse.jface.text.ITextHover getTextHover(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                            java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the text hover for the given content type

Specified by:
getTextHover in interface IUnifiedEditorContributor
Returns:
ITextHover
See Also:
IUnifiedEditorContributor.getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getAutoEditStrategies

public final org.eclipse.jface.text.IAutoEditStrategy[] getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                                              java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the AutoEditStrategies for all the various languages in the editor

Specified by:
getAutoEditStrategies in interface IUnifiedEditorContributor
Returns:
IAutoEditStrategy[]
See Also:
IUnifiedEditorContributor.getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)

getFileContext

public final EditorFileContext getFileContext()
Description copied from interface: IUnifiedEditorContributor
Gets the FileContext for the editor

Specified by:
getFileContext in interface IUnifiedEditorContributor
Returns:
EditorFileContext
See Also:
IUnifiedEditorContributor.getFileContext()

setFileContext

public void setFileContext(EditorFileContext fileContext)
Sets the current language service

Specified by:
setFileContext in interface IUnifiedEditorContributor
Parameters:
fileContext -

setParent

public final void setParent(IUnifiedEditorContributor parent)
Description copied from interface: IUnifiedEditorContributor
Sets the parent contributor

Specified by:
setParent in interface IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.setParent(com.aptana.ide.editors.unified.IUnifiedEditorContributor)

getLocalTextHover

public org.eclipse.jface.text.ITextHover getLocalTextHover(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                           java.lang.String contentType)
Returns an instance of the TextHover class for the specified content type

Specified by:
getLocalTextHover in interface IUnifiedEditorContributor
Parameters:
sourceViewer - The current ISourceViewer
contentType - The current content type (generally a mine type such as text/html)
Returns:
A new TextHover class, or null if not relevant.

getParentConfiguration

public org.eclipse.jface.text.source.SourceViewerConfiguration getParentConfiguration()
Description copied from interface: IUnifiedEditorContributor
Gets the Parent SourceViewerConfiguration

Specified by:
getParentConfiguration in interface IUnifiedEditorContributor
Returns:
SourceViewerConfiguration
See Also:
IUnifiedEditorContributor.getParentConfiguration()

setParentConfiguration

public void setParentConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration parentConfiguration)
Description copied from interface: IUnifiedEditorContributor
Sets the parent configuration.

Specified by:
setParentConfiguration in interface IUnifiedEditorContributor
See Also:
IUnifiedEditorContributor.setParentConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration)

getDoubleClickStrategy

public org.eclipse.jface.text.ITextDoubleClickStrategy getDoubleClickStrategy(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                                              java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Sets the default double-click strategy

Specified by:
getDoubleClickStrategy in interface IUnifiedEditorContributor
Returns:
ITextDoubleClickStrategy
See Also:
IUnifiedEditorContributor.getDoubleClickStrategy(ISourceViewer, String)

getLocalBracketInserter

public IUnifiedBracketInserter getLocalBracketInserter(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                                       java.lang.String contentType)
Description copied from interface: IUnifiedEditorContributor
Gets the local bracket isnerter for all the various languages in the editor

Specified by:
getLocalBracketInserter in interface IUnifiedEditorContributor
Returns:
IUnifiedBracketInserter
See Also:
IUnifiedEditorContributor.getLocalBracketInserter(ISourceViewer, String)