public final class ChildBuffer extends Buffer
IBuffer
and inherits
the parent's contents initially, but is modified independently. Saving the
child buffer propagates its contents to the parent buffer and also to the
parent buffer's underlying resource.
An instance of this class is safe for use by multiple threads.
Constructor and Description |
---|
ChildBuffer(IBuffer parent)
Creates a new child buffer instance on top of the given parent buffer and
initializes it with the parent's contents.
|
Modifier and Type | Method and Description |
---|---|
void |
addRef()
Spawns a new independent ownership of this object.
|
protected void |
doSave(IContext context,
org.eclipse.core.runtime.IProgressMonitor monitor) |
void |
release()
Relinquishes an independent ownership of this object.
|
addListener, applyChange, createEmptyDocument, getDocument, getListeners, getSnapshot, getSupportedListenerMethods, isDirty, removeListener, save
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAnnotationModel
close
public ChildBuffer(IBuffer parent)
The child buffer takes an independent ownership of the parent buffer to ensure that it is kept open as long as the child buffer is in use. The client still owns the parent buffer, but may release it immediately.
It is the client responsibility to release
the created buffer after it is no longer needed.
parent
- the parent buffer (not null
)java.lang.IllegalStateException
- if the child buffer could not be created
because of an inappropriate state of the parent bufferpublic void addRef()
IReferenceCountable
addRef()
must ultimately be
followed by exactly one call to IReferenceCountable.release()
.addRef
in interface IBuffer
addRef
in interface ISnapshotProvider
addRef
in interface IReferenceCountable
addRef
in class Buffer
public void release()
IReferenceCountable
release
in interface IBuffer
release
in interface ISnapshotProvider
release
in interface IReferenceCountable
release
in class Buffer
IReferenceCountable.close()
Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0