ProjectStructureElement () { final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null && selectionPath.getLastPathComponent() instanceof MyNode node && node.getConfigurable() instanceof ProjectStructureElementConfigurable<?> configurable) { return configurable.getProjectStructureElement(); } return null; }