Class TextFileBufferOperation
java.lang.Object
org.eclipse.core.filebuffers.manipulation.TextFileBufferOperation
- All Implemented Interfaces:
IFileBufferOperation
- Direct Known Subclasses:
ConvertLineDelimitersOperation,RemoveTrailingWhitespaceOperation
Abstraction for a file buffer operation that works on text file buffers.
Subclasses have to override the
computeTextEdits method in
order to provide a sequence of TextEdit
objects.- Since:
- 3.1
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTextFileBufferOperation(String operationName) Creates a new operation with the given name. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract MultiTextEditWithProgresscomputeTextEdit(ITextFileBuffer textFileBuffer, IProgressMonitor progressMonitor) Computes and returns a text edit.protected abstract DocumentRewriteSessionTypeReturns the rewrite session type that corresponds to the text edit sequence.Returns the name of this file buffer operation.voidrun(IFileBuffer fileBuffer, IProgressMonitor progressMonitor) Runs this operation, that is manipulates the content of the given file buffer.
-
Constructor Details
-
TextFileBufferOperation
Creates a new operation with the given name.- Parameters:
operationName- the name of the operation
-
-
Method Details
-
computeTextEdit
protected abstract MultiTextEditWithProgress computeTextEdit(ITextFileBuffer textFileBuffer, IProgressMonitor progressMonitor) throws CoreException, OperationCanceledException Computes and returns a text edit. Subclasses have to provide that method.- Parameters:
textFileBuffer- the text file buffer to manipulateprogressMonitor- the progress monitor- Returns:
- the text edits describing the content manipulation
- Throws:
CoreException- in case the computation failedOperationCanceledException- in case the progress monitor has been set to canceled
-
getDocumentRewriteSessionType
Returns the rewrite session type that corresponds to the text edit sequence.- Returns:
- the rewrite session type
-
getOperationName
Description copied from interface:IFileBufferOperationReturns the name of this file buffer operation. The operation name is used by theFileBufferOperationRunnerwhile reporting progress.- Specified by:
getOperationNamein interfaceIFileBufferOperation- Returns:
- the operation name or
null
-
run
public void run(IFileBuffer fileBuffer, IProgressMonitor progressMonitor) throws CoreException, OperationCanceledException Description copied from interface:IFileBufferOperationRuns this operation, that is manipulates the content of the given file buffer.- Specified by:
runin interfaceIFileBufferOperation- Parameters:
fileBuffer- the file bufferprogressMonitor- the progress monitor- Throws:
CoreException- in case the content manipulation failedOperationCanceledException- in case the monitor has been set to canceled
-