KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > sourcelookup > RemoveAction


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.sourcelookup;
12
13 import java.util.List JavaDoc;
14
15 import org.eclipse.jface.viewers.IStructuredSelection;
16
17 /**
18  * The action used to remove source containers in the source location dialog/tab.
19  *
20  */

21 public class RemoveAction extends SourceContainerAction {
22     public RemoveAction() {
23         super(SourceLookupUIMessages.sourceTab_removeButton);
24     }
25     /**
26      * Removes all selected entries.
27      *
28      * @see IAction#run()
29      */

30     public void run() {
31         List JavaDoc targets = getOrderedSelection();
32         List JavaDoc list = getEntriesAsList();
33         list.removeAll(targets);
34         setEntries(list);
35     }
36     
37     /**
38      * @see SelectionListenerAction#updateSelection(IStructuredSelection)
39      */

40     protected boolean updateSelection(IStructuredSelection selection) {
41         //check that something is selected and it is a root tree node.
42
return !selection.isEmpty() && getViewer().getTree().getSelection()[0].getParentItem()==null;
43     }
44     
45 }
46
Popular Tags