/**
   * Is the undo menu option disabled?
   *
   * @return
   */
  public static boolean isUndoDisabled(SWTBot bot) {
    Matcher<MenuItem> undoMatcher =
        new BaseMatcher<MenuItem>() {

          @Override
          public boolean matches(Object item) {
            if (!(item instanceof MenuItem)) {
              return false;
            }
            return ((MenuItem) item).getText().startsWith("&Undo");
          }

          @Override
          public void describeTo(Description description) {
            description.appendText("disabled, and no text for an non-undoable item");
          }
        };
    try {
      SWTBotMenu undoMenu = bot.menu().menu("Edit").menu(undoMatcher, false, 0);
      boolean isEnabled = undoMenu.isEnabled();
      undoMenu.hide();
      return isEnabled;
    } catch (WidgetNotFoundException ex) {
      return false;
    }
  }
 /**
  * Choose Server Popup Menu with specified label on Server with position specified by index
  *
  * @param bot
  * @param index
  * @param menuLabel
  * @param timeOut
  * @param uiTimeOut
  */
 public static void chooseServerPopupMenu(
     SWTWorkbenchBot bot, int index, String menuLabel, long timeOut, long uiTimeOut) {
   SWTEclipseExt swtEclipseExt = new SWTEclipseExt();
   SWTBot servers = swtEclipseExt.showView(ViewType.SERVERS);
   SWTBotTree serverTree = servers.tree();
   ContextMenuHelper.prepareTreeItemForContextMenu(serverTree, index);
   SWTTestExt.util.waitForAll(uiTimeOut);
   SWTBotMenu menu =
       new SWTBotMenu(ContextMenuHelper.getContextMenu(serverTree, menuLabel, false));
   SWTTestExt.util.waitForAll(uiTimeOut);
   menu.click();
   SWTTestExt.util.waitForAll(timeOut);
 }
  /** Test show type action on VSM and hide type action. */
  public void testShowHideTypeAction() {
    SWTBotView projectExplorer = bot.viewByTitle("Model Explorer");
    projectExplorer.setFocus();
    projectExplorer.bot().tree().expandNode(getProjectName()).expandNode(VSM_FILE).doubleClick();
    SWTBotEditor activeEditor = bot.activeEditor();
    activeEditor.setFocus();

    String nodeLabel = "platform:/resource/" + getProjectName() + "/" + VSM_FILE;
    SWTBotMenu contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(GROUP)
            .expandNode(VIEWPOINT_NAME)
            .expandNode(REPRESENTATION_NAME)
            .contextMenu(SHOW_TYPE);
    contextualMenu.click();
    contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(TYPED_GROUP)
            .expandNode(TYPED_VIEWPOINT_NAME)
            .expandNode(TYPED_REPRESENTATION_NAME)
            .contextMenu(HIDE_TYPE);
    contextualMenu.click();
    contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(GROUP)
            .expandNode(VIEWPOINT_NAME)
            .expandNode(REPRESENTATION_NAME)
            .contextMenu(SHOW_TYPE);
  }