The general lifecycle of PsiElement is up to next reparse invalidating it. If you are showing modal dialog, then you can rely on no typing in the editor (unless of course this is the editor embedded in your dialog) and store PsiElements. Alternatively you can work with SmartPsiElementPointer that represent the best effort to restore the element after it has been invalidated.
The general lifecycle of PsiElement is up to next reparse invalidating it. If you are showing modal dialog, then you can rely on no typing in the editor (unless of course this is the editor embedded in your dialog) and store PsiElements. Alternatively you can work with SmartPsiElementPointer that represent the best effort to restore the element after it has been invalidated.