|
Eclipse CDT Pre-release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IWorkingCopy
A working copy of a C element acts just like a regular element (handle), except it is not attached to an underlying resource. A working copy is not visible to the rest of the C model. Changes in a working copy's buffer are not realized in a resource. To bring the C model up-to-date with a working copy's contents, an explicit commit must be performed on the working copy. Other operations performed on a working copy update the contents of the working copy's buffer but do not commit the contents of the working copy.
Note: The contents of a working copy is determined when a working
copy is created, based on the current content of the element the working
copy is created from. If a working copy is an ICFile
and is
explicitly closed, the working copy's buffer will be thrown away. However,
clients should not explicitly open and close working copies.
The client that creates a working copy is responsible for
destroying the working copy. The C model will never automatically destroy or
close a working copy. (Note that destroying a working copy does not commit it
to the model, it only frees up the memory occupied by the element). After a
working copy is destroyed, the working copy cannot be accessed again. Non-
handle methods will throw a CModelException
indicating the
C element does not exist.
A working copy cannot be created from another working copy.
Calling getWorkingCopy
on a working copy returns the receiver.
Field Summary |
---|
Method Summary | |
---|---|
void |
commit(boolean force,
IProgressMonitor monitor)
Commits the contents of this working copy to its original element and underlying resource, bringing the C model up-to-date with the current contents of the working copy. |
void |
destroy()
Destroys this working copy, closing its buffer and discarding its structure. |
ICElement |
getOriginal(ICElement workingCopyElement)
Returns the original element the specified working copy element was created from, or null if this is not a working copy element. |
ITranslationUnit |
getOriginalElement()
Returns the original element this working copy was created from, or null if this is not a working copy. |
boolean |
isBasedOn(IResource resource)
Returns whether this working copy's original element's content has not changed since the inception of this working copy. |
IMarker[] |
reconcile()
Reconciles the contents of this working copy. |
void |
reconcile(boolean forceProblemDetection,
IProgressMonitor monitor)
Reconciles the contents of this working copy. |
void |
restore()
Restores the contents of this working copy to the current contents of this working copy's original element. |
Methods inherited from interface org.eclipse.cdt.core.model.ITranslationUnit |
---|
createInclude, createNamespace, createUsing, findSharedWorkingCopy, getASTTranslationUnit, getContents, getContentTypeId, getElement, getElementAtLine, getElementAtOffset, getElementsAtOffset, getInclude, getIncludes, getNamespace, getNamespaces, getSharedWorkingCopy, getSharedWorkingCopy, getUsing, getUsings, getWorkingCopy, getWorkingCopy, isASMLanguage, isCLanguage, isCXXLanguage, isHeaderUnit, isSourceUnit, isWorkingCopy, parse |
Methods inherited from interface org.eclipse.cdt.core.model.ICElement |
---|
accept, exists, getAncestor, getCModel, getCProject, getElementName, getElementType, getParent, getPath, getResource, getUnderlyingResource, isReadOnly, isStructureKnown |
Methods inherited from interface org.eclipse.cdt.core.model.IParent |
---|
getChildren, getChildrenOfType, hasChildren |
Methods inherited from interface org.eclipse.cdt.core.model.IOpenable |
---|
close, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, makeConsistent, open, save |
Methods inherited from interface org.eclipse.cdt.core.model.IBufferChangedListener |
---|
bufferChanged |
Methods inherited from interface org.eclipse.cdt.core.model.ISourceReference |
---|
getSource, getSourceRange, getTranslationUnit |
Methods inherited from interface org.eclipse.cdt.core.model.ISourceManipulation |
---|
copy, delete, move, rename |
Method Detail |
---|
void commit(boolean force, IProgressMonitor monitor) throws CModelException
It is possible that the contents of the original resource have changed
since this working copy was created, in which case there is an update conflict.
The value of the force
parameter effects the resolution of
such a conflict:
true
- in this case the contents of this working copy are applied to
the underlying resource even though this working copy was created before
a subsequent change in the resourcefalse
- in this case a CModelException
is
thrown
CModelException
void destroy()
CModelException
s. Has
no effect if this element is not a working copy.
If this working copy is shared, it is destroyed only when the number of calls to
destroy()
is the same as the number of calls to
getSharedWorkingCopy(IProgressMonitor, IBufferFactory)
.
A REMOVED CElementDelta is then reported on this working copy.
ICElement getOriginal(ICElement workingCopyElement)
null
if this is not a working copy element.
workingCopyElement
- the specified working copy element
null
if this is not a working copy elementITranslationUnit getOriginalElement()
null
if this is not a working copy.
boolean isBasedOn(IResource resource)
IMarker[] reconcile() throws CModelException
If the working copy hasn't changed, then no problem will be detected,
this is equivalent to IWorkingCopy#reconcile(false, null)
.
CModelException
void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws CModelException
The boolean argument allows to force problem detection even if the working copy is already consistent.
CModelException
void restore() throws CModelException
CModelException
|
Eclipse CDT Pre-release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |