Refactoring: rename method and hide information about gradle
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.isInSourceWithGradleCheck(element)) {
|
||||
if (!isDebugInfoEnabled() || !ProjectRootsUtil.isInSource(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
|
||||
|
||||
@Override
|
||||
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
|
||||
if (!(ProjectRootsUtil.isInSourceWithGradleCheck(element) || element.getContainingFile() instanceof JetCodeFragment)) return;
|
||||
if (!(ProjectRootsUtil.isInSource(element) || element.getContainingFile() instanceof JetCodeFragment)) return;
|
||||
|
||||
for (HighlightingVisitor visitor : getBeforeAnalysisVisitors(holder)) {
|
||||
element.accept(visitor);
|
||||
|
||||
@@ -27,11 +27,6 @@ import kotlin.platform.platformStatic
|
||||
import org.jetbrains.jet.plugin.util.application.runReadAction
|
||||
|
||||
public object ProjectRootsUtil {
|
||||
platformStatic
|
||||
private fun isInSource(element: PsiElement): Boolean {
|
||||
return isInSource(element, true)
|
||||
}
|
||||
|
||||
platformStatic
|
||||
public fun isInSource(element: PsiElement, includeLibrarySources: Boolean): Boolean {
|
||||
return runReadAction { (): Boolean ->
|
||||
@@ -54,7 +49,7 @@ public object ProjectRootsUtil {
|
||||
}
|
||||
|
||||
platformStatic
|
||||
public fun isInSourceWithGradleCheck(element: PsiElement): Boolean {
|
||||
return isInSource(element) && !JetModuleTypeManager.getInstance()!!.isKtFileInGradleProjectInWrongFolder(element)
|
||||
public fun isInSource(element: PsiElement): Boolean {
|
||||
return isInSource(element, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class HierarchyUtils {
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file == null) return null;
|
||||
|
||||
if (!ProjectRootsUtil.isInSourceWithGradleCheck(file)) return null;
|
||||
if (!ProjectRootsUtil.isInSource(file)) return null;
|
||||
|
||||
return TargetElementUtilBase.findTargetElement(editor, TargetElementUtilBase.getInstance().getAllAccepted());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class KotlinTypeHierarchyProvider extends JavaTypeHierarchyProvider {
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file == null) return null;
|
||||
|
||||
if (!ProjectRootsUtil.isInSourceWithGradleCheck(file)) return null;
|
||||
if (!ProjectRootsUtil.isInSource(file)) return null;
|
||||
|
||||
PsiElement target = TargetElementUtilBase.findTargetElement(editor, TargetElementUtilBase.getInstance().getAllAccepted());
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class KotlinCallHierarchyProvider implements HierarchyProvider {
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file == null) return null;
|
||||
|
||||
if (!ProjectRootsUtil.isInSourceWithGradleCheck(file)) return null;
|
||||
if (!ProjectRootsUtil.isInSource(file)) return null;
|
||||
|
||||
return TargetElementUtilBase.findTargetElement(editor, TargetElementUtilBase.getInstance().getAllAccepted());
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class DeclarationHintSupport extends AbstractProjectComponent {
|
||||
|
||||
Editor editor = e.getEditor();
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
|
||||
if (psiFile == null || psiFile.getLanguage() != JetLanguage.INSTANCE || !ProjectRootsUtil.isInSourceWithGradleCheck(psiFile)) {
|
||||
if (psiFile == null || psiFile.getLanguage() != JetLanguage.INSTANCE || !ProjectRootsUtil.isInSource(psiFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class JetLineMarkerProvider implements LineMarkerProvider {
|
||||
|
||||
PsiElement first = KotlinPackage.first(elements);
|
||||
if (DumbService.getInstance(first.getProject()).isDumb() ||
|
||||
!ProjectRootsUtil.isInSourceWithGradleCheck(elements.get(0))) {
|
||||
!ProjectRootsUtil.isInSource(elements.get(0))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class KotlinReferencesSearcher extends QueryExecutorBase<PsiReference, Re
|
||||
PsiElement element = queryParameters.getElementToSearch();
|
||||
|
||||
final PsiNamedElement unwrappedElement = AsJavaPackage.getNamedUnwrappedElement(element);
|
||||
if (unwrappedElement == null || !ProjectRootsUtil.isInSourceWithGradleCheck(unwrappedElement)) return;
|
||||
if (unwrappedElement == null || !ProjectRootsUtil.isInSource(unwrappedElement)) return;
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(
|
||||
new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user