コード例 #1
0
 public void forceInitFromModel() {
   final int[] selection = myEntryTable.getSelectedRows();
   myModel.clear();
   myModel.init();
   myModel.fireTableDataChanged();
   TableUtil.selectRows(myEntryTable, selection);
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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);
       }
     }
   }
 }
コード例 #4
0
  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;
  }
コード例 #5
0
 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());
 }
コード例 #6
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());
 }
コード例 #7
0
  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()]);
 }
コード例 #9
0
 public void saveSelection() {
   mySavedSelection = myTable.getSelectedRows();
 }
コード例 #10
0
 public void finish() {
   mySelectedRows = myDeviceTable.getSelectedRows();
 }