Changed gather.bin target to include all resources
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / DeleteBookmarkAction.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.view.BookmarkView;
11 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
12
13 /**
14  * @author root
15  *
16  * To change this generated comment edit the template variable "typecomment":
17  * Window>Preferences>Java>Templates.
18  * To enable and disable the creation of type comments go to
19  * Window>Preferences>Java>Code Generation.
20  */
21 public class DeleteBookmarkAction extends Action implements IViewActionDelegate  {
22     BookmarkView view;
23         /**
24          * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
25          */
26         public void init(IViewPart view) {
27                 this.view = (BookmarkView) view;
28         }
29
30         /**
31          * @see org.eclipse.ui.IActionDelegate#run(IAction)
32          */
33         public void run(IAction action) {
34                 run();
35         }
36         
37         public void run() {
38                 Object selection = view.getCurrent();
39                 if (selection instanceof BookmarkNode) {
40                         BookmarkNode node = (BookmarkNode) selection;
41                         if (node != null) {
42                                 String name = node.getName();
43                                 boolean flag = MessageDialog.openConfirm(view.getSite().getShell(), Messages.getString("bookmarkview.deleteBookmark"), Messages.getString("bookmarkview.confirm") + name); //$NON-NLS-1$ //$NON-NLS-2$
44                                 if (flag) {
45                                         view.deleteCurrent();
46                                 }
47                         }
48                 }
49         }
50
51         /**
52          * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
53          */
54         public void selectionChanged(IAction action, ISelection selection) {
55         }
56
57 }