mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
recalculate invalid psi elements if possible
This commit is contained in:
@@ -101,7 +101,8 @@ public final class DebuggerContextImpl implements DebuggerContext {
|
||||
|
||||
public PsiElement getContextElement() {
|
||||
LOG.assertTrue(myInitialized);
|
||||
if(myContextElement != null && !myContextElement.isValid()) {
|
||||
PsiElement contextElement = myContextElement;
|
||||
if(contextElement != null && !contextElement.isValid()) {
|
||||
myContextElement = ContextUtil.getContextElement(mySourcePosition);
|
||||
}
|
||||
return myContextElement;
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class SourcePosition implements Navigatable{
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
if(myModificationStamp != myFile.getModificationStamp()) {
|
||||
if(dataUpdateNeeded()) {
|
||||
myModificationStamp = myFile.getModificationStamp();
|
||||
myLine = null;
|
||||
myOffset = null;
|
||||
@@ -115,6 +115,17 @@ public abstract class SourcePosition implements Navigatable{
|
||||
}
|
||||
}
|
||||
|
||||
private boolean dataUpdateNeeded() {
|
||||
if (myModificationStamp != myFile.getModificationStamp()) {
|
||||
return true;
|
||||
}
|
||||
final PsiElement psiElement = myPsiElement;
|
||||
if (psiElement != null && !psiElement.isValid()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
updateData();
|
||||
if (myLine == null) {
|
||||
|
||||
Reference in New Issue
Block a user