예제 #1
0
  private void changeCurrentlyDisplayedExecutionRecord(ExecutionHistoryRecord newExecutionRecord) {
    if (newExecutionRecord.out.rows.isEmpty()) {
      // We do not want to erase the old content, but we want to give feedback that the command was
      // executed.
      return;
    }
    boolean needRefresh = currentlySelectedExecutionRecord == null;
    currentlySelectedExecutionRecord = newExecutionRecord;

    if (!needRefresh) {
      int percentage = 100 / (terminalDataLayer.getColumnCount() + 1);
      terminalDataLayer.setColumnWidthPercentageByPosition(0, percentage * 2);
      for (int i = 1; i < terminalDataLayer.getColumnCount(); i++) {
        terminalDataLayer.setColumnWidthPercentageByPosition(i, percentage);
      }
    }
    terminalGrid
        .refresh(); // FIXME: This somewhat works to display the columns the first time a command is
                    // run. Especially if the output contains few rows and does not require a scroll
                    // bar

    int selectedTab = 0;
    tabularErrorTable.clearAll();
    int numberOfErrLines = 0;
    //    if(currentlySelectedExecutionRecord.err!=null){
    //      numberOfErrLines=currentlySelectedExecutionRecord.err.rows.size();
    //      if(numberOfErrLines>0){
    //        selectedTab=1;
    //      }
    //    }
    TabFolder tabPane = (TabFolder) terminalGrid.getParent();
    tabPane.getItem(1).setText("err " + numberOfErrLines + " lines");
    tabularErrorTable.setItemCount(numberOfErrLines);

    tabularLogTable.clearAll();
    int numberOfLogLines = 0;
    //    if(currentlySelectedExecutionRecord.log!=null){
    //      numberOfLogLines=currentlySelectedExecutionRecord.log.rows.size();
    //    }
    tabPane.getItem(2).setText("log-" + numberOfLogLines);
    tabularLogTable.setItemCount(numberOfLogLines);

    tabPane.setSelection(selectedTab);
    commandLineTxt.setFocus();
  }