1 package net.sourceforge.phpdt.sql.actions;
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.action.IAction;
5 import org.eclipse.jface.dialogs.MessageDialog;
6 import org.eclipse.jface.viewers.ISelection;
7 import org.eclipse.ui.IViewActionDelegate;
8 import org.eclipse.ui.IViewPart;
10 import net.sourceforge.phpdt.sql.Messages;
11 import net.sourceforge.phpdt.sql.model.Table;
12 import net.sourceforge.phpdt.sql.view.BookmarkView;
13 import net.sourceforge.phpdt.sql.view.bookmark.TableNode;
19 public class DeleteAllRowsAction extends Action implements IViewActionDelegate {
23 * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
25 public void init(IViewPart view) {
26 this.view = (BookmarkView) view;
30 * @see org.eclipse.ui.IActionDelegate#run(IAction)
32 public void run(IAction action) {
37 Object selection = view.getCurrent();
38 if (selection instanceof TableNode) {
39 TableNode node = (TableNode) selection;
41 Table table = (Table) node.getTable();
42 System.out.println("==>" + table.getQualifiedName());
43 boolean flag = MessageDialog.openConfirm(
44 view.getSite().getShell(),
45 Messages.getString("bookmarkview.deleteAllRows") + table.getQualifiedName(),
46 Messages.getString("bookmarkview.confirmDeleteAllRows"));
48 table.deleteAllRows();
55 * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
57 public void selectionChanged(IAction action, ISelection selection) {