mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] library source compatibility check restricted to Java; no notification for matched files
This commit is contained in:
+6
-7
@@ -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)
|
||||
}
|
||||
|
||||
@@ -138,8 +138,7 @@ library.choose.one.to.attach=<html><body>Multiple libraries contain the file.<br
|
||||
project.sdk.not.defined=Project SDK is not defined
|
||||
project.sdk.setup=Setup SDK
|
||||
|
||||
library.source.file=Library source file
|
||||
library.source.mismatch=Library source does not match the bytecode
|
||||
library.source.mismatch=Library source does not match the bytecode for class {0}
|
||||
library.source.open.class=Open .class file
|
||||
|
||||
module.module.language.level=&Language level:
|
||||
|
||||
Reference in New Issue
Block a user