private void handleRemove() { LinkedList<NameVersionDescriptor> bundles = new LinkedList<NameVersionDescriptor>(); bundles.addAll(Arrays.asList(getTargetDefinition().getImplicitDependencies())); Object[] removeBundles = ((IStructuredSelection) fElementViewer.getSelection()).toArray(); if (removeBundles.length > 0) { for (int i = 0; i < removeBundles.length; i++) { if (removeBundles[i] instanceof NameVersionDescriptor) { bundles.remove(removeBundles[i]); } } getTargetDefinition() .setImplicitDependencies(bundles.toArray((new NameVersionDescriptor[bundles.size()]))); fElementViewer.refresh(); updateImpButtons(); } }
private void updateImpButtons() { boolean empty = fElementViewer.getSelection().isEmpty(); fRemoveButton.setEnabled(!empty); boolean hasElements = fElementViewer.getTable().getItemCount() > 0; fRemoveAllButton.setEnabled(hasElements); }