Package org.eclipse.xtext.ide.serializer
Interface IChangeSerializer
-
- All Known Implementing Classes:
ChangeSerializer
public interface IChangeSerializerConverts changes from EMF models to the smallest possible text changes. The ChangeSerializer records changes in modifications that are added usingaddModification(T, IModification<T>). All correspondingITextDocumentChanges can be retrieved in the end by callingapplyModifications(IAcceptor). They containITextReplacementwhich may then be applied to an editor's contents or to a persisted file. In contrast toISerializer, the ChangeSerializer aims to produce the smallest text changes possible, can handle changes that span multiple files, and is able to update cross references in related files. Just likeISerializer, the ChangeSerializer applies theIFormatter2before returning TextReplacements.- Since:
- 2.13
- Noextend:
- This interface is not intended to be extended by clients.
- Noimplement:
- This interface is not intended to be implemented by clients.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIChangeSerializer.IModification<T extends org.eclipse.emf.common.notify.Notifier>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends org.eclipse.emf.common.notify.Notifier>
voidaddModification(T context, IChangeSerializer.IModification<T> modification)voidapplyModifications(org.eclipse.xtext.util.IAcceptor<IEmfResourceChange> acceptor)org.eclipse.xtext.formatting2.regionaccess.ITextRegionDiffBuildergetModifiableDocument(org.eclipse.emf.ecore.resource.Resource resource)booleanisUpdateCrossReferences()booleanisUpdateRelatedFiles()voidsetProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)If set,addModification(Notifier, IModification)will report progress and check {#IProgressMonitor.isCanceled()on this monitor object.voidsetUpdateCrossReferences(boolean value)If set to true (that's the default), cross references affected by changes made inaddModification(Notifier, IModification)will be updated.voidsetUpdateRelatedFiles(boolean value)If set to true, (that's the default) andisUpdateCrossReferences()is also set to true,IReferenceUpdaterwill also be called for files that are not directly changed by anIChangeSerializer.IModificationbut may contain cross references pointing to a changed files.
-
-
-
Method Detail
-
addModification
<T extends org.eclipse.emf.common.notify.Notifier> void addModification(T context, IChangeSerializer.IModification<T> modification)
-
applyModifications
void applyModifications(org.eclipse.xtext.util.IAcceptor<IEmfResourceChange> acceptor)
-
getModifiableDocument
org.eclipse.xtext.formatting2.regionaccess.ITextRegionDiffBuilder getModifiableDocument(org.eclipse.emf.ecore.resource.Resource resource)
-
isUpdateCrossReferences
boolean isUpdateCrossReferences()
- See Also:
setUpdateCrossReferences(boolean)
-
isUpdateRelatedFiles
boolean isUpdateRelatedFiles()
- See Also:
setUpdateRelatedFiles(boolean)
-
setProgressMonitor
void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
If set,addModification(Notifier, IModification)will report progress and check {#IProgressMonitor.isCanceled()on this monitor object.
-
setUpdateCrossReferences
void setUpdateCrossReferences(boolean value)
If set to true (that's the default), cross references affected by changes made inaddModification(Notifier, IModification)will be updated. This involves at least all cross references from files for which there is anIChangeSerializer.IModification. IfisUpdateRelatedFiles()is true, also all other cross references known byIResourceDescriptionsare updated. Example: When a modification changesmyElement.namefrom"foo"to"bar", all references pointing to"foo"are updated to"bar". Yes, that's a rename refactoring.- See Also:
IReferenceUpdater,setUpdateRelatedFiles(boolean)
-
setUpdateRelatedFiles
void setUpdateRelatedFiles(boolean value)
If set to true, (that's the default) andisUpdateCrossReferences()is also set to true,IReferenceUpdaterwill also be called for files that are not directly changed by anIChangeSerializer.IModificationbut may contain cross references pointing to a changed files.
-
-