|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.compare.BufferedContent | +--org.eclipse.compare.ResourceNode
A ResourceNode
wrappers an IResources
so that it can be used
as input for the differencing engine (interfaces IStructureComparator
and ITypedElement
)
and the ReplaceWithEditionDialog
(interfaces ITypedElement
and IModificationDate
).
Clients may instantiate this class; it is not intended to be subclassed.
EditionSelectionDialog
Field Summary |
Fields inherited from interface org.eclipse.compare.ITypedElement |
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE |
Constructor Summary | |
ResourceNode(IResource resource)
Creates a ResourceNode for the given resource. |
Method Summary | |
protected IStructureComparator |
createChild(IResource child)
This hook method is called from getChildren once for every
member of a container resource. |
protected InputStream |
createStream()
Returns an open stream if the corresponding resource implements the IStorage interface. |
boolean |
equals(Object other)
Returns true if the other object is of type ITypedElement
and their names are identical. |
Object[] |
getChildren()
Returns an iterator for all children of this object or null
if there are no children. |
InputStream |
getContents()
Returns an open InputStream for this object which can be used to retrieve the object's content. |
Image |
getImage()
Returns an image for this object. |
long |
getModificationDate()
Returns the modification time of this object. |
String |
getName()
Returns the name of this object. |
IResource |
getResource()
Returns the corresponding resource for this object. |
String |
getType()
Returns the type of this object. |
int |
hashCode()
Returns the hash code of the name. |
boolean |
isEditable()
Returns true if this object can be modified. |
ITypedElement |
replace(ITypedElement child,
ITypedElement other)
This method is called on a parent to add a child, remove a child, copy the contents of a child What to do is encoded in the two arguments as follows: add: child == null other != null remove: child != null other == null copy: child != null other != null |
Methods inherited from class org.eclipse.compare.BufferedContent |
addContentChangeListener, discardBuffer, fireContentChanged, getContent, removeContentChangeListener, setContent |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.compare.IEditableContent |
setContent |
Constructor Detail |
public ResourceNode(IResource resource)
ResourceNode
for the given resource.
resource
- the resourceMethod Detail |
public IResource getResource()
public InputStream getContents() throws CoreException
IStreamContentAccessor
InputStream
for this object which can be used to retrieve the object's content.
The client is responsible for closing the stream when finished.
Returns null
if this object has no streamable contents.
getContents
in interface IStreamContentAccessor
getContents
in class BufferedContent
CoreException
- if the contents of this object could not be accessedpublic long getModificationDate()
IModificationDate
Note that this value should only be used to give the user a general idea of how old the object is.
getModificationDate
in interface IModificationDate
public String getName()
ITypedElement
getName
in interface ITypedElement
public String getType()
ITypedElement
FOLDER_TYPE
.
The type is used for determining a suitable viewer for this object.
getType
in interface ITypedElement
public Image getImage()
ITypedElement
getImage
in interface ITypedElement
null
if this type of input has no imagepublic boolean equals(Object other)
true
if the other object is of type ITypedElement
and their names are identical. The content is not considered.
equals
in interface IStructureComparator
equals
in class Object
other
- the reference object with which to compare
true
if this object is the same as the other argument; false
otherwiseObject.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
public Object[] getChildren()
IStructureComparator
null
if there are no children.
getChildren
in interface IStructureComparator
protected IStructureComparator createChild(IResource child)
getChildren
once for every
member of a container resource. This implementation
creates a new ResourceNode
for the given child resource.
Clients may override this method to create a different type of
IStructureComparator
or to filter children by returning null
.
child
- the child resource for which a IStructureComparator
must be returned
ResourceNode
for the given child or null
protected InputStream createStream() throws CoreException
IStorage
interface. Otherwise the value null
is returned.
createStream
in class BufferedContent
CoreException
- if the contents of this storage could not be accessedpublic boolean isEditable()
IEditableContent
true
if this object can be modified.
If it returns false
the other methods of this API must not be called.
isEditable
in interface IEditableContent
true
if this object can be modifiedpublic ITypedElement replace(ITypedElement child, ITypedElement other)
IEditableContent
add: | child == null | other != null |
remove: | child != null | other == null |
copy: | child != null | other != null |
replace
in interface IEditableContent
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |