diff --git a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt index 4f02890be791..5a26d6a4aa20 100644 --- a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt +++ b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt @@ -16,6 +16,9 @@ package com.intellij.codeInsight.daemon.impl import com.intellij.ProjectTopics +import com.intellij.diff.DiffContentFactory +import com.intellij.diff.DiffManager +import com.intellij.diff.requests.SimpleDiffRequest import com.intellij.openapi.fileEditor.FileEditor import com.intellij.openapi.fileEditor.OpenFileDescriptor import com.intellij.openapi.fileTypes.LanguageFileType @@ -56,12 +59,19 @@ class LibrarySourceNotificationProvider(private val project: Project, notificati if (offender != null) { val panel = ColoredNotificationPanel(LightColors.RED) panel.setText(ProjectBundle.message("library.source.mismatch", offender.name)) - panel.createActionLabel(ProjectBundle.message("library.source.open.class"), { - val classFile = offender.originalElement.containingFile?.virtualFile - if (classFile != null) { - OpenFileDescriptor(project, classFile, -1).navigate(true) - } - }) + + val clsFile = offender.originalElement.containingFile?.virtualFile + if (clsFile != null) { + panel.createActionLabel(ProjectBundle.message("library.source.open.class"), { + OpenFileDescriptor(project, clsFile, -1).navigate(true) + }) + panel.createActionLabel(ProjectBundle.message("library.source.show.diff"), { + val cf = DiffContentFactory.getInstance() + val request = SimpleDiffRequest(null, cf.create(project, clsFile), cf.create(project, file), clsFile.path, file.path) + DiffManager.getInstance().showDiff(project, request) + }) + } + return panel } } diff --git a/platform/projectModel-impl/src/messages/ProjectBundle.properties b/platform/projectModel-impl/src/messages/ProjectBundle.properties index d2de430f2bc2..383b3ebf1c23 100644 --- a/platform/projectModel-impl/src/messages/ProjectBundle.properties +++ b/platform/projectModel-impl/src/messages/ProjectBundle.properties @@ -141,6 +141,7 @@ project.sdk.setup=Setup SDK library.source.mismatch=Library source does not match the bytecode for class {0} library.source.open.class=Open .class file +library.source.show.diff=Show diff module.module.language.level=&Language level: module.circular.dependency.warning.short=There is circular dependency between {0}