code: public void updateShowViewCommands(){
      	ViewDescriptorRegistry viewDescriptorRegistry = ValkyrieRepository.getInstance().getApplicationConfig().viewDescriptorRegistry();
          ViewDescriptor[] views = viewDescriptorRegistry.getViewDescriptors();
  
          for (ViewDescriptor view : views) {
              String id = view.getId();
              CommandManager commandManager = window.getCommandManager();
              /*if(commandManager.containsActionCommand(id)){
  	    		ActionCommand command =
  	    			commandManager.getActionCommand(id);
  	    		command.setVisible(pageViews.contains(views[i].getId()));
      		}*/
              if (commandManager.isTypeMatch(id, ActionCommand.class)) {
                  ActionCommand command =
                          (ActionCommand) commandManager.getCommand(id, ActionCommand.class);
                  command.setVisible(pageViews.contains(view.getId()));
              }
          }
      }
docs: This sets the visible flag on all show view commands that
  are registered with the command manager. If the page contains
  the view the command is visible, otherwise not. The registration
  of the show view command with the command manager is the
  responsibility of the view descriptor.