void () { CheckedTreeNode node = getSelectedToolNode(); if (node != null) { int result = Messages.showYesNoDialog( this, ToolsBundle.message("tools.delete.confirmation"), ToolsBundle.message("dialog.title.delete.tool"), Messages.getWarningIcon() ); if (result != Messages.YES) { return; } myIsModified = true; if (node.getUserObject() instanceof Tool tool) { CheckedTreeNode parentNode = (CheckedTreeNode)node.getParent(); ((ToolsGroup)parentNode.getUserObject()).removeElement(tool); removeNodeFromParent(node); if (parentNode.getChildCount() == 0) { removeNodeFromParent(parentNode); } } else if (node.getUserObject() instanceof ToolsGroup) { removeNodeFromParent(node); } update(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTree, true)); } }