public interface IWorkingCopyManager
Manages the life-cycle of and provides access to working copies of source files. A typical usage pattern is as follows:
final IWorkingCopyManager manager = ...; final IEditorInput input = ...; manager.connect(input); try { ISourceFile workingCopy = manager.getWorkingCopy(input); // workingCopy must not be null at this point ... } finally { manager.disconnect(input); }
Implementations are generally not expected to be thread-safe and, if not mentioned otherwise, may only be called from the user-interface thread.
Modifier and Type | Method and Description |
---|---|
void |
connect(java.lang.Object element)
Connects the given element to this manager.
|
void |
disconnect(java.lang.Object element)
Disconnects the given element from this manager.
|
ISourceFile[] |
getWorkingCopies()
Returns all working copies that are currently managed by this manager.
|
ISourceFile |
getWorkingCopy(org.eclipse.jface.text.IDocument document)
Returns the working copy managed for the given document,
or
null if this manager does not currently manage
a working copy for the document. |
ISourceFile |
getWorkingCopy(java.lang.Object element)
Returns the working copy managed for the given element,
or
null if this manager does not currently manage
a working copy for the element. |
void connect(java.lang.Object element) throws org.eclipse.core.runtime.CoreException
disconnect(Object)
.element
- not null
org.eclipse.core.runtime.CoreException
- if the working copy could not be acquiredvoid disconnect(java.lang.Object element)
connect(Object)
.element
- not null
ISourceFile getWorkingCopy(java.lang.Object element)
null
if this manager does not currently manage
a working copy for the element.element
- the element for which to find the working copy,
or null
null
if noneISourceFile getWorkingCopy(org.eclipse.jface.text.IDocument document)
null
if this manager does not currently manage
a working copy for the document.
Note: An implementation of this method may go through the list of working copies and test whether the working copy buffer's document equals the given document. Therefore, this method should not be used in performance critical code.
document
- the document for which to find the working copy,
or null
null
if noneISourceFile[] getWorkingCopies()
null
)Copyright (c) 2014, 2018 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0