code: function contextMenuOpenHandler() {
          var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);
  
          if (file) {
              var targetIndex  = MainViewManager.findInWorkingSet(MainViewManager.ACTIVE_PANE, file.fullPath),
                  workingSetListSize = MainViewManager.getWorkingSetSize(MainViewManager.ACTIVE_PANE);
  
              if (targetIndex === workingSetListSize - 1) { // hide "Close Others Below" if the last file in Working Files is selected
                  CommandManager.get(closeBelow).setEnabled(false);
              } else {
                  CommandManager.get(closeBelow).setEnabled(true);
              }
  
              if (workingSetListSize === 1) { // hide "Close Others" if there is only one file in Working Files
                  CommandManager.get(closeOthers).setEnabled(false);
              } else {
                  CommandManager.get(closeOthers).setEnabled(true);
              }
  
              if (targetIndex === 0) { // hide "Close Others Above" if the first file in Working Files is selected
                  CommandManager.get(closeAbove).setEnabled(false);
              } else {
                  CommandManager.get(closeAbove).setEnabled(true);
              }
          }
      }
docs: Enable/Disable the menu items depending on which document is selected in the working set