|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.codegen.merge.java.facade.AbstractJNode
org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
org.eclipse.emf.codegen.merge.java.facade.ast.ASTJCompilationUnit
public class ASTJCompilationUnit
Wraps CompilationUnit
object.
Nested Class Summary | |
---|---|
protected class |
ASTJCompilationUnit.AbstractRewriter
Base class for additional rewriters used during rewrite process. |
protected class |
ASTJCompilationUnit.NodeCommenter
|
protected class |
ASTJCompilationUnit.NodeContentsReplacer
|
Field Summary | |
---|---|
protected static java.util.regex.Pattern |
HEADER_PATTERN
Pattern to extract and replace header. |
protected java.lang.String |
headerString
Header of the compilation unit to be set during rewrite. |
static java.lang.String |
NAME_PROPERTY
Name for the name property of the compilation unit. |
protected char[] |
originalContents
Original contents of the compilation unit |
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode |
---|
isCommentedOut, name, rewriter, UNITIALIZED_STRING |
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode |
---|
EMPTY_STRING_ARRAY, qualifiedName |
Constructor Summary | |
---|---|
ASTJCompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit)
|
Method Summary | |
---|---|
boolean |
addChild(ASTJNode<?> child)
Adds a child to this node. |
protected java.lang.String |
computeQualifiedName()
Same as the getName() . |
void |
dispose()
|
protected java.util.Map<org.eclipse.jdt.core.dom.ASTNode,java.lang.String> |
getAllTrackedContentsMap()
|
java.util.List<JNode> |
getChildren()
Returns the list of children in order: package declaration ( JPackage ), imports (JImport ), and types (JType ). |
protected java.util.Set<org.eclipse.jdt.core.dom.ASTNode> |
getCommentedOutNodes()
|
java.lang.String |
getContents()
Returns the rewritten text after applying all the changes made to JNode tree. |
java.lang.String |
getHeader()
Returns the header comment for this compilation unit. |
java.lang.String |
getName()
Returns the name of the main type suffixed with java extension. |
char[] |
getOriginalContents()
|
boolean |
insertSibling(ASTJNode<?> node,
ASTJNode<?> newSibling,
boolean before)
Inserts newSibling as a child of this node before or after the given node . |
boolean |
remove(ASTJNode<?> node)
Removes the given node. |
protected void |
setHeader(IDocument targetDoc)
Method to replace the header in the given document. |
void |
setHeader(java.lang.String header)
This implementation remembers the header string, and does replacement of the header in the final document after any other changes. |
void |
setName(java.lang.String name)
Sets the name of the main type of compilation unit. |
void |
setOriginalContents(char[] originalContents)
Sets original contents of the compilation unit to be used for converting nodes to strings. |
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.ast.ASTJNode |
---|
addValueToListProperty, addValueToListProperty, ancestorInserted, ancestorToBeRemoved, childToBeChanged, combineArrayAndList, commentOut, convertASTNodeListToStringArray, disableTrackAndReplace, enableTrackAndReplace, getASTNode, getFacadeHelper, getParent, getRemovedASTNode, getRewriter, getWrappedObject, insert, insertFirst, insertLast, isDisposed, nodeToBeMoved, nodeToBeRemoved, remove, removeNodeFromListProperty, removeTrackAndReplace, setASTNode, setFacadeHelper, setFlags, setListNodeProperty, setNodeProperty, setNodeProperty, setParent, setRemovedASTNode, setRewriter, setTrackedNodeProperty, setWrappedObject, trackAndReplace |
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode |
---|
computeQualifiedName, computeQualifiedName, computeQualifiedName, getFlags, getName, getQualifiedName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JNode |
---|
getFlags, getParent, getQualifiedName, setFlags |
Field Detail |
---|
public static final java.lang.String NAME_PROPERTY
protected static final java.util.regex.Pattern HEADER_PATTERN
protected java.lang.String headerString
protected char[] originalContents
Constructor Detail |
---|
public ASTJCompilationUnit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit)
compilationUnit
- Method Detail |
---|
public void dispose()
dispose
in class ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
public void setOriginalContents(char[] originalContents)
originalContents
- public char[] getOriginalContents()
public java.lang.String getName()
In the absence of type defaults to original name that compilation unit was created with.
Created for compatibility with JDOM implementation of getName()
for JCompilationUnit
.
getName
in interface JNode
JNode.getName()
public void setName(java.lang.String name)
setName
in interface JNode
FacadeHelper.getMainType(JCompilationUnit)
,
JNode.setName(java.lang.String)
,
JNode.getQualifiedName()
protected java.lang.String computeQualifiedName()
getName()
.
computeQualifiedName
in class AbstractJNode
AbstractJNode.computeQualifiedName()
public java.util.List<JNode> getChildren()
JPackage
), imports (JImport
), and types (JType
).
getChildren
in interface JNode
getChildren
in class AbstractJNode
AbstractJNode.getChildren()
public java.lang.String getHeader()
JCompilationUnit
getHeader
in interface JCompilationUnit
null
if
no header comment is presentpublic void setHeader(java.lang.String header)
For the files with no package declaration, the new header might be inserted at the beginning of the file instead of being replaced.
setHeader
in interface JCompilationUnit
header
- the header comment for this compilation unit, or null
if
indicating no header commentJCompilationUnit.setHeader(java.lang.String)
protected void setHeader(IDocument targetDoc)
targetDoc
- public java.lang.String getContents()
getContents
in interface JNode
getContents
in class ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
null
if this node has no contentsASTJNode.getContents()
public boolean addChild(ASTJNode<?> child)
ASTJNode
Default implementation does nothing and returns false
.
addChild
in class ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
child
- to add
true
if operation successful, false
otherwisepublic boolean insertSibling(ASTJNode<?> node, ASTJNode<?> newSibling, boolean before)
ASTJNode
newSibling
as a child of this node before or after the given node
.
Default implementation does nothing and returns false
.
insertSibling
in class ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
newSibling
- to insertbefore
- true
if newSibling
must be before node
, false
if after
true
if operation successful, false
otherwisepublic boolean remove(ASTJNode<?> node)
This implementation will not perform moving of the node if the node is inserted after being removed. Hence, the removed node must not be inserted again.
remove
in class ASTJNode<org.eclipse.jdt.core.dom.CompilationUnit>
node
- must be a child of this node
true
if operation successful, false
otherwiseASTJNode.remove(ASTJNode)
protected java.util.Map<org.eclipse.jdt.core.dom.ASTNode,java.lang.String> getAllTrackedContentsMap()
ASTNode
to String
contents of the node).
This map will be used during rewrite to track the nodes and set the exact contents of them.
protected java.util.Set<org.eclipse.jdt.core.dom.ASTNode> getCommentedOutNodes()
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |