List of usage examples for com.intellij.openapi.diff DiffContent getDocument
public abstract Document getDocument();
From source file:org.sonar.ide.idea.actions.OpenDiffToolAction.java
License:Open Source License
@Override public void actionPerformed(AnActionEvent event) { Project project = SonarActionUtils.getProject(event); VirtualFile file = SonarActionUtils.getVirtualFile(event); Document doc1 = FileDocumentManager.getInstance().getDocument(file); PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(doc1); // Load code from Sonar SourceCode source = SonarActionUtils.getIdeaSonar(event).search(psiFile); String content = source.getRemoteContent(); // Prepare content for diff SonarVirtualFile sonarVirtualFile = new SonarVirtualFile("Test.java", content.getBytes(), source.getKey()); DiffContent sonarDiffContent = createDiffContent(project, sonarVirtualFile); Document doc2 = sonarDiffContent.getDocument(); doc2.setReadOnly(true);//from w w w .jav a 2 s. c om // Show diff DiffRequest request = getDiffRequest(project, doc1, doc2); DiffManager.getInstance().getDiffTool().show(request); }