1 package com.quantum.actions;
3 import java.util.Iterator;
5 import com.quantum.Messages;
6 import com.quantum.view.bookmark.ColumnNode;
7 import com.quantum.view.subset.SubsetView;
9 import org.eclipse.jface.action.Action;
10 import org.eclipse.jface.action.IAction;
11 import org.eclipse.jface.dialogs.MessageDialog;
12 import org.eclipse.jface.viewers.ISelection;
13 import org.eclipse.jface.viewers.StructuredSelection;
14 import org.eclipse.ui.IViewActionDelegate;
15 import org.eclipse.ui.IViewPart;
18 * Deletes the selected columns from the Subset items (Tables)
22 public class DeleteColumnAction extends Action implements IViewActionDelegate {
25 * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
27 public void init(IViewPart view) {
28 this.view = (SubsetView) view;
32 * @see org.eclipse.ui.IActionDelegate#run(IAction)
34 public void run(IAction action) {
39 StructuredSelection selection = view.getSelection();
40 Iterator iter = selection.iterator();
41 if (! MessageDialog.openConfirm(view.getSite().getShell(),
42 Messages.getString("DeleteColumnAction.DeleteColumns"), //$NON-NLS-1$
43 Messages.getString("DeleteColumnAction.ConfirmDeleteColumns") )) //$NON-NLS-1$
46 while (iter.hasNext()) {
47 Object current = iter.next();
48 if (current instanceof ColumnNode) {
49 ColumnNode column = (ColumnNode) current;
51 view.deleteColumn(column);
58 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
60 public void selectionChanged(IAction action, ISelection selection) {