com.aptana.ide.editor.js.formatting
Class JSAutoIndentStrategy

java.lang.Object
  extended by com.aptana.ide.editors.unified.UnifiedAutoIndentStrategy
      extended by com.aptana.ide.editor.js.formatting.JSAutoIndentStrategy
All Implemented Interfaces:
IPreferenceClient, org.eclipse.jface.text.IAutoEditStrategy

public class JSAutoIndentStrategy
extends UnifiedAutoIndentStrategy

A class for auto-insertion of items into JavaScript

Author:
Ingo Muschenetz

Field Summary
 
Fields inherited from class com.aptana.ide.editors.unified.UnifiedAutoIndentStrategy
configuration, context, sourceViewer
 
Constructor Summary
JSAutoIndentStrategy(EditorFileContext context, org.eclipse.jface.text.source.SourceViewerConfiguration configuration, org.eclipse.jface.text.source.ISourceViewer sourceViewer)
          Creates a new instance of the JSAutoEditStrategy
 
Method Summary
 void customizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
          customizeDocumentCommand
 int getCurrentIndentLevel(java.lang.String source, int pos)
           
protected  int getIndentationLevelAtOffset(org.eclipse.jface.text.IDocument d, int offset)
           
protected  LexemeList getLexemeList()
          Creates a lexeme list
 org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
          Returns the current preference store
 java.lang.String indent(int level, java.lang.String languageContent, java.lang.String lineSeparator)
          indents string
protected  void indentAfterNewLine(org.eclipse.jface.text.IDocument d, org.eclipse.jface.text.DocumentCommand c)
          indentAfterNewLine
 
Methods inherited from class com.aptana.ide.editors.unified.UnifiedAutoIndentStrategy
autoTriggerAssist, canCloseBracket, canOverwriteBracket, closeBracket, findEndOfWhiteSpace, getAutoInsertCharacters, getAutoOverwriteCharacters, getIndentationAtOffset, getIndentationString, getIndentForCurrentLine, getIndentString, hideContentAssistPopup, indentAfterOpenBrace, isAutoInsertEnabled, isValidAutoInsertLocation, overwriteBracket, triggerContentAssistPopup, triggerContextAssistPopup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSAutoIndentStrategy

public JSAutoIndentStrategy(EditorFileContext context,
                            org.eclipse.jface.text.source.SourceViewerConfiguration configuration,
                            org.eclipse.jface.text.source.ISourceViewer sourceViewer)
Creates a new instance of the JSAutoEditStrategy

Parameters:
context -
configuration -
sourceViewer -
Method Detail

customizeDocumentCommand

public void customizeDocumentCommand(org.eclipse.jface.text.IDocument document,
                                     org.eclipse.jface.text.DocumentCommand command)
customizeDocumentCommand

Specified by:
customizeDocumentCommand in interface org.eclipse.jface.text.IAutoEditStrategy
Overrides:
customizeDocumentCommand in class UnifiedAutoIndentStrategy
Parameters:
document -
command -
See Also:
IAutoEditStrategy.customizeDocumentCommand(org.eclipse.jface.text.IDocument, org.eclipse.jface.text.DocumentCommand)

getIndentationLevelAtOffset

protected int getIndentationLevelAtOffset(org.eclipse.jface.text.IDocument d,
                                          int offset)
Parameters:
d -
offset -
Returns:
indentation level

indent

public java.lang.String indent(int level,
                               java.lang.String languageContent,
                               java.lang.String lineSeparator)
indents string

Parameters:
level -
languageContent -
lineSeparator -
Returns:
indented string

indentAfterNewLine

protected void indentAfterNewLine(org.eclipse.jface.text.IDocument d,
                                  org.eclipse.jface.text.DocumentCommand c)
indentAfterNewLine

Overrides:
indentAfterNewLine in class UnifiedAutoIndentStrategy
Parameters:
d -
c -

getPreferenceStore

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

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

getLexemeList

protected LexemeList getLexemeList()
Description copied from class: UnifiedAutoIndentStrategy
Creates a lexeme list

Specified by:
getLexemeList in class UnifiedAutoIndentStrategy
Returns:
LexemeList
See Also:
UnifiedAutoIndentStrategy.getLexemeList()

getCurrentIndentLevel

public int getCurrentIndentLevel(java.lang.String source,
                                 int pos)
Parameters:
source -
pos -
Returns:
current offset from nearest new line character