private void findAndSelectInTable(final SMTestProxy proxy) {
   SMRunnerUtil.addToInvokeLater(
       new Runnable() {
         public void run() {
           final int rowIndex = myTableModel.getIndexOf(proxy);
           if (rowIndex >= 0) {
             myStatisticsTableView.setRowSelectionInterval(rowIndex, rowIndex);
           }
         }
       });
 }
 /** Selects row in table */
 protected void selectRowOf(final SMTestProxy proxy) {
   SMRunnerUtil.addToInvokeLater(
       new Runnable() {
         public void run() {
           final int rowIndex = myTableModel.getIndexOf(proxy);
           myStatisticsTableView.setRowSelectionInterval(rowIndex, rowIndex >= 0 ? rowIndex : 0);
           // Scroll to visible
           TableUtil.scrollSelectionToVisible(myStatisticsTableView);
         }
       });
 }
  /**
   * Selects row in table
   *
   * @param rowIndex Row's index
   */
  protected void selectRow(final int rowIndex) {
    SMRunnerUtil.addToInvokeLater(
        new Runnable() {
          public void run() {
            // updates model
            myStatisticsTableView.setRowSelectionInterval(rowIndex, rowIndex);

            // Scroll to visible
            TableUtil.scrollSelectionToVisible(myStatisticsTableView);
          }
        });
  }
  public StatisticsPanel(final Project project, final TestFrameworkRunningModel model) {
    myProject = project;
    myTableModel = new StatisticsTableModel();
    myStatisticsTableView.setModelAndUpdateColumns(myTableModel);
    myFrameworkRunningModel = model;

    final Runnable gotoSuiteOrParentAction = createGotoSuiteOrParentAction();
    new DoubleClickListener() {
      @Override
      protected boolean onDoubleClick(MouseEvent e) {
        gotoSuiteOrParentAction.run();
        return true;
      }
    }.installOn(myStatisticsTableView);

    // Fire selection changed and move focus on SHIFT+ENTER
    final KeyStroke shiftEnterKey =
        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK);
    SMRunnerUtil.registerAsAction(
        shiftEnterKey,
        "select-test-proxy-in-test-view",
        new Runnable() {
          public void run() {
            showSelectedProxyInTestsTree();
          }
        },
        myStatisticsTableView);

    // Expand selected or go to parent on ENTER
    final KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    SMRunnerUtil.registerAsAction(
        enterKey, "go-to-selected-suite-or-parent", gotoSuiteOrParentAction, myStatisticsTableView);
    // Contex menu in Table
    PopupHandler.installPopupHandler(
        myStatisticsTableView, IdeActions.GROUP_TESTTREE_POPUP, ActionPlaces.TESTTREE_VIEW_POPUP);
    // set this statistic tab as dataprovider for test's table view
    DataManager.registerDataProvider(myStatisticsTableView, this);
  }
 public void onSelected(
     @Nullable final SMTestProxy selectedTestProxy,
     @NotNull final TestResultsViewer viewer,
     @NotNull final TestFrameworkRunningModel model) {
   // TODO: tests o "onSelected"
   SMRunnerUtil.runInEventDispatchThread(
       new Runnable() {
         public void run() {
           if (ScrollToTestSourceAction.isScrollEnabled(model)) {
             OpenSourceUtil.openSourcesFrom(model.getTreeView(), false);
           }
         }
       },
       ModalityState.NON_MODAL);
 }
Esempio n. 6
0
  private void selectWithoutNotify(
      final AbstractTestProxy testProxy, @Nullable final Runnable onDone) {
    if (testProxy == null) {
      return;
    }

    SMRunnerUtil.runInEventDispatchThread(
        new Runnable() {
          public void run() {
            if (myTreeBuilder.isDisposed()) {
              return;
            }
            myTreeBuilder.select(testProxy, onDone);
          }
        },
        ModalityState.NON_MODAL);
  }
  public void selectProxy(
      @Nullable final SMTestProxy selectedTestProxy,
      @NotNull final Object sender,
      final boolean requestFocus) {
    SMRunnerUtil.addToInvokeLater(
        new Runnable() {
          public void run() {
            // Select tab if focus was requested
            if (requestFocus) {
              IdeFocusManager.getInstance(myProject).requestFocus(myStatisticsTableView, true);
            }

            // Select proxy in table
            selectProxy(selectedTestProxy);
          }
        });
  }
Esempio n. 8
0
  @Override
  public void initUI() {
    super.initUI();

    if (Registry.is("tests.view.old.statistics.panel")) {
      final KeyStroke shiftEnterKey =
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK);
      SMRunnerUtil.registerAsAction(
          shiftEnterKey,
          "show-statistics-for-test-proxy",
          new Runnable() {
            public void run() {
              showStatisticsForSelectedProxy();
            }
          },
          myTreeView);
    }
  }