void (final Object element) { if (element instanceof SmartPsiElementPointer) { ApplicationManager.getApplication().runReadAction(() -> { SmartPsiElementPointer<?> pointer = (SmartPsiElementPointer<?>)element; Project project = pointer.getProject(); if (!project.isDisposed()) { SmartPointerManager.getInstance(project).removePointer(pointer); } }); } }