mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
recalculate invalid psi elements if possible
This commit is contained in:
@@ -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