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
ConstructorsConstructorDescriptionBufferedResourceNode(IResource resource) Creates aResourceNodefor the given resource. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected IStructureComparatorcreateChild(IResource child) This hook method is called fromgetChildrenonce for every member of a container resource.booleanisDirty()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.voidsetContent(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, validateEditMethods inherited from class org.eclipse.compare.BufferedContent
addContentChangeListener, discardBuffer, fireContentChanged, getContent, removeContentChangeListener
-
Constructor Details
-
BufferedResourceNode
Creates aResourceNodefor the given resource.- Parameters:
resource- the resource
-
-
Method Details
-
isDirty
public boolean isDirty() -
createChild
Description copied from class:ResourceNodeThis hook method is called fromgetChildrenonce for every member of a container resource. This implementation creates a newResourceNodefor the given child resource. Clients may override this method to create a different type ofIStructureComparatoror to filter children by returningnull.- Overrides:
createChildin classResourceNode- Parameters:
child- the child resource for which aIStructureComparatormust be returned- Returns:
- a
ResourceNodefor the given child ornull
-
setContent
public void setContent(byte[] contents) Description copied from class:BufferedContentSets the contents. Registered content change listeners are notified.- Specified by:
setContentin interfaceIEditableContent- Overrides:
setContentin classBufferedContent- Parameters:
contents- the new contents
-
commit
- Throws:
CoreException
-
replace
Description copied from interface:IEditableContentThis 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:
replacein interfaceIEditableContent- Overrides:
replacein classResourceNode- Parameters:
child- the existing child of this object to be replaced; ifnulla new child can be added.other- the new child to be added or replaced; ifnullan existing child can be removed.- Returns:
- the argument
dest
-