Package org.eclipse.handly.buffer
Class BufferChange
java.lang.Object
org.eclipse.handly.buffer.BufferChange
- All Implemented Interfaces:
IBufferChange
- Direct Known Subclasses:
BufferChangeOperation.UndoChange
Default implementation of
IBufferChange.-
Field Summary
Fields inherited from interface org.eclipse.handly.buffer.IBufferChange
CREATE_UNDO, NONE, UPDATE_REGIONS -
Constructor Summary
ConstructorsConstructorDescriptionBufferChange(org.eclipse.text.edits.TextEdit edit) Creates a new buffer change with the given text edit,CREATE_UNDO|UPDATE_REGIONSstyle andKEEP_SAVED_STATEsave mode. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(org.eclipse.text.edits.TextEdit edit) Tells whether this change contains the given edit.getBase()Returns the snapshot on which this change's edit tree is based, ornullif the snapshot is unknown.org.eclipse.text.edits.TextEditgetEdit()Returns the edit tree associated with this change.Returns the save mode associated with this change.intgetStyle()Returns the style flags associated with this change.voidSets the snapshot on which this change is based.voidsetSaveMode(SaveMode saveMode) Sets the save mode of this change.voidsetStyle(int style) Sets the style flags for this change.
-
Constructor Details
-
BufferChange
public BufferChange(org.eclipse.text.edits.TextEdit edit) Creates a new buffer change with the given text edit,CREATE_UNDO|UPDATE_REGIONSstyle andKEEP_SAVED_STATEsave mode.- Parameters:
edit- a text edit (notnull)
-
-
Method Details
-
setBase
Sets the snapshot on which this change is based.- Parameters:
base- the snapshot on which the change is based, ornullif unknown
-
setStyle
public void setStyle(int style) Sets the style flags for this change. Valid flags areIBufferChange.NONEor any combination ofIBufferChange.CREATE_UNDOandIBufferChange.UPDATE_REGIONS.- Parameters:
style- style flags
-
setSaveMode
Sets the save mode of this change.- Parameters:
saveMode- a save mode
-
getEdit
public org.eclipse.text.edits.TextEdit getEdit()Description copied from interface:IBufferChangeReturns the edit tree associated with this change.- Specified by:
getEditin interfaceIBufferChange- Returns:
- the change's edit tree (never
null)
-
contains
public boolean contains(org.eclipse.text.edits.TextEdit edit) Description copied from interface:IBufferChangeTells whether this change contains the given edit. Note that, in general, this is orthogonal to whether the change's edit tree contains that edit. The edits that are not contained by the change must not be executed when the change is applied.- Specified by:
containsin interfaceIBufferChange- Parameters:
edit- a text edit- Returns:
trueif the change contains the given edit, andfalseotherwise
-
getBase
Description copied from interface:IBufferChangeReturns the snapshot on which this change's edit tree is based, ornullif the snapshot is unknown.- Specified by:
getBasein interfaceIBufferChange- Returns:
- the snapshot on which the change is based,
or
nullif unknown
-
getStyle
public int getStyle()Description copied from interface:IBufferChangeReturns the style flags associated with this change. May returnIBufferChange.NONEor any combination ofIBufferChange.CREATE_UNDOandIBufferChange.UPDATE_REGIONSflags.- Specified by:
getStylein interfaceIBufferChange- Returns:
- the change's style flags
-
getSaveMode
Description copied from interface:IBufferChangeReturns the save mode associated with this change.- Specified by:
getSaveModein interfaceIBufferChange- Returns:
- the change's save mode
-