public void forceInitFromModel() { final int[] selection = myEntryTable.getSelectedRows(); myModel.clear(); myModel.init(); myModel.fireTableDataChanged(); TableUtil.selectRows(myEntryTable, selection); }
@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())); }
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); }
public void forceInitFromModel() { Set<ClasspathTableItem<?>> oldSelection = new HashSet<ClasspathTableItem<?>>(); for (int i : myEntryTable.getSelectedRows()) { ContainerUtil.addIfNotNull(getItemAt(i), oldSelection); } myModel.clear(); myModel.init(); myModel.fireTableDataChanged(); TIntArrayList newSelection = new TIntArrayList(); for (int i = 0; i < myModel.getRowCount(); i++) { if (oldSelection.contains(getItemAt(i))) { newSelection.add(i); } } TableUtil.selectRows(myEntryTable, newSelection.toNativeArray()); }
@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())); }
private void removeSelectedItems(final List removedRows) { if (removedRows.isEmpty()) { return; } for (final Object removedRow : removedRows) { final ClasspathTableItem<?> item = (ClasspathTableItem<?>) ((Object[]) removedRow)[ClasspathTableModel.ITEM_COLUMN]; final OrderEntry orderEntry = item.getEntry(); if (orderEntry == null) { continue; } getRootModel().removeOrderEntry(orderEntry); } final int[] selectedRows = myEntryTable.getSelectedRows(); myModel.fireTableDataChanged(); TableUtil.selectRows(myEntryTable, selectedRows); final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext(); context .getDaemonAnalyzer() .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule())); }
public void stopEditing() { TableUtil.stopEditing(myEntryTable); }