Search in sources :

Example 1 with ElementPresentation

use of com.intellij.util.text.ElementPresentation in project intellij-community by JetBrains.

the class PsiDiffContentFactory method comparePsiElements.

@Nullable
public static DiffRequest comparePsiElements(@NotNull PsiElement psiElement1, @NotNull PsiElement psiElement2) {
    if (!psiElement1.isValid() || !psiElement2.isValid())
        return null;
    Project project = psiElement1.getProject();
    LOG.assertTrue(project == psiElement2.getProject());
    DiffContent content1 = fromPsiElement(psiElement1);
    DiffContent content2 = fromPsiElement(psiElement2);
    if (content1 == null || content2 == null)
        return null;
    final ElementPresentation presentation1 = ElementPresentation.forElement(psiElement1);
    final ElementPresentation presentation2 = ElementPresentation.forElement(psiElement2);
    String title = DiffBundle.message("diff.element.qualified.name.vs.element.qualified.name.dialog.title", presentation1.getQualifiedName(), presentation2.getQualifiedName());
    return new SimpleDiffRequest(title, content1, content2, presentation1.getQualifiedName(), presentation2.getQualifiedName());
}
Also used : Project(com.intellij.openapi.project.Project) SimpleDiffRequest(com.intellij.diff.requests.SimpleDiffRequest) ElementPresentation(com.intellij.util.text.ElementPresentation) DiffContent(com.intellij.diff.contents.DiffContent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

DiffContent (com.intellij.diff.contents.DiffContent)1 SimpleDiffRequest (com.intellij.diff.requests.SimpleDiffRequest)1 Project (com.intellij.openapi.project.Project)1 ElementPresentation (com.intellij.util.text.ElementPresentation)1 Nullable (org.jetbrains.annotations.Nullable)1