Refactoring: rename methods
This commit is contained in:
@@ -41,7 +41,7 @@ public class DebugInfoAnnotator implements Annotator {
|
||||
|
||||
@Override
|
||||
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) {
|
||||
if (!isDebugInfoEnabled() || !ProjectRootsUtil.isInSource(element)) {
|
||||
if (!isDebugInfoEnabled() || !ProjectRootsUtil.isInProjectOrLibSource(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class DuplicateJvmSignatureAnnotator implements Annotator {
|
||||
@Override
|
||||
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
|
||||
if (!(element instanceof JetFile) && !(element instanceof JetDeclaration)) return;
|
||||
if (!ProjectRootsUtil.isInSource(element, false)) return;
|
||||
if (!ProjectRootsUtil.isInProjectSource(element)) return;
|
||||
|
||||
PsiFile file = element.getContainingFile();
|
||||
if (!(file instanceof JetFile) || TargetPlatformDetector.getPlatform((JetFile) file) != TargetPlatform.JVM) return;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
|
||||
|
||||
@Override
|
||||
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
|
||||
if (!(ProjectRootsUtil.isInSource(element) || element.getContainingFile() instanceof JetCodeFragment)) return;
|
||||
if (!(ProjectRootsUtil.isInProjectOrLibSource(element) || element.getContainingFile() instanceof JetCodeFragment)) return;
|
||||
|
||||
for (HighlightingVisitor visitor : getBeforeAnalysisVisitors(holder)) {
|
||||
element.accept(visitor);
|
||||
@@ -116,7 +116,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
|
||||
}
|
||||
|
||||
public static void annotateElement(PsiElement element, AnnotationHolder holder, Diagnostics diagnostics) {
|
||||
if (ProjectRootsUtil.isInSource(element, /* includeLibrarySources = */ false) || element.getContainingFile() instanceof JetCodeFragment) {
|
||||
if (ProjectRootsUtil.isInProjectSource(element) || element.getContainingFile() instanceof JetCodeFragment) {
|
||||
ElementAnnotator elementAnnotator = new ElementAnnotator(element, holder);
|
||||
for (Diagnostic diagnostic : diagnostics.forElement(element)) {
|
||||
elementAnnotator.registerDiagnosticAnnotations(diagnostic);
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.jetbrains.jet.plugin.util.application.runReadAction
|
||||
import org.jetbrains.jet.plugin.stubindex.JetSourceFilterScope
|
||||
|
||||
public object ProjectRootsUtil {
|
||||
platformStatic
|
||||
public fun isInSource(element: PsiElement, includeLibrarySources: Boolean): Boolean {
|
||||
private fun isInSource(element: PsiElement, includeLibrarySources: Boolean): Boolean {
|
||||
return runReadAction { (): Boolean ->
|
||||
val containingFile = element.getContainingFile()
|
||||
if (containingFile == null) return@runReadAction false
|
||||
@@ -39,7 +38,12 @@ public object ProjectRootsUtil {
|
||||
}
|
||||
|
||||
platformStatic
|
||||
public fun isInSource(element: PsiElement): Boolean {
|
||||
public fun isInProjectSource(element: PsiElement): Boolean {
|
||||
return isInSource(element, false)
|
||||
}
|
||||
|
||||
platformStatic
|
||||
public fun isInProjectOrLibSource(element: PsiElement): Boolean {
|
||||
return isInSource(element, true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user