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

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

public class JDOMFacadeHelper
extends FacadeHelper


Field Summary
protected  boolean forcedSourceCompatibility
           
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 orphan node (document fragment) as the last child of the specified node.
protected  void adjustSourceCompatibility(java.lang.String value)
           
 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.
 JNode cloneNode(java.lang.Object context, JNode node)
          Clones the specified node, returning an object that is related to the given context.
 JCompilationUnit createCompilationUnit(java.lang.String name, java.lang.String contents)
           
protected  JNode doConvertToNode(java.lang.Object object)
           
 boolean fixInterfaceBrace()
           
 java.lang.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.
 java.lang.String getOriginalContents(JCompilationUnit compilationUnit)
          Returns the original, unmodified, content of the compilation unit.
 JNode getPrevious(JNode node)
          Returns the sibling node immediately preceding the specified node.
 boolean insertSibling(JNode node, JNode sibiling, boolean before)
          Inserts the given orphan node as a sibling of the specified node, immediately before or after it.
 boolean isForcedSourceCompatibility()
           
 boolean isSibilingTraversalExpensive()
          Returns whether using the FacadeHelper.getPrevious(JNode) and FacadeHelper.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 setForcedSourceCompatibility(boolean forcedSourceCompatibility)
           
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.FacadeHelper
applyFormatRules, commentOut, convertToNode, dispose, disposeNode, getChildren, getClassPrefix, getCompilationUnit, getControlModel, getMainType, getNodeConverter, getObjectToNodeMap, getPackage, getSibiling, isDisposed, setControlModel, toString
 
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

forcedSourceCompatibility

protected boolean forcedSourceCompatibility
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

canMerge

public boolean canMerge()
Overrides:
canMerge in class FacadeHelper
Returns:
whether this facade helper can be used on a merge operation. Typically subclasses would return false depending on some environment requirement.

getJDOMFactory

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

setForcedSourceCompatibility

public void setForcedSourceCompatibility(boolean forcedSourceCompatibility)

isForcedSourceCompatibility

public boolean isForcedSourceCompatibility()

adjustSourceCompatibility

protected void adjustSourceCompatibility(java.lang.String value)

createCompilationUnit

public JCompilationUnit createCompilationUnit(java.lang.String name,
                                              java.lang.String contents)
Specified by:
createCompilationUnit in class FacadeHelper

getOriginalContents

public java.lang.String getOriginalContents(JCompilationUnit compilationUnit)
Description copied from class: FacadeHelper
Returns the original, unmodified, content of the compilation unit. Not all facade implementation may be able to provide this information.

Overrides:
getOriginalContents in class FacadeHelper
Returns:
the original contents or null

doConvertToNode

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

getContext

public java.lang.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 sibling of the node.

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

cloneNode

public JNode cloneNode(java.lang.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
Returns:
a cloned version of the specified node

addChild

public boolean addChild(JNode node,
                        JNode child)
Description copied from class: FacadeHelper
Adds the given orphan 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 operation was successful.
See Also:
FacadeHelper.insertSibling(JNode, JNode, boolean), FacadeHelper.remove(JNode)

insertSibling

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

Overrides:
insertSibling in class FacadeHelper
Parameters:
node - the node that will be after the new sibling
sibiling - the new sibling node
before - whether the sibling 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 successful.
See Also:
FacadeHelper.addChild(JNode, JNode), FacadeHelper.insertSibling(JNode, JNode, boolean)

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
Returns:
the first child, or null if this node has no children
See Also:
FacadeHelper.getChildren(JNode, Class)

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
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
Returns:
the next node, or null if there is no following node

fixInterfaceBrace

public boolean fixInterfaceBrace()
Overrides:
fixInterfaceBrace in class FacadeHelper

canYieldWrongJavadoc

public boolean canYieldWrongJavadoc()
Description copied from class: FacadeHelper
Returns whether this facade implementation may return the wrong Javadoc for a node when there are 2 or more javadoc blocks preceding the node.

Overrides:
canYieldWrongJavadoc in class FacadeHelper
Returns:
boolean

isSibilingTraversalExpensive

public boolean isSibilingTraversalExpensive()
Description copied from class: FacadeHelper
Returns whether using the FacadeHelper.getPrevious(JNode) and FacadeHelper.getNext(JNode) methods is slower than using JNode.getChildren() directly.

Overrides:
isSibilingTraversalExpensive in class FacadeHelper
Returns:
boolean

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