Esempio n. 1
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. 2
0
 @Override
 public void navigate(boolean openLibraryEditor) {
   final OrderEntry entry = getSelectedEntry();
   final ProjectStructureConfigurable rootConfigurable =
       ProjectStructureConfigurable.getInstance(myState.getProject());
   if (entry instanceof ModuleOrderEntry) {
     Module module = ((ModuleOrderEntry) entry).getModule();
     if (module != null) {
       rootConfigurable.select(module.getName(), null, true);
     }
   } else if (entry instanceof LibraryOrderEntry) {
     if (!openLibraryEditor) {
       rootConfigurable.select((LibraryOrderEntry) entry, true);
     } else {
       myEditButton.actionPerformed(null);
     }
   } else if (entry instanceof SdkOrderEntry) {
     Sdk jdk = ((SdkOrderEntry) entry).getSdk();
     if (jdk != null) {
       rootConfigurable.select(jdk, true);
     }
   }
 }