FileElement (@NotNull TreeElement element) { TreeElement parent = element; while (parent != null && !(parent instanceof FileElement)) { parent = parent.getTreeParent(); } if (parent == null) { parent = element.getUserData(CONTAINING_FILE_KEY_AFTER_REPARSE); } return (FileElement)parent; }