1 package com.quantum.actions;
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.Iterator;
8 import com.quantum.Messages;
9 import com.quantum.view.bookmark.EntityNode;
11 import org.eclipse.jface.viewers.IStructuredSelection;
12 import org.eclipse.ui.IViewPart;
13 import org.eclipse.ui.actions.SelectionListenerAction;
16 * <p>This action takes an EntityNode and adds a copy of it to the quicklist
21 public class RemoveFromQuickListAction extends SelectionListenerAction {
22 private List entities = Collections.synchronizedList(new ArrayList());
24 public RemoveFromQuickListAction(IViewPart view) {
25 super(Messages.getString(RemoveFromQuickListAction.class.getName() + ".text"));
29 for (Iterator i = this.entities.iterator(); i.hasNext(); ) {
30 EntityNode entityNode = (EntityNode) i.next();
31 entityNode.getBookmark().removeQuickListEntry(entityNode.getEntity());
36 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
38 public boolean updateSelection(IStructuredSelection selection) {
39 boolean enabled = super.updateSelection(selection);
40 this.entities.clear();
41 for (Iterator i = selection.iterator(); enabled && i.hasNext(); ) {
42 Object object = i.next();
43 if (object != null && object instanceof EntityNode) {
44 EntityNode node = (EntityNode) object;
45 enabled &= node.getBookmark().isInQuickList(node.getEntity());
46 this.entities.add(node);