@Override
 protected void customizeCellRenderer(
     JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
   setPaintFocusBorder(false);
   setFocusBorderAroundIcon(true);
   setBorder(NO_FOCUS_BORDER);
   if (value instanceof ClasspathTableItem<?>) {
     final ClasspathTableItem<?> tableItem = (ClasspathTableItem<?>) value;
     getCellAppearance(tableItem, myContext, selected).customize(this);
     setToolTipText(tableItem.getTooltipText());
   }
 }
예제 #2
0
 private static CellAppearanceEx getCellAppearance(
     final ClasspathTableItem<?> item,
     final StructureConfigurableContext context,
     final boolean selected) {
   final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance();
   final OrderEntry entry = item.getEntry();
   assert entry != null : item;
   return service.forOrderEntry(context.getProject(), entry, selected);
 }
예제 #3
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());
 }
 static CellAppearanceEx getCellAppearance(
     final ClasspathTableItem<?> item,
     final StructureConfigurableContext context,
     final boolean selected) {
   final OrderEntryAppearanceService service = OrderEntryAppearanceService.getInstance();
   if (item instanceof InvalidJdkItem) {
     return service.forJdk(null, false, selected, true);
   } else {
     final OrderEntry entry = item.getEntry();
     assert entry != null : item;
     return service.forOrderEntry(context.getProject(), entry, selected);
   }
 }
  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()));
  }
 @Override
 @Nullable
 public OrderEntry getSelectedEntry() {
   ClasspathTableItem<?> item = getSelectedItem();
   return item != null ? item.getEntry() : null;
 }