See: Description
Interface | Description |
---|---|
MergeNode<T> |
Class | Description |
---|---|
AbstractMergeAddin | Deprecated
replaced by
DynamicMergeAddin |
AbstractMergeEditor | Deprecated
replaced by
DynamicMergeEditor . |
BaseMergeAddin | |
BaseMergeEditor | |
BaseMergeNode<T> | |
BaseTextMergeEditor | |
DynamicMergeAddin | |
DynamicMergeEditor | |
MergeContext | |
MergeController |
Controller class for merge editor commands.
|
MergeEngine |
Facade/utility class for performing a merge operation and contructing a
CompareModel instance from the result.
|
MergeURLFileSystemHelper |
Filesystem helper class for the "ide.merge" protocol used by merge node URLs.
|
MergeUtil |
Utilities class for merge editor consumers / providers.
|
RestartMergeCommand |
Command class for restarting an editor merge task (losing changes).
|
SaveMergeCommand |
Command class for saving editor merge results.
|
TextMergeContributor |
Textual merge compare contributor class, based around a
TextBuffer . |
TextMergeEditor |
Textual merge editor specialization class.
|
TextMergeNode |
Code examples
To create and register a merge editor addin:
import java.net.URL; import oracle.ide.editor.EditorManager; import oracle.jdeveloper.merge.AbstractMergeAddin; ... AbstractMergeAddin mergeEditorAddin = new AbstractMergeAddin( AcmeMergeEditor.class ) { protected boolean isEditorAvailable( URL url ) { ... } }; EditorManager.getEditorManager().registerDynamic( mergeEditorAddin );
To deregister and dispose a merge editor addin:
import oracle.ide.editor.EditorManager; import oracle.jdeveloper.merge.AbstractMergeAddin; ... AbstractMergeAddin mergeEditorAddin = ... ... EditorManager.getEditorManager().unregister( mergeEditorAddin ); mergeEditorAddin.closeEditors(); mergeEditorAddin = null;
Implementing a textual merge editor which builds and returns a model:
import java.io.IOException; import java.net.URL; import oracle.ide.addin.Context; import oracle.ide.net.URLFileSystem; import oracle.javatools.buffer.TextBuffer; import oracle.javatools.buffer.TextBufferFactory; import oracle.javatools.compare.algorithm.text.OffsetDifferenceBlock; import oracle.javatools.compare.algorithm.text.TextCompareContributor; import oracle.javatools.compare.algorithm.text.TextCompareModel; import oracle.jdeveloper.merge.TextMergeContributor; import oracle.jdeveloper.merge.TextMergeNodeContributor; import oracle.jdeveloper.merge.BaseTextMergeEditor; import oracle.jdeveloper.merge.TextMergeNode; ... public class AcmeMergeEditor extends BaseTextMergeEditor { protected TextCompareModel createTextMergeModel( Context context ) throws IOException { TextBuffer textBuffer1 = TextBufferFactory.createTextBuffer(); TextBuffer textBuffer2 = TextBufferFactory.createTextBuffer(); TextBuffer textBufferA = TextBufferFactory.createTextBuffer(); ... // Example initialization of a single difference block OffsetDifferenceBlock differenceBlock = new OffsetDifferenceBlock( OffsetDifferenceBlock.TYPE_CHANGE, textBuffer1, textBuffer2, textBufferA ); differenceBlock.setFirstStart( 1 ); differenceBlock.setSecondStart( 1 ); differenceBlock.setAncestorStart( 1 ); differenceBlock.setFirstLength( 2 ); differenceBlock.setSecondLength( 3 ); differenceBlock.setAncestorLength( 0 ); URL url = context.getDocument().getURL(); setTextMergeNode( new TextMergeNode( url, textBufferA ) ); TextCompareContributor contributor1 = new TextMergeContributor( textBuffer1, URLFileSystem.getSuffix( url ), "Source" ); TextCompareContributor contributor2 = new TextMergeContributor( textBuffer2, URLFileSystem.getSuffix( url ), "Target" ); TextCompareContributor contributorA = new TextMergeNodeContributor( getTextMergeNode(), "Result of Merge" ); return new TextCompareModel( contributor1, contributor2, contributorA, new OffsetDifferenceBlock[] { differenceBlock } ); } }
Implementing a command to make the merge editor of a document visible:
import java.io.IOException; import oracle.ide.Ide; import oracle.ide.addin.AbstractCommand; import oracle.ide.addin.Command; import oracle.jdeveloper.merge.MergeUtil; ... public class AcmeMergeCommand extends AbstractCommand { public static final int CMD_ID = Ide.findOrCreateCmdID( "AcmeMergeCommand" ); public AcmeMergeCommand() { super( AcmeMergeCommand.CMD_ID ); } public int doit() throws IOException { MergeUtil.reopenMergeEditor( getContext().getDocument(), AcmeMergeEditor.class ); return Command.OK; } }