void (ActionCallback callback, K key, UI ui) { if (myKey != key) { callback.setRejected(); } else { V value = myContent.get(key); if (value == null && !myContent.containsKey(key)) { value = createValue(key, ui); } boolean wasFocused = UIUtil.isFocusAncestor(this); for (Component component : getComponents()) { component.setVisible(component == value); } if (value instanceof JScrollPane pane) { JViewport viewport = pane.getViewport(); if (viewport != null) { Component view = viewport.getView(); if (view != null) { view.revalidate(); view.repaint(); } } } if (wasFocused && value instanceof JComponent) { JComponent focusable = IdeFocusManager.getGlobalInstance().getFocusTargetFor((JComponent)value); if (focusable != null) focusable.requestFocusInWindow(); } callback.setDone(); } }