|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.compare.BufferedContent
org.eclipse.compare.ResourceNode
public class ResourceNode
A ResourceNode wraps 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.
| 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 java.io.InputStream |
createStream()
Returns an open stream if the corresponding resource implements the IStorage interface. |
boolean |
equals(java.lang.Object other)
Returns whether some other object is "equal to" this one with respect to a structural comparison. |
java.lang.String |
getCharset()
Returns the name of a charset encoding to be used when decoding this stream accessor's contents into characters. |
java.lang.Object[] |
getChildren()
Returns an iterator for all children of this object or null
if there are no children. |
java.io.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. |
java.lang.String |
getName()
Returns the name of this object. |
IResource |
getResource()
Returns the corresponding resource for this object. |
java.lang.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. |
boolean |
isReadOnly()
Return whether the typed element being displayed is read-only. a read-only element will require a call to validateEdit before the element can be modified on disk. |
ITypedElement |
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. |
IStatus |
validateEdit(Shell shell)
If the element is read-only, this method should be called to attempt to make it writable. |
| 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 resource| Method Detail |
|---|
public IResource getResource()
getResource in interface IResourceProvider
public java.io.InputStream getContents()
throws CoreException
IStreamContentAccessorInputStream 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 IStreamContentAccessorgetContents in class BufferedContentCoreException - if the contents of this object could not be accessedpublic long getModificationDate()
IModificationDateNote that this value should only be used to give the user a general idea of how old the object is.
getModificationDate in interface IModificationDatepublic java.lang.String getName()
ITypedElement
getName in interface ITypedElementpublic java.lang.String getType()
ITypedElementFOLDER_TYPE.
The type is used for determining a suitable viewer for this object.
getType in interface ITypedElementpublic Image getImage()
ITypedElement
getImage in interface ITypedElementnull if this type of input has no imagepublic boolean equals(java.lang.Object other)
IStructureComparatorequals would return true
if two methods have the same signature (the argument names and the
method body might differ).
equals in interface IStructureComparatorequals in class java.lang.Objectother - 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 java.lang.Objectpublic java.lang.Object[] getChildren()
IStructureComparatornull
if there are no children.
getChildren in interface IStructureComparatorprotected 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 java.io.InputStream createStream()
throws CoreException
IStorage interface. Otherwise the value null is returned.
createStream in class BufferedContentCoreException - if the contents of this storage could not be accessedpublic boolean isEditable()
IEditableContenttrue if this object can be modified.
If it returns false the other methods of this API must not be called.
isEditable in interface IEditableContenttrue if this object can be modified
public ITypedElement replace(ITypedElement child,
ITypedElement other)
IEditableContent| add: | dest == null | src != null |
| remove: | dest != null | src == null |
| copy: | dest != null | src != null |
replace in interface IEditableContentchild - the existing child of this object to be replaced; if null a new child can be added.other - the new child to be added or replaced; if null an existing child can be removed.
destpublic java.lang.String getCharset()
IEncodedStreamContentAccessornull if a proper
encoding cannot be determined.
Note: this method does not check whether the result is a supported
charset name. Callers should be prepared to handle
UnsupportedEncodingException where this charset is used.
getCharset in interface IEncodedStreamContentAccessornullIStreamContentAccessor.getContents()public boolean isReadOnly()
IEditableContentExtension
isReadOnly in interface IEditableContentExtensionpublic IStatus validateEdit(Shell shell)
IEditableContentExtension
validateEdit in interface IEditableContentExtensionshell - a shell used to prompt the user if required.
OK if things are fine,
otherwise a status describing reasons why modifying the given files is not
reasonable. A status with a severity of CANCEL is returned
if the validation was canceled, indicating the edit should not proceed.
|
Eclipse Platform Release 3.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.