1 package net.sourceforge.phpdt.sql.actions;
3 import java.util.Iterator;
5 import org.eclipse.jface.action.Action;
6 import org.eclipse.jface.action.IAction;
7 import org.eclipse.jface.dialogs.MessageDialog;
8 import org.eclipse.jface.viewers.ISelection;
9 import org.eclipse.jface.viewers.StructuredSelection;
10 import org.eclipse.ui.IViewActionDelegate;
11 import org.eclipse.ui.IViewPart;
13 import net.sourceforge.phpdt.sql.Messages;
14 import net.sourceforge.phpdt.sql.view.SubsetView;
15 import net.sourceforge.phpdt.sql.view.bookmark.ColumnMetaData;
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 ColumnMetaData) {
49 ColumnMetaData column = (ColumnMetaData) current;
51 view.deleteColumn(column);
58 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
60 public void selectionChanged(IAction action, ISelection selection) {