org.eclipse.core.filebuffers.manipulation
Class TextFileBufferOperation
java.lang.Object
org.eclipse.core.filebuffers.manipulation.TextFileBufferOperation
-
All Implemented Interfaces:
-
IFileBufferOperation
-
Direct Known Subclasses:
-
ConvertLineDelimitersOperation,
RemoveTrailingWhitespaceOperation
-
public abstract class TextFileBufferOperation
- extends
Object
- implements
IFileBufferOperation
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
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
TextFileBufferOperation
protected TextFileBufferOperation(
String operationName)
- Creates a new operation with the given name.
-
Parameters:
-
operationName
- the name of the operation
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 manipulate -
progressMonitor
- the progress monitor
-
Returns:
- the text edits describing the content manipulation
-
Throws:
-
CoreException
- in case the computation failed
-
OperationCanceledException
- in case the progress monitor has been set to canceled
getDocumentRewriteSessionType
protected abstract
DocumentRewriteSessionType getDocumentRewriteSessionType()
- Returns the rewrite session type that corresponds to the text edit sequence.
-
-
-
Returns:
- the rewrite session type
getOperationName
public
String getOperationName()
-
Description copied from interface:
IFileBufferOperation
- Returns the name of this file buffer operation. The operation name is
used by the
FileBufferOperationRunner
while reporting
progress.
-
-
Specified by:
-
getOperationName
in interface
IFileBufferOperation
-
-
Returns:
- the operation name or
null
run
public void run(
IFileBuffer fileBuffer,
IProgressMonitor progressMonitor)
throws
CoreException,
OperationCanceledException
-
Description copied from interface:
IFileBufferOperation
- Runs this operation, that is manipulates the content of the given file
buffer.
-
-
Specified by:
-
run
in interface
IFileBufferOperation
-
-
Parameters:
-
fileBuffer
- the file buffer -
progressMonitor
- the progress monitor
-
Throws:
-
CoreException
- in case the content manipulation failed
-
OperationCanceledException
- in case the monitor has been set to canceled
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.