1) Added missing strings for italic, underline and strike through.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / DeleteAllRowsAction.java
1 package net.sourceforge.phpdt.sql.actions;
2
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;
9
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;
14
15 /**
16  * @author root
17  *
18  */
19 public class DeleteAllRowsAction extends Action implements IViewActionDelegate  {
20     BookmarkView view;
21     
22         /**
23          * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
24          */
25         public void init(IViewPart view) {
26                 this.view = (BookmarkView) view;
27         }
28
29         /**
30          * @see org.eclipse.ui.IActionDelegate#run(IAction)
31          */
32         public void run(IAction action) {
33                 run();
34         }
35         
36         public void run() {
37                 Object selection = view.getCurrent();
38                 if (selection instanceof TableNode) {
39                         TableNode node = (TableNode) selection;
40                         if (node != null) {
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"));
47                                 if (flag) {
48                                         table.deleteAllRows();
49                                 }
50                         }
51                 }
52         }
53
54         /**
55          * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
56          */
57         public void selectionChanged(IAction action, ISelection selection) {
58         }
59
60 }