public void forceInitFromModel() {
   final int[] selection = myEntryTable.getSelectedRows();
   myModel.clear();
   myModel.init();
   myModel.fireTableDataChanged();
   TableUtil.selectRows(myEntryTable, selection);
 }
 public List<Module> getSelectedElements() {
   final List<Module> elements = new ArrayList<Module>();
   final int[] selectedRows = myTable.getSelectedRows();
   for (int selectedRow : selectedRows) {
     if (selectedRow < 0) {
       continue;
     }
     elements.add(myTableModel.getModuleAt(selectedRow));
   }
   return elements;
 }
 private void changeOperationForSelection() {
   for (int row : myTable.getSelectedRows()) {
     if (row != -1) {
       final DirDiffElementImpl element = myModel.getElementAt(row);
       if (element != null) {
         element.setNextOperation();
         myModel.fireTableRowsUpdated(row, row);
       }
     }
   }
 }
  private int getPrevRow() {
    if (myTable.getSelectedRows().length == 0) return -1;
    int row = myTable.getSelectionModel().getLeadSelectionIndex();

    while (true) {
      if (row <= 0) return -1;
      row--;
      DirDiffElementImpl element = myModel.getElementAt(row);
      if (element == null) return -1;
      if (!element.isSeparator()) break;
    }

    return row;
  }
 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());
 }
 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());
 }
  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()));
  }
示例#8
0
 @NotNull
 public IDevice[] getSelectedDevices() {
   int[] rows = mySelectedRows != null ? mySelectedRows : myDeviceTable.getSelectedRows();
   List<IDevice> result = new ArrayList<IDevice>();
   for (int row : rows) {
     if (row >= 0) {
       Object serial = myDeviceTable.getValueAt(row, SERIAL_COLUMN_INDEX);
       final AndroidDebugBridge bridge =
           AndroidSdkUtils.getDebugBridge(myFacet.getModule().getProject());
       if (bridge == null) {
         return EMPTY_DEVICE_ARRAY;
       }
       IDevice[] devices = getFilteredDevices(bridge);
       for (IDevice device : devices) {
         if (device.getSerialNumber().equals(serial.toString())) {
           result.add(device);
           break;
         }
       }
     }
   }
   return result.toArray(new IDevice[result.size()]);
 }
 public void saveSelection() {
   mySavedSelection = myTable.getSelectedRows();
 }
示例#10
0
 public void finish() {
   mySelectedRows = myDeviceTable.getSelectedRows();
 }