|
||||||||||
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.FacadeHelper
public abstract class FacadeHelper
Field Summary | |
---|---|
protected static java.lang.String |
CLASS_PREFIX
|
protected JControlModel |
controlModel
|
protected java.util.Map<java.lang.Object,JNode> |
objectToNodeMap
|
Constructor Summary | |
---|---|
FacadeHelper()
|
Method Summary | ||
---|---|---|
boolean |
addChild(JNode node,
JNode child)
Adds the given orphan node (document fragment) as the last child of the specified node. |
|
java.lang.String |
applyFormatRules(java.lang.String value)
Formats the specified string using the CodeGenUtil.convertFormat(String, boolean, String) method. |
|
boolean |
canMerge()
|
|
boolean |
canYieldWrongJavadoc()
Returns whether this facade implementation may return the wrong Javadoc for a node when there are 2 or more javadoc blocks preceding the node. |
|
abstract JNode |
cloneNode(java.lang.Object context,
JNode node)
Clones the specified node, returning an object that is related to the given context. |
|
void |
commentOut(JNode node)
Comment out the node and its children. |
|
JNode |
convertToNode(java.lang.Object object)
|
|
abstract JCompilationUnit |
createCompilationUnit(java.lang.String name,
java.lang.String contents)
|
|
void |
dispose(JNode node)
Disposes the node and its children. |
|
protected void |
disposeNode(JNode node)
Disposes a single node. |
|
protected abstract JNode |
doConvertToNode(java.lang.Object object)
|
|
boolean |
fixInterfaceBrace()
|
|
|
getChildren(JNode node,
java.lang.Class<T> cls)
Returns a list with the children of the specified node that are instances of the given class. |
|
java.lang.String |
getClassPrefix()
|
|
JCompilationUnit |
getCompilationUnit(JNode node)
Returns the compilation unit of the specified node. |
|
abstract java.lang.Object |
getContext(JNode node)
Returns the context of a node. |
|
JControlModel |
getControlModel()
|
|
JNode |
getFirstChild(JNode node)
Returns the first child of the specified node. |
|
JType |
getMainType(JCompilationUnit compilationUnit)
Returns the first public type in of a compilation unit. |
|
JNode |
getNext(JNode node)
Returns the sibling node immediately following the specified node. |
|
NodeConverter |
getNodeConverter()
|
|
protected java.util.Map<java.lang.Object,JNode> |
getObjectToNodeMap()
|
|
java.lang.String |
getOriginalContents(JCompilationUnit compilationUnit)
Returns the original, unmodified, content of the compilation unit. |
|
JPackage |
getPackage(JNode node)
Returns the package of the specified node. |
|
JNode |
getPrevious(JNode node)
Returns the sibling node immediately preceding the specified node. |
|
protected JNode |
getSibiling(JNode node,
int pos)
Returns the sibling of the specified node that is located in a specific position relative to the node. |
|
boolean |
insertSibling(JNode node,
JNode newSibling,
boolean before)
Inserts the given orphan node as a sibling of the specified node, immediately before or after it. |
|
boolean |
isDisposed(JNode node)
Returns true if a node is
disposed. |
|
boolean |
isSibilingTraversalExpensive()
Returns whether using the getPrevious(JNode) and
getNext(JNode) methods is slower than using JNode.getChildren()
directly. |
|
boolean |
remove(JNode node)
Separates the specified node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment. |
|
void |
reset()
|
|
void |
setControlModel(JControlModel controlModel)
Sets this facade helper's control model. |
|
java.lang.String |
toString(java.lang.Object object)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String CLASS_PREFIX
protected JControlModel controlModel
protected java.util.Map<java.lang.Object,JNode> objectToNodeMap
Constructor Detail |
---|
public FacadeHelper()
Method Detail |
---|
public void reset()
public boolean canMerge()
false
depending on some environment requirement.protected java.util.Map<java.lang.Object,JNode> getObjectToNodeMap()
public java.lang.String getClassPrefix()
public void dispose(JNode node)
Disposes the node and its children. If the node is null, this method doesn't do anything.
After being disposed, the node and its children should not be reused.
node
- protected void disposeNode(JNode node)
node
- public boolean isDisposed(JNode node)
true
if a node is
disposed.
node
-
dispose(JNode)
public void setControlModel(JControlModel controlModel) throws java.lang.IllegalArgumentException
controlModel
-
java.lang.IllegalArgumentException
- if the control model's facade helper is
different than this facade helper.public JControlModel getControlModel()
public JNode convertToNode(java.lang.Object object)
public abstract JNode cloneNode(java.lang.Object context, JNode node)
null
.
context
- node
-
public abstract java.lang.Object getContext(JNode node)
public abstract JCompilationUnit createCompilationUnit(java.lang.String name, java.lang.String contents)
protected abstract JNode doConvertToNode(java.lang.Object object)
public java.lang.String getOriginalContents(JCompilationUnit compilationUnit)
compilationUnit
-
public NodeConverter getNodeConverter()
null
if nonepublic JCompilationUnit getCompilationUnit(JNode node)
node
-
JCompilationUnit
of a JNode
or
null
.public JPackage getPackage(JNode node)
node
-
JPackage
of a JNode
or
null
public JType getMainType(JCompilationUnit compilationUnit)
compilationUnit
-
public <T extends JNode> java.util.List<T> getChildren(JNode node, java.lang.Class<T> cls)
node
- cls
- class of the child
JNode
public JNode getFirstChild(JNode node)
node
-
null
if this node has no childrengetChildren(JNode, Class)
public JNode getPrevious(JNode node)
node
-
null
if there is no preceding nodepublic JNode getNext(JNode node)
node
-
null
if there is no following nodeprotected JNode getSibiling(JNode node, int pos)
node
- pos
- position of the sibling, relative to the node (can be a negative number)
null
if this node has no childrengetChildren(JNode, Class)
public boolean addChild(JNode node, JNode child)
node
- the parent of the child to be addedchild
- the new child node
insertSibling(JNode, JNode, boolean)
,
remove(JNode)
public boolean insertSibling(JNode node, JNode newSibling, boolean before)
node
- the node that will be after the new siblingnewSibling
- the new sibling nodebefore
- whether the sibling should be added before the nodeaddChild(JNode, JNode)
,
remove(JNode)
public boolean remove(JNode node)
node
- the node to be removed
addChild(JNode, JNode)
,
insertSibling(JNode, JNode, boolean)
public void commentOut(JNode node)
JNode.getChildren()
node
- public java.lang.String applyFormatRules(java.lang.String value)
CodeGenUtil.convertFormat(String, boolean, String)
method.
value
-
public java.lang.String toString(java.lang.Object object)
object
- public boolean fixInterfaceBrace()
public boolean canYieldWrongJavadoc()
public boolean isSibilingTraversalExpensive()
getPrevious(JNode)
and
getNext(JNode)
methods is slower than using JNode.getChildren()
directly.
|
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 |