&& display3DViewInMainWindowAction.getValue(Action.NAME) != null) {
final JMenuItem attachDetach3DViewMenuItem = new JMenuItem(
createAttachDetach3DViewAction(controller, popup));
// Add a listener to 3D view to switch action when its parent changes
JComponent view3D = (JComponent)controller.getHomeController3D().getView();
view3D.addAncestorListener(new AncestorListener() {
public void ancestorAdded(AncestorEvent ev) {
attachDetach3DViewMenuItem.setAction(
createAttachDetach3DViewAction(controller, popup));
}