org.eclipse.xtext.ui.editor.autoedit
Class AbstractEditStrategy

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.autoedit.AbstractEditStrategy
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener, org.eclipse.swt.internal.SWTEventListener
Direct Known Subclasses:
AbstractTerminalsEditStrategy, CompoundMultiLineTerminalsEditStrategy, PartitionDeletionEditStrategy, PartitionEndSkippingEditStrategy, PartitionInsertEditStrategy, RichStringPartitionDelimiterSkippingStrategy, ShortCutEditStrategy

public abstract class AbstractEditStrategy
extends java.lang.Object
implements org.eclipse.jface.text.IAutoEditStrategy, org.eclipse.swt.custom.VerifyKeyListener

Author:
Sven Efftinge - Initial contribution and API

Field Summary
protected  boolean debug
          Boolean field that can be used to debug edit strategies.
static java.lang.String DEBUG
          Named binding key to bind boolean constant 'true' the debug / test mode for the edit strategies.
 
Constructor Summary
AbstractEditStrategy()
           
 
Method Summary
 int count(java.lang.String toFind, java.lang.String searchMe)
           
 void customizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
          Allows the strategy to manipulate the document command.
protected  java.lang.String getDocumentContent(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  void handleBadLocationException(org.eclipse.jface.text.BadLocationException e)
          Logs the exception.
protected abstract  void internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.DocumentCommand command)
           
protected  boolean isIdentifierPart(org.eclipse.jface.text.IDocument doc, int offset)
           
 void verifyKey(org.eclipse.swt.events.VerifyEvent event)
          The following event fields are used: event.character is the character that was typed (input) event.keyCode is the key code that was typed (input) event.stateMask is the state of the keyboard (input) event.doit is processed or not (output)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final java.lang.String DEBUG
Named binding key to bind boolean constant 'true' the debug / test mode for the edit strategies.

Since:
2.0
See Also:
Constant Field Values

debug

@Inject(optional=true)
protected boolean debug
Boolean field that can be used to debug edit strategies. BadLocationException will be re-thrown if set to true

Since:
2.0
Constructor Detail

AbstractEditStrategy

public AbstractEditStrategy()
Method Detail

verifyKey

public void verifyKey(org.eclipse.swt.events.VerifyEvent event)
Description copied from interface: org.eclipse.swt.custom.VerifyKeyListener
The following event fields are used:

Specified by:
verifyKey in interface org.eclipse.swt.custom.VerifyKeyListener
Parameters:
event - the verify event
See Also:
VerifyEvent

customizeDocumentCommand

public void customizeDocumentCommand(org.eclipse.jface.text.IDocument document,
                                     org.eclipse.jface.text.DocumentCommand command)
Description copied from interface: org.eclipse.jface.text.IAutoEditStrategy
Allows the strategy to manipulate the document command.

Specified by:
customizeDocumentCommand in interface org.eclipse.jface.text.IAutoEditStrategy
Parameters:
document - the document that will be changed
command - the document command describing the change

handleBadLocationException

protected void handleBadLocationException(org.eclipse.jface.text.BadLocationException e)
Logs the exception. Will throw a RuntimeException if debug is set to true.

Since:
2.0

internalCustomizeDocumentCommand

protected abstract void internalCustomizeDocumentCommand(org.eclipse.jface.text.IDocument document,
                                                         org.eclipse.jface.text.DocumentCommand command)
                                                  throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

count

public int count(java.lang.String toFind,
                 java.lang.String searchMe)
          throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

getDocumentContent

protected java.lang.String getDocumentContent(org.eclipse.jface.text.IDocument document,
                                              org.eclipse.jface.text.DocumentCommand command)
                                       throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

isIdentifierPart

protected boolean isIdentifierPart(org.eclipse.jface.text.IDocument doc,
                                   int offset)
                            throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException