Search in sources :

Example 1 with DocumentContent

use of com.intellij.openapi.diff.DocumentContent in project intellij-community by JetBrains.

the class OpenPartialDiffAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    DataContext dataContext = e.getDataContext();
    MergePanel2 mergePanel = MergePanel2.fromDataContext(dataContext);
    Project project = projectFromDataContext(dataContext);
    Editor leftEditor = mergePanel.getEditor(myLeftIndex);
    Editor rightEditor = mergePanel.getEditor(myRightIndex);
    FileType type = mergePanel.getContentType();
    SimpleDiffRequest diffData = new SimpleDiffRequest(project, composeName());
    diffData.setContents(new DocumentContent(project, leftEditor.getDocument(), type), new DocumentContent(project, rightEditor.getDocument(), type));
    diffData.setContentTitles(mergePanel.getVersionTitle(myLeftIndex), mergePanel.getVersionTitle(myRightIndex));
    LOG.assertTrue(DiffManagerImpl.INTERNAL_DIFF.canShow(diffData));
    DiffManagerImpl.INTERNAL_DIFF.show(diffData);
}
Also used : Project(com.intellij.openapi.project.Project) SimpleDiffRequest(com.intellij.openapi.diff.SimpleDiffRequest) FileType(com.intellij.openapi.fileTypes.FileType) DocumentContent(com.intellij.openapi.diff.DocumentContent) Editor(com.intellij.openapi.editor.Editor)

Aggregations

DocumentContent (com.intellij.openapi.diff.DocumentContent)1 SimpleDiffRequest (com.intellij.openapi.diff.SimpleDiffRequest)1 Editor (com.intellij.openapi.editor.Editor)1 FileType (com.intellij.openapi.fileTypes.FileType)1 Project (com.intellij.openapi.project.Project)1