Package org.eclipse.jface.text
Class DocumentCommand
java.lang.Object
org.eclipse.jface.text.DocumentCommand
Represents a text modification as a document replace command. The text
 modification is given as a 
VerifyEvent and
 translated into a document replace command relative to a given offset. A
 document command can also be used to initialize a given
 VerifyEvent.
 A document command can also represent a list of related changes.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionintThe caret offset with respect to the document before the document command is executed.booleanMust the command be updatedintThe length of the commandintThe offset of the command.The owner of the document command which will not be notified.booleanIndicates whether the caret should be shifted by this command.The text to be inserted
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCommand(int commandOffset, int commandLength, String commandText, IDocumentListener commandOwner) Adds an additional replace command.intReturns the number of commands including the original document command.Iterator<org.eclipse.jface.text.DocumentCommand.Command> Returns an iterator over the commands in ascending position order.
- 
Field Details- 
doitpublic boolean doitMust the command be updated
- 
offsetpublic int offsetThe offset of the command.
- 
lengthpublic int lengthThe length of the command
- 
textThe text to be inserted
- 
ownerThe owner of the document command which will not be notified.- Since:
- 2.1
 
- 
caretOffsetpublic int caretOffsetThe caret offset with respect to the document before the document command is executed.- Since:
- 2.1
 
- 
shiftsCaretpublic boolean shiftsCaretIndicates whether the caret should be shifted by this command.- Since:
- 3.0
 
 
- 
- 
Constructor Details- 
DocumentCommandprotected DocumentCommand()Creates a new document command.
 
- 
- 
Method Details- 
addCommandpublic void addCommand(int commandOffset, int commandLength, String commandText, IDocumentListener commandOwner) throws BadLocationException Adds an additional replace command. The added replace command must not overlap with existing ones. If the document command owner is notnull, it will not get document change notifications for the particular command.- Parameters:
- commandOffset- the offset of the region to replace
- commandLength- the length of the region to replace
- commandText- the text to replace with, may be- null
- commandOwner- the command owner, may be- null
- Throws:
- BadLocationException- if the added command intersects with an existing one
- Since:
- 2.1
 
- 
getCommandIteratorReturns an iterator over the commands in ascending position order. The iterator includes the original document command. Commands cannot be removed.- Returns:
- returns the command iterator
 
- 
getCommandCountpublic int getCommandCount()Returns the number of commands including the original document command.- Returns:
- returns the number of commands
- Since:
- 2.1
 
 
-