mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -53,8 +53,6 @@ public class JavaAnchorProvider extends SmartPointerAnchorProvider {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
if (!anchor.equals(AnchorElementInfoFactory.getAnchor(parent))) return null;
|
||||
|
||||
return parent;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -84,6 +84,11 @@ class AnchorElementInfo extends SelfElementInfo {
|
||||
TextRange range = anchor.getTextRange();
|
||||
if (range.getStartOffset() != psiRange.getStartOffset() || range.getEndOffset() != psiRange.getEndOffset()) return null;
|
||||
|
||||
return restoreFromAnchor(anchor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static PsiElement restoreFromAnchor(PsiElement anchor) {
|
||||
for (SmartPointerAnchorProvider provider : SmartPointerAnchorProvider.EP_NAME.getExtensions()) {
|
||||
final PsiElement element = provider.restoreElement(anchor);
|
||||
if (element != null) return element;
|
||||
|
||||
+7
-4
@@ -59,11 +59,14 @@ public class AnchorElementInfoFactory implements SmartPointerElementInfoFactory
|
||||
@Nullable
|
||||
static PsiElement getAnchor(@NotNull PsiElement element) {
|
||||
PsiUtilCore.ensureValid(element);
|
||||
PsiElement anchor = null;
|
||||
if (!element.isPhysical()) return null;
|
||||
|
||||
for (SmartPointerAnchorProvider provider : SmartPointerAnchorProvider.EP_NAME.getExtensions()) {
|
||||
anchor = provider.getAnchor(element);
|
||||
if (anchor != null && anchor.isPhysical()) return anchor;
|
||||
PsiElement anchor = provider.getAnchor(element);
|
||||
if (anchor != null && anchor.isPhysical() && AnchorElementInfo.restoreFromAnchor(anchor) == element) {
|
||||
return anchor;
|
||||
}
|
||||
}
|
||||
return anchor;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user