org.eclipse.emf.codegen.merge.java.facade.jdom
Class JDOMFacadeHelper

java.lang.Object
  extended byorg.eclipse.emf.codegen.merge.java.facade.FacadeHelper
      extended byorg.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHelper

public class JDOMFacadeHelper
extends FacadeHelper


Field Summary
protected  org.eclipse.jdt.core.jdom.DOMFactory jdomFactory
           
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.FacadeHelper
CLASS_PREFIX, controlModel, objectToNodeMap
 
Constructor Summary
JDOMFacadeHelper()
           
 
Method Summary
 boolean addChild(JNode node, JNode child)
          Adds the given un-parented node (document fragment) as the last child of the specified node.
 JNode cloneNode(Object context, JNode node)
          Clones the specified node, returning an object that is related to the given context.
 JCompilationUnit createCompilationUnit(String name, String content)
           
protected  JNode doConvertToNode(Object object)
           
 Object getContext(JNode node)
          Returns the context of a node.
 JNode getFirstChild(JNode node)
          Returns the first child of the specified node.
static org.eclipse.jdt.core.jdom.IDOMNode getIDOMNode(JNode node)
           
protected  org.eclipse.jdt.core.jdom.DOMFactory getJDOMFactory()
           
 JNode getNext(JNode node)
          Returns the sibling node immediately following the specified node.
 JNode getPrevious(JNode node)
          Returns the sibling node immediately preceding the specified node.
 boolean insertSibling(JNode node, JNode sibiling, boolean before)
          Inserts the given un-parented node as a sibling of the specofoed node, immediately before or after it.
 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()
           
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.FacadeHelper
applyFormatRules, convertToNode, getChildren, getClassPrefix, getCompilationUnit, getControlModel, getMainType, getObjectToNodeMap, getPackage, getSibiling, setControlModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jdomFactory

protected org.eclipse.jdt.core.jdom.DOMFactory jdomFactory
Constructor Detail

JDOMFacadeHelper

public JDOMFacadeHelper()
Method Detail

getIDOMNode

public static org.eclipse.jdt.core.jdom.IDOMNode getIDOMNode(JNode node)

reset

public void reset()
Overrides:
reset in class FacadeHelper

getJDOMFactory

protected org.eclipse.jdt.core.jdom.DOMFactory getJDOMFactory()

createCompilationUnit

public JCompilationUnit createCompilationUnit(String name,
                                              String content)
Specified by:
createCompilationUnit in class FacadeHelper

doConvertToNode

protected JNode doConvertToNode(Object object)
Specified by:
doConvertToNode in class FacadeHelper

getContext

public Object getContext(JNode node)
Description copied from class: FacadeHelper
Returns the context of a node. The context is usually an object that would be used to create a child or sibiling of the node.

Specified by:
getContext in class FacadeHelper
Returns:
the context of a node.

cloneNode

public JNode cloneNode(Object context,
                       JNode node)
Description copied from class: FacadeHelper
Clones the specified node, returning an object that is related to the given context. On some implementations the context may be null.

Specified by:
cloneNode in class FacadeHelper
Parameters:
context -
node -
Returns:
a cloned version of the specified node

addChild

public boolean addChild(JNode node,
                        JNode child)
Description copied from class: FacadeHelper
Adds the given un-parented node (document fragment) as the last child of the specified node.

Overrides:
addChild in class FacadeHelper
Parameters:
node - the parent of the child to be added
child - the new child node
Returns:
whether the opearation was succesful.
See Also:
#insertSibling(JNode, JNode), FacadeHelper.remove(JNode)

insertSibling

public boolean insertSibling(JNode node,
                             JNode sibiling,
                             boolean before)
Description copied from class: FacadeHelper
Inserts the given un-parented node as a sibling of the specofoed node, immediately before or after it.

Overrides:
insertSibling in class FacadeHelper
Parameters:
node - the node that will be after the new sibiling
before - whether the sibiling should be added before the node
See Also:
FacadeHelper.addChild(JNode, JNode), FacadeHelper.remove(JNode)

remove

public boolean remove(JNode node)
Description copied from class: FacadeHelper
Separates the specified node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment. A document fragment that is removed from its host document may still be dependent on that host document until it is inserted into a different document. Removing a root node has no effect.

Overrides:
remove in class FacadeHelper
Parameters:
node - the node to be removed
Returns:
whether the operation was succesful.
See Also:
FacadeHelper.addChild(JNode, JNode), #insertSibling(JNode, JNode)

getFirstChild

public JNode getFirstChild(JNode node)
Description copied from class: FacadeHelper
Returns the first child of the specified node. Children appear in the order in which they exist in the source code.

Overrides:
getFirstChild in class FacadeHelper
Parameters:
node -
Returns:
the first child, or null if this node has no children
See Also:
#getChildren()

getPrevious

public JNode getPrevious(JNode node)
Description copied from class: FacadeHelper
Returns the sibling node immediately preceding the specified node.

Overrides:
getPrevious in class FacadeHelper
Parameters:
node -
Returns:
the previous node, or null if there is no preceding node

getNext

public JNode getNext(JNode node)
Description copied from class: FacadeHelper
Returns the sibling node immediately following the specified node.

Overrides:
getNext in class FacadeHelper
Parameters:
node -
Returns:
the next node, or null if there is no following node

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.