org.eclipse.emf.codegen.jmerge
Class JMerger

java.lang.Object
  extended byorg.eclipse.emf.codegen.jmerge.JMerger
All Implemented Interfaces:
IPlatformRunnable

public class JMerger
extends Object
implements IPlatformRunnable

This implements the method run(java.lang.Object), which is called just like main during headless workbench invocation.


Nested Class Summary
static class JMerger.FindAndReplace
           
 
Field Summary
protected static Pattern braceLine
           
protected  boolean isBlocked
           
protected  JControlModel jControlModel
           
protected  org.eclipse.jdt.core.jdom.DOMFactory jdomFactory
           
protected static Pattern leadingTabs
           
protected static String lineSeparator
           
protected static Object[] noArguments
           
protected  Map orderedSourceChildrenMap
           
protected  org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit
           
protected  JPatternDictionary sourcePatternDictionary
           
protected  Map sourceToTargetMap
           
protected  org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit
           
protected  JPatternDictionary targetPatternDictionary
           
protected  Map targetToSourceMap
           
 
Fields inherited from interface org.eclipse.core.runtime.IPlatformRunnable
EXIT_OK, EXIT_RELAUNCH, EXIT_RESTART
 
Constructor Summary
JMerger()
          This creates an empty instances, an when used as a runnable.
JMerger(JControlModel jControlModel, org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit, org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit)
           
 
Method Summary
protected  String applyFormatRules(String value)
           
protected  void applyPullRules(org.eclipse.jdt.core.jdom.IDOMNode sourceNode, org.eclipse.jdt.core.jdom.IDOMNode targetNode)
           
 void applySortRules(org.eclipse.jdt.core.jdom.IDOMNode sourceNode)
           
protected  void applySweepRules(org.eclipse.jdt.core.jdom.IDOMNode targetNode)
           
 org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForContents(String contents)
          Create a JDOM from contents.
 org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForInputStream(InputStream inputStream)
           
 org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForURI(String uri)
          Create a JDOM from a URI.
 String execute(IProgressMonitor progressMonitor, String[] arguments)
          Utilitiy for headless operations.
 JControlModel getControlModel()
           
 org.eclipse.jdt.core.jdom.IDOMCompilationUnit getSourceCompilationUnit()
           
 String getSourceCompilationUnitContents()
           
 JPatternDictionary getSourcePatternDictionary()
           
 Map getSourceToTargetMap()
           
 org.eclipse.jdt.core.jdom.IDOMCompilationUnit getTargetCompilationUnit()
           
 String getTargetCompilationUnitContents()
           
 JPatternDictionary getTargetPatternDictionary()
           
protected  org.eclipse.jdt.core.jdom.IDOMNode insertClone(org.eclipse.jdt.core.jdom.IDOMNode sourceNode)
           
protected  void map(org.eclipse.jdt.core.jdom.IDOMNode sourceNode, org.eclipse.jdt.core.jdom.IDOMNode targetNode)
           
protected  void mapChildren(org.eclipse.jdt.core.jdom.IDOMNode sourceNode, org.eclipse.jdt.core.jdom.IDOMNode targetNode)
           
 void merge()
           
protected  void pullTargetCompilationUnit()
           
protected  void pullTargetField(org.eclipse.jdt.core.jdom.IDOMField targetField)
           
protected  void pullTargetImport(org.eclipse.jdt.core.jdom.IDOMImport targetImport)
           
protected  void pullTargetInitializer(org.eclipse.jdt.core.jdom.IDOMInitializer targetInitializer)
           
protected  void pullTargetMethod(org.eclipse.jdt.core.jdom.IDOMMethod targetMethod)
           
protected  void pullTargetPackage(org.eclipse.jdt.core.jdom.IDOMPackage targetPackage)
           
protected  void pullTargetType(org.eclipse.jdt.core.jdom.IDOMType targetType)
           
protected  void pushSourceCompilationUnit()
           
protected  void pushSourceField(org.eclipse.jdt.core.jdom.IDOMField sourceField)
           
protected  void pushSourceImport(org.eclipse.jdt.core.jdom.IDOMImport sourceImport)
           
protected  void pushSourceInitializer(org.eclipse.jdt.core.jdom.IDOMInitializer sourceInitializer)
           
protected  void pushSourceMethod(org.eclipse.jdt.core.jdom.IDOMMethod sourceMethod)
           
protected  void pushSourcePackage(org.eclipse.jdt.core.jdom.IDOMPackage sourcePackage)
           
protected  void pushSourceType(org.eclipse.jdt.core.jdom.IDOMType sourceType)
           
 void remerge()
           
 Object run(Object object)
          This is called with the command line arguments of a headless workbench invocation.
 void setControlModel(JControlModel jControlModel)
           
 void setSourceCompilationUnit(org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit)
           
 void setSourcePatternDictionary(JPatternDictionary sourcePatternDictionary)
           
 void setSourceToTargetMap(Map sourceToTargetMap)
           
 void setTargetCompilationUnit(org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit)
           
 void setTargetPatternDictionary(JPatternDictionary targetPatternDictionary)
           
protected  void sortTargetCompilationUnit()
           
protected  void sweepTargetCompilationUnit()
           
 
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

jControlModel

protected JControlModel jControlModel

sourceCompilationUnit

protected org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit

targetCompilationUnit

protected org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit

sourcePatternDictionary

protected JPatternDictionary sourcePatternDictionary

targetPatternDictionary

protected JPatternDictionary targetPatternDictionary

sourceToTargetMap

protected Map sourceToTargetMap

targetToSourceMap

protected Map targetToSourceMap

orderedSourceChildrenMap

protected Map orderedSourceChildrenMap

isBlocked

protected boolean isBlocked

lineSeparator

protected static String lineSeparator

braceLine

protected static Pattern braceLine

leadingTabs

protected static Pattern leadingTabs

noArguments

protected static Object[] noArguments
Constructor Detail

JMerger

public JMerger()
This creates an empty instances, an when used as a runnable.


JMerger

public JMerger(JControlModel jControlModel,
               org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit,
               org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit)
Method Detail

merge

public void merge()

remerge

public void remerge()

getControlModel

public JControlModel getControlModel()

setControlModel

public void setControlModel(JControlModel jControlModel)

getSourceCompilationUnitContents

public String getSourceCompilationUnitContents()

getSourceCompilationUnit

public org.eclipse.jdt.core.jdom.IDOMCompilationUnit getSourceCompilationUnit()

setSourceCompilationUnit

public void setSourceCompilationUnit(org.eclipse.jdt.core.jdom.IDOMCompilationUnit sourceCompilationUnit)

getTargetCompilationUnitContents

public String getTargetCompilationUnitContents()

getTargetCompilationUnit

public org.eclipse.jdt.core.jdom.IDOMCompilationUnit getTargetCompilationUnit()

setTargetCompilationUnit

public void setTargetCompilationUnit(org.eclipse.jdt.core.jdom.IDOMCompilationUnit targetCompilationUnit)

getSourcePatternDictionary

public JPatternDictionary getSourcePatternDictionary()

setSourcePatternDictionary

public void setSourcePatternDictionary(JPatternDictionary sourcePatternDictionary)

getTargetPatternDictionary

public JPatternDictionary getTargetPatternDictionary()

setTargetPatternDictionary

public void setTargetPatternDictionary(JPatternDictionary targetPatternDictionary)

getSourceToTargetMap

public Map getSourceToTargetMap()

setSourceToTargetMap

public void setSourceToTargetMap(Map sourceToTargetMap)

createCompilationUnitForURI

public org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForURI(String uri)
Create a JDOM from a URI.


createCompilationUnitForInputStream

public org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForInputStream(InputStream inputStream)

createCompilationUnitForContents

public org.eclipse.jdt.core.jdom.IDOMCompilationUnit createCompilationUnitForContents(String contents)
Create a JDOM from contents.


pullTargetCompilationUnit

protected void pullTargetCompilationUnit()

pullTargetPackage

protected void pullTargetPackage(org.eclipse.jdt.core.jdom.IDOMPackage targetPackage)

pullTargetImport

protected void pullTargetImport(org.eclipse.jdt.core.jdom.IDOMImport targetImport)

pullTargetType

protected void pullTargetType(org.eclipse.jdt.core.jdom.IDOMType targetType)

pullTargetInitializer

protected void pullTargetInitializer(org.eclipse.jdt.core.jdom.IDOMInitializer targetInitializer)

pullTargetField

protected void pullTargetField(org.eclipse.jdt.core.jdom.IDOMField targetField)

pullTargetMethod

protected void pullTargetMethod(org.eclipse.jdt.core.jdom.IDOMMethod targetMethod)

applyFormatRules

protected String applyFormatRules(String value)

applyPullRules

protected void applyPullRules(org.eclipse.jdt.core.jdom.IDOMNode sourceNode,
                              org.eclipse.jdt.core.jdom.IDOMNode targetNode)

pushSourceCompilationUnit

protected void pushSourceCompilationUnit()

pushSourcePackage

protected void pushSourcePackage(org.eclipse.jdt.core.jdom.IDOMPackage sourcePackage)

pushSourceImport

protected void pushSourceImport(org.eclipse.jdt.core.jdom.IDOMImport sourceImport)

pushSourceType

protected void pushSourceType(org.eclipse.jdt.core.jdom.IDOMType sourceType)

pushSourceInitializer

protected void pushSourceInitializer(org.eclipse.jdt.core.jdom.IDOMInitializer sourceInitializer)

pushSourceField

protected void pushSourceField(org.eclipse.jdt.core.jdom.IDOMField sourceField)

pushSourceMethod

protected void pushSourceMethod(org.eclipse.jdt.core.jdom.IDOMMethod sourceMethod)

applySortRules

public void applySortRules(org.eclipse.jdt.core.jdom.IDOMNode sourceNode)

sweepTargetCompilationUnit

protected void sweepTargetCompilationUnit()

applySweepRules

protected void applySweepRules(org.eclipse.jdt.core.jdom.IDOMNode targetNode)

sortTargetCompilationUnit

protected void sortTargetCompilationUnit()

insertClone

protected org.eclipse.jdt.core.jdom.IDOMNode insertClone(org.eclipse.jdt.core.jdom.IDOMNode sourceNode)

mapChildren

protected void mapChildren(org.eclipse.jdt.core.jdom.IDOMNode sourceNode,
                           org.eclipse.jdt.core.jdom.IDOMNode targetNode)

map

protected void map(org.eclipse.jdt.core.jdom.IDOMNode sourceNode,
                   org.eclipse.jdt.core.jdom.IDOMNode targetNode)

run

public Object run(Object object)
This is called with the command line arguments of a headless workbench invocation.

Specified by:
run in interface IPlatformRunnable

execute

public String execute(IProgressMonitor progressMonitor,
                      String[] arguments)
Utilitiy for headless operations.

Returns:
the merged content
Since:
2.1.0

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