From 4049b71f17196534b64dcd59644b4b69b279358f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 7 Jan 2016 17:35:43 +0100 Subject: [PATCH] [java] library source compatibility check restricted to Java; no notification for matched files --- .../impl/LibrarySourceNotificationProvider.kt | 13 ++++++------- .../src/messages/ProjectBundle.properties | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) 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 41a7ac991e09..4f02890be791 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 @@ -51,14 +51,13 @@ class LibrarySourceNotificationProvider(private val project: Project, notificati override fun createNotificationPanel(file: VirtualFile, fileEditor: FileEditor): EditorNotificationPanel? { if (file.fileType is LanguageFileType && ProjectRootManager.getInstance(project).fileIndex.isInLibrarySource(file)) { val psiFile = PsiManager.getInstance(project).findFile(file) - if (psiFile is PsiClassOwner) { - val classes = psiFile.classes - if (classes.isNotEmpty()) { - val mismatch = classes.any { differs(it) } - val panel = ColoredNotificationPanel(if (mismatch) LightColors.RED else null) - panel.setText(ProjectBundle.message(if (mismatch) "library.source.mismatch" else "library.source.file")) + if (psiFile is PsiJavaFile) { + val offender = psiFile.classes.find { differs(it) } + 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 = classes[0].originalElement.containingFile?.virtualFile + val classFile = offender.originalElement.containingFile?.virtualFile if (classFile != null) { OpenFileDescriptor(project, classFile, -1).navigate(true) } diff --git a/platform/projectModel-impl/src/messages/ProjectBundle.properties b/platform/projectModel-impl/src/messages/ProjectBundle.properties index 1d825f377113..7817726dfe78 100644 --- a/platform/projectModel-impl/src/messages/ProjectBundle.properties +++ b/platform/projectModel-impl/src/messages/ProjectBundle.properties @@ -138,8 +138,7 @@ library.choose.one.to.attach=Multiple libraries contain the file.