mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
less hacky API for checking accessibility of Java references in XML files
This commit is contained in:
@@ -73,7 +73,7 @@ public class JavaResolveUtil {
|
||||
if (visibility == JavaCodeFragment.VisibilityChecker.Visibility.NOT_VISIBLE) return false;
|
||||
}
|
||||
}
|
||||
else if (isAllSeeingPlace(placeFile)) return true;
|
||||
else if (ignoreReferencedElementAccessibility(placeFile)) return true;
|
||||
// We don't care about access rights in javadoc
|
||||
if (isInJavaDoc(place)) return true;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class JavaResolveUtil {
|
||||
int effectiveAccessLevel = PsiUtil.getAccessLevel(modifierList);
|
||||
PsiFile file = placeFile == null ? null : FileContextUtil.getContextFile(placeFile); //TODO: implementation method!!!!
|
||||
if (PsiImplUtil.isInServerPage(file) && PsiImplUtil.isInServerPage(member.getContainingFile())) return true;
|
||||
if (isAllSeeingPlace(file)) return true;
|
||||
if (ignoreReferencedElementAccessibility(file)) return true;
|
||||
if (effectiveAccessLevel == PsiUtil.ACCESS_LEVEL_PUBLIC) {
|
||||
return true;
|
||||
}
|
||||
@@ -142,9 +142,10 @@ public class JavaResolveUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isAllSeeingPlace(PsiFile placeFile) {
|
||||
// TODO HACK introduce a special API here, don't use FileResolveScopeProvider (which just happens to be implemented by correct files)
|
||||
return placeFile instanceof FileResolveScopeProvider && !PsiImplUtil.isInServerPage(placeFile);
|
||||
private static boolean ignoreReferencedElementAccessibility(PsiFile placeFile) {
|
||||
return placeFile instanceof FileResolveScopeProvider &&
|
||||
((FileResolveScopeProvider) placeFile).ignoreReferencedElementAccessibility() &&
|
||||
!PsiImplUtil.isInServerPage(placeFile);
|
||||
}
|
||||
|
||||
public static boolean isInJavaDoc(final PsiElement place) {
|
||||
|
||||
@@ -25,4 +25,5 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
*/
|
||||
public interface FileResolveScopeProvider {
|
||||
GlobalSearchScope getFileResolveScope();
|
||||
boolean ignoreReferencedElementAccessibility();
|
||||
}
|
||||
|
||||
@@ -111,4 +111,9 @@ public class XmlFileImpl extends PsiFileImpl implements XmlFile {
|
||||
public GlobalSearchScope getFileResolveScope() {
|
||||
return ProjectScope.getAllScope(getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreReferencedElementAccessibility() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +116,11 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile {
|
||||
return ProjectScope.getAllScope(getProject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreReferencedElementAccessibility() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + ":" + getName();
|
||||
|
||||
Reference in New Issue
Block a user