|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.compare.structuremergeviewer.DocumentRangeNode
A document range node represents a structural element when performing a structure compare of documents. DocumentRangeNodes are created while parsing the document and represent a semantic entity (e.g. a Java class or method). As a consequence of the parsing a DocumentRangeNode maps to a range of characters in the document.
Since a DocumentRangeNode implements the IStructureComparator and IStreamContentAccessor interfaces it can be used as input to the differencing engine. This makes it possible to perform a structural diff on a document and have the nodes and leaves of the compare easily map to character ranges within the document.
Subclasses may add additional state collected while parsing the document.
Field Summary |
Fields inherited from interface org.eclipse.compare.contentmergeviewer.IDocumentRange |
RANGE_CATEGORY |
Constructor Summary | |
DocumentRangeNode(int typeCode,
String id,
IDocument document,
int start,
int length)
Creates a new DocumentRangeNode for the given range within the specified document. |
Method Summary | |
void | addChild(DocumentRangeNode node)
Adds the given node as a child. |
boolean | equals(Object other)
Implementation based on getID. |
Position | getAppendPosition()
Returns the position that has been set with setAppendPosition. |
String | getCharset()
Returns the name of a charset encoding to be used when decoding this stream accessor's contents into characters. |
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. |
IDocument | getDocument()
Returns the underlying document. |
String | getId()
Returns this node's id. |
Position | getRange()
Returns a position that specifies a subrange in the underlying document, or null if this document range spans the whole underlying document. |
int | getTypeCode()
Returns the type code of this node. |
int | hashCode()
Implementation based on getID. |
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 or remove a child, or to copy the contents of a child. |
void | setAppendPosition(int pos)
Sets a position within the document range that can be used to (legally) insert text without breaking the syntax of the document. |
void | setContent(byte[] content)
Replaces the current content with the given new bytes. |
void | setId(String id)
Sets this node's id. |
void | setLength(int length)
Sets the length of the range of this node. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DocumentRangeNode(int typeCode, String id, IDocument document, int start, int length)
Method Detail |
public IDocument getDocument()
public Position getRange()
public int getTypeCode()
public String getId()
public void setId(String id)
public void addChild(DocumentRangeNode node)
public Object[] getChildren()
public void setLength(int length)
public void setAppendPosition(int pos)
E.g. when parsing a Java document the "append position" of a DocumentRangeNode representating a Java class could be the character position just before the closing bracket. Inserting the text of a new method there would not disturb the syntax of the class.
public Position getAppendPosition()
public boolean equals(Object other)
public int hashCode()
public InputStream getContents()
public boolean isEditable()
public ITypedElement replace(ITypedElement child, ITypedElement other)
add: | child == null | other != null |
remove: | child != null | other == null |
copy: | child != null | other != null |
public void setContent(byte[] content)
public String getCharset()
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.
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.