Class MergeFormattingSupport
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.compare.merge.MergeFormattingSupport
-
public class MergeFormattingSupport extends Object
Merge formatting support.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.compare.internal.DocLineComparator
createDocLineComparator(org.eclipse.jface.text.IDocument document)
Creates a newDocLineComparator
for the given document with the "ignoreWhiteSpace" flagfalse
.static com._1c.g5.gumtree.core.tree.INode
generateGumTreeAST(String moduleContent, org.eclipse.jface.text.IDocument moduleDocument)
Generates GumTree AST for the given Bsl module content and document.static String
merge(String mainModuleContent, String otherModuleContent, MergeRule mergeRule)
Runs 2-way merge for the given Bsl module text contents according to the special merge rule.static String
merge(String mainModuleContent, String otherModuleContent, String ancestorModuleContent, MergeRule mergeRule)
Runs 3-way merge for the given Bsl module text contents according to the special merge rule.static String
merge(String mainModuleContent, String otherModuleContent, String ancestorModuleContent, MergeRule mergeRule, List<MergeResultDifference> mergeConflicts)
Runs 3-way merge for the given Bsl module text contents according to the special merge rule and collects merge conflicts.static String
mergeBslModuleWithParsingModuleStructure(IComparisonSession session, BslModuleComparisonNode node, IBslModuleNodeContentProvider contentProvider, org.eclipse.xtext.resource.ILocationInFileProvider locationInFileProvider)
Merges the differences in the specified Bsl module node with parsing module structure.static com._1c.g5.gumtree.core.DiffsCreator
runGumtreeDiffer(org.eclipse.jface.text.IDocument mainModuleDocument, org.eclipse.jface.text.IDocument otherModuleDocument, org.eclipse.jface.text.IDocument ancestorModuleDocument, com._1c.g5.gumtree.core.tree.INode mainModuleTree, com._1c.g5.gumtree.core.tree.INode otherModuleTree, com._1c.g5.gumtree.core.tree.INode ancestorModuleTree, boolean runMovedBlockMatcher, boolean joinDiffBlocks)
Runs GumTree 2-/3-way diff for the given Bsl modules.
-
-
-
Method Detail
-
merge
public static String merge(String mainModuleContent, String otherModuleContent, MergeRule mergeRule)
Runs 2-way merge for the given Bsl module text contents according to the special merge rule. Main module content and other module content can not benull
simultaneously.- Parameters:
mainModuleContent
- the main text content, can benull
otherModuleContent
- the other text content, can benull
mergeRule
- the special merge rule, can not benull
- Returns:
- the result of merge, can be be
null
-
merge
public static String merge(String mainModuleContent, String otherModuleContent, String ancestorModuleContent, MergeRule mergeRule)
Runs 3-way merge for the given Bsl module text contents according to the special merge rule. Main module content and other module content can not benull
simultaneously.- Parameters:
mainModuleContent
- the main text content, can benull
otherModuleContent
- the other text content, can benull
ancestorModuleContent
- the ancestor text content, can benull
mergeRule
- the special merge rule, can not benull
- Returns:
- the result of merge, can be
null
-
merge
public static String merge(String mainModuleContent, String otherModuleContent, String ancestorModuleContent, MergeRule mergeRule, List<MergeResultDifference> mergeConflicts)
Runs 3-way merge for the given Bsl module text contents according to the special merge rule and collects merge conflicts. Main module content and other module content can not benull
simultaneously.- Parameters:
mainModuleContent
- the main text content, can benull
otherModuleContent
- the other text content, can benull
ancestorModuleContent
- the ancestor text content, can benull
mergeRule
- the special merge rule, can not benull
mergeConflicts
- the list to store merge conflicts, can not benull
- Returns:
- the result of merge, can be
null
-
generateGumTreeAST
public static com._1c.g5.gumtree.core.tree.INode generateGumTreeAST(String moduleContent, org.eclipse.jface.text.IDocument moduleDocument) throws com._1c.g5.gumtree.core.tree.TreeGeneratorException
Generates GumTree AST for the given Bsl module content and document.- Parameters:
moduleContent
- the Bsl module content, can not benull
moduleDocument
- the Bsl module document, can not benull
- Returns:
- the newly generated AST, can not be
null
- Throws:
com._1c.g5.gumtree.core.tree.TreeGeneratorException
-
runGumtreeDiffer
public static com._1c.g5.gumtree.core.DiffsCreator runGumtreeDiffer(org.eclipse.jface.text.IDocument mainModuleDocument, org.eclipse.jface.text.IDocument otherModuleDocument, org.eclipse.jface.text.IDocument ancestorModuleDocument, com._1c.g5.gumtree.core.tree.INode mainModuleTree, com._1c.g5.gumtree.core.tree.INode otherModuleTree, com._1c.g5.gumtree.core.tree.INode ancestorModuleTree, boolean runMovedBlockMatcher, boolean joinDiffBlocks)
Runs GumTree 2-/3-way diff for the given Bsl modules.- Parameters:
mainModuleDocument
- the main module document, can not benull
otherModuleDocument
- the other module document, can not benull
ancestorModuleDocument
- the ancestor module document, may benull
mainModuleTree
- the main module GumTree AST, can not benull
otherModuleTree
- the other module GumTree AST, can not benull
ancestorModuleTree
- the ancestor module GumTree AST, can not benull
runMovedBlockMatcher
- defines whether the moved blocks matching is requiredjoinDiffBlocks
- defines whether the blocks joining is required- Returns:
DiffsCreator
with found diffs, can not benull
-
createDocLineComparator
public static org.eclipse.compare.internal.DocLineComparator createDocLineComparator(org.eclipse.jface.text.IDocument document)
Creates a newDocLineComparator
for the given document with the "ignoreWhiteSpace" flagfalse
.- Parameters:
document
- the givenIDocument
, can not benull
- Returns:
- the
DocLineComparator
instance, can not benull
-
mergeBslModuleWithParsingModuleStructure
public static String mergeBslModuleWithParsingModuleStructure(IComparisonSession session, BslModuleComparisonNode node, IBslModuleNodeContentProvider contentProvider, org.eclipse.xtext.resource.ILocationInFileProvider locationInFileProvider)
Merges the differences in the specified Bsl module node with parsing module structure.- Parameters:
node
- the Bsl module comparison node, cannot benull
contentProvider
- the Bsl module content provider for the specified side, cannot benull
isThreeWay
- tells whether the comparison/merge is three-waylocationInFileProvider
- the location in file provider, cannot benull
- Returns:
- the merged with parsing module structure Bsl module content, never
null
-
-