@Override
 protected void selectElement(Object element, String selectedText) {
   List<UsageNode> data = ((MyModel) getTable().getModel()).getItems();
   int i = data.indexOf(element);
   if (i == -1) return;
   final int viewRow = getTable().convertRowIndexToView(i);
   getTable().getSelectionModel().setSelectionInterval(viewRow, viewRow);
   TableUtil.scrollSelectionToVisible(getTable());
 }
 private void addInjection(final BaseInjection injection) {
   final InjInfo info = getDefaultCfgInfo().addInjection(injection);
   myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos));
   final int index =
       myInjectionsTable.convertRowIndexToView(
           myInjectionsTable.getListTableModel().getItems().indexOf(info));
   myInjectionsTable.getSelectionModel().setSelectionInterval(index, index);
   TableUtil.scrollSelectionToVisible(myInjectionsTable);
 }
 public void selectElements(Collection<? extends T> elements) {
   if (elements.size() == 0) {
     myTable.clearSelection();
     return;
   }
   final int[] rows = getElementsRows(elements);
   TableUtil.selectRows(myTable, rows);
   TableUtil.scrollSelectionToVisible(myTable);
   myTable.requestFocus();
 }
 public void selectOrderEntry(@NotNull OrderEntry entry) {
   for (int row = 0; row < myModel.getRowCount(); row++) {
     final OrderEntry orderEntry = getItemAt(row).getEntry();
     if (orderEntry != null
         && entry.getPresentableName().equals(orderEntry.getPresentableName())) {
       myEntryTable.getSelectionModel().setSelectionInterval(row, row);
       TableUtil.scrollSelectionToVisible(myEntryTable);
     }
   }
   IdeFocusManager.getInstance(myState.getProject()).requestFocus(myEntryTable, true);
 }
 private void performRemove() {
   final int selectedRow = myInjectionsTable.getSelectedRow();
   if (selectedRow < 0) return;
   final List<InjInfo> selected = getSelectedInjections();
   for (InjInfo info : selected) {
     if (info.bundled) continue;
     info.cfgInfo.injectionInfos.remove(info);
   }
   myInjectionsTable.getListTableModel().setItems(getInjInfoList(myInfos));
   final int index =
       Math.min(myInjectionsTable.getListTableModel().getRowCount() - 1, selectedRow);
   myInjectionsTable.getSelectionModel().setSelectionInterval(index, index);
   TableUtil.scrollSelectionToVisible(myInjectionsTable);
   updateCountLabel();
 }
Esempio n. 6
0
  @Override
  public void addItems(List<ClasspathTableItem<?>> toAdd) {
    for (ClasspathTableItem<?> item : toAdd) {
      myModel.addItem(item);
    }
    myModel.fireTableDataChanged();
    final ListSelectionModel selectionModel = myEntryTable.getSelectionModel();
    selectionModel.setSelectionInterval(
        myModel.getRowCount() - toAdd.size(), myModel.getRowCount() - 1);
    TableUtil.scrollSelectionToVisible(myEntryTable);

    final StructureConfigurableContext context =
        ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
    context
        .getDaemonAnalyzer()
        .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
  }
  @Override
  public void addItems(List<ClasspathTableItem<?>> toAdd) {
    for (ClasspathTableItem<?> item : toAdd) {
      myModel.addRow(item);
    }
    TIntArrayList toSelect = new TIntArrayList();
    for (int i = myModel.getRowCount() - toAdd.size(); i < myModel.getRowCount(); i++) {
      toSelect.add(myEntryTable.convertRowIndexToView(i));
    }
    TableUtil.selectRows(myEntryTable, toSelect.toNativeArray());
    TableUtil.scrollSelectionToVisible(myEntryTable);

    final StructureConfigurableContext context =
        ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
    context
        .getDaemonAnalyzer()
        .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
  }