Package org.eclipse.compare.internal
Class BufferedResourceNode
java.lang.Object
org.eclipse.compare.BufferedContent
org.eclipse.compare.ResourceNode
org.eclipse.compare.internal.BufferedResourceNode
- All Implemented Interfaces:
IContentChangeNotifier
,IEditableContent
,IEditableContentExtension
,IEncodedStreamContentAccessor
,IModificationDate
,IResourceProvider
,IStreamContentAccessor
,ITypedElement
,IStructureComparator
A buffer for a workspace resource.
-
Field Summary
Fields inherited from interface org.eclipse.compare.ITypedElement
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE
-
Constructor Summary
ConstructorDescriptionBufferedResourceNode
(IResource resource) Creates aResourceNode
for the given resource. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected IStructureComparator
createChild
(IResource child) This hook method is called fromgetChildren
once for every member of a container resource.boolean
isDirty()
replace
(ITypedElement child, ITypedElement other) This method is called on a parent to add or remove a child, or to copy the contents of a child.void
setContent
(byte[] contents) Sets the contents.Methods inherited from class org.eclipse.compare.ResourceNode
createStream, equals, getCharset, getChildren, getContents, getImage, getModificationDate, getName, getResource, getType, hashCode, isEditable, isReadOnly, validateEdit
Methods inherited from class org.eclipse.compare.BufferedContent
addContentChangeListener, discardBuffer, fireContentChanged, getContent, removeContentChangeListener
-
Constructor Details
-
BufferedResourceNode
Creates aResourceNode
for the given resource.- Parameters:
resource
- the resource
-
-
Method Details
-
isDirty
public boolean isDirty() -
createChild
Description copied from class:ResourceNode
This hook method is called fromgetChildren
once for every member of a container resource. This implementation creates a newResourceNode
for the given child resource. Clients may override this method to create a different type ofIStructureComparator
or to filter children by returningnull
.- Overrides:
createChild
in classResourceNode
- Parameters:
child
- the child resource for which aIStructureComparator
must be returned- Returns:
- a
ResourceNode
for the given child ornull
-
setContent
public void setContent(byte[] contents) Description copied from class:BufferedContent
Sets the contents. Registered content change listeners are notified.- Specified by:
setContent
in interfaceIEditableContent
- Overrides:
setContent
in classBufferedContent
- Parameters:
contents
- the new contents
-
commit
- Throws:
CoreException
-
replace
Description copied from interface:IEditableContent
This method is called on a parent to add or remove a child, or to copy the contents of a child. What to do is encoded in the two arguments as follows:add: dest == null src != null remove: dest != null src == null copy: dest != null src != null - Specified by:
replace
in interfaceIEditableContent
- Overrides:
replace
in classResourceNode
- Parameters:
child
- the existing child of this object to be replaced; ifnull
a new child can be added.other
- the new child to be added or replaced; ifnull
an existing child can be removed.- Returns:
- the argument
dest
-