Esempio n. 1
0
  /**
   * ************************************************************************* Center the table view
   * on the given line. ************************************************************************
   */
  public void showLine(int lineNo, boolean select) {
    if (getGrid().isDisposed()) return;
    int numLines = getGrid().getItemCount();
    if (lineNo > 0 && numLines > lineNo) {
      GridVisibleRange range = getGrid().getVisibleRange();

      int visibleCount = range.getItems().length;

      GridItem first = range.getItems()[0];
      GridItem last = range.getItems()[visibleCount - 1];
      int firstIndex = getGrid().getIndexOfItem(first);
      int lastIndex = getGrid().getIndexOfItem(last);

      int itemToShow = lineNo;
      if (lineNo < firstIndex) {
        itemToShow = lineNo - visibleCount / 2;
      } else if (lineNo > lastIndex) {
        itemToShow = lineNo + visibleCount / 2;
      }

      if (itemToShow < 0) itemToShow = 0;
      else if (itemToShow > numLines) itemToShow = numLines - 1;

      getGrid().showItem(getGrid().getItem(itemToShow));
      if (select) {
        getGrid().deselectAll();
        getGrid().select(lineNo - 1);
      }
    }
  }
Esempio n. 2
0
  public void forceRefresh() {
    GridVisibleRange range = getGrid().getVisibleRange();

    int visibleCount = range.getItems().length;

    GridItem first = range.getItems()[0];
    GridItem last = range.getItems()[visibleCount - 1];
    int firstIndex = getGrid().getIndexOfItem(first);
    int lastIndex = getGrid().getIndexOfItem(last);

    for (int index = firstIndex; index < lastIndex; index++) {
      ICodeLine line = m_input.getExecutionManager().getLine(index);
      if (line.hasNotifications()) {
        line.calculateSummary();
      }
      update(line, null);
    }
    showLastLine();
  }