mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
[java] highlights package statements in module files
This commit is contained in:
+3
@@ -983,6 +983,9 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
public void visitPackageStatement(PsiPackageStatement statement) {
|
||||
super.visitPackageStatement(statement);
|
||||
myHolder.add(AnnotationsHighlightUtil.checkPackageAnnotationContainingFile(statement, myFile));
|
||||
if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_9)) {
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(ModuleHighlightUtil.checkPackageStatement(statement, myFile));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
@@ -92,6 +92,17 @@ public class ModuleHighlightUtil {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
static HighlightInfo checkPackageStatement(@NotNull PsiPackageStatement statement, @NotNull PsiFile file) {
|
||||
if (PsiUtil.isModuleFile(file)) {
|
||||
String message = JavaErrorMessages.message("module.no.package");
|
||||
HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(statement).description(message).create();
|
||||
QuickFixAction.registerQuickFixAction(info, new DeleteElementFix(statement));
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static HighlightInfo checkFileName(@NotNull PsiJavaModule element, @NotNull PsiFile file) {
|
||||
if (!MODULE_INFO_FILE.equals(file.getName())) {
|
||||
|
||||
Reference in New Issue
Block a user