void (@NotNull Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) { element = TreeAnchorizer.getService().createAnchor(element); warnMap("myElementToNodeMap: removeMapping: ", myElementToNodeMap); Object value = myElementToNodeMap.get(element); if (value != null) { if (value instanceof DefaultMutableTreeNode) { if (value.equals(node)) { myElementToNodeMap.remove(element); } } else { //noinspection unchecked List<DefaultMutableTreeNode> nodes = (List<DefaultMutableTreeNode>)value; boolean reallyRemoved = nodes.remove(node); if (reallyRemoved) { if (nodes.isEmpty()) { myElementToNodeMap.remove(element); } } } } remapNodeActions(element, elementToPutNodeActionsFor); TreeAnchorizer.getService().freeAnchor(element); }