@Override
  public void update(@NotNull AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = event.getData(CommonDataKeys.PROJECT);
    if (project == null) {
      presentation.setEnabled(false);
      return;
    }

    FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
    VirtualFile selectedFile;
    final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
    if (window != null) {
      presentation.setEnabled(window.getFileList().size() > 1);
      return;
    }
    else {
      if (fileEditorManager.getSelectedFiles().length == 0) {
        presentation.setEnabled(false);
        return;
      }
      selectedFile = fileEditorManager.getSelectedFiles()[0];
    }
    presentation.setEnabled(!ApplicationManager.getApplication().isUnitTestMode()
                            && fileEditorManager.getSiblings(selectedFile).size() > 1);
  }
@Override
  public void update(@NotNull AnActionEvent event)