Esempio n. 1
0
 public List<OrderEntry> getEntries() {
   final int count = myModel.getRowCount();
   final List<OrderEntry> entries = new ArrayList<OrderEntry>(count);
   for (int row = 0; row < count; row++) {
     final OrderEntry entry = myModel.getItemAt(row).getEntry();
     if (entry != null) {
       entries.add(entry);
     }
   }
   return entries;
 }
Esempio n. 2
0
 private void updateButtons() {
   final int[] selectedRows = myEntryTable.getSelectedRows();
   boolean removeButtonEnabled = true;
   int minRow = myEntryTable.getRowCount() + 1;
   int maxRow = -1;
   for (final int selectedRow : selectedRows) {
     minRow = Math.min(minRow, selectedRow);
     maxRow = Math.max(maxRow, selectedRow);
     final ClasspathTableItem<?> item = myModel.getItemAt(selectedRow);
     if (!item.isRemovable()) {
       removeButtonEnabled = false;
     }
   }
   if (myRemoveButton != null) {
     myRemoveButton.setEnabled(removeButtonEnabled && selectedRows.length > 0);
   }
   ClasspathTableItem<?> selectedItem =
       selectedRows.length == 1 ? myModel.getItemAt(selectedRows[0]) : null;
   myEditButton.setEnabled(selectedItem != null && selectedItem.isEditable());
 }
Esempio n. 3
0
 public void selectOrderEntry(@NotNull OrderEntry entry) {
   for (int row = 0; row < myModel.getRowCount(); row++) {
     final OrderEntry orderEntry = myModel.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);
 }
Esempio n. 4
0
 @Override
 @Nullable
 public OrderEntry getSelectedEntry() {
   if (myEntryTable.getSelectedRowCount() != 1) return null;
   return myModel.getItemAt(myEntryTable.getSelectedRow()).getEntry();
 }