Fixed #1721079 - Can not set breakpoint in different files on the same line
[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.Messages;
11 import net.sourceforge.phpdt.sql.view.BookmarkView;
12 import net.sourceforge.phpdt.sql.view.bookmark.BookmarkNode;
13
14 /**
15  * @author root
16  *
17  */
18 public class DeleteBookmarkAction extends Action implements IViewActionDelegate  {
19     BookmarkView view;
20         /**
21          * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
22          */
23         public void init(IViewPart view) {
24                 this.view = (BookmarkView) view;
25         }
26
27         /**
28          * @see org.eclipse.ui.IActionDelegate#run(IAction)
29          */
30         public void run(IAction action) {
31                 run();
32         }
33         
34         public void run() {
35                 Object selection = view.getCurrent();
36                 if (selection instanceof BookmarkNode) {
37                         BookmarkNode node = (BookmarkNode) selection;
38                         if (node != null) {
39                                 String name = node.getName();
40                                 boolean flag = MessageDialog.openConfirm(view.getSite().getShell(), Messages.getString("bookmarkview.deleteBookmark"), Messages.getString("bookmarkview.confirm") + name); //$NON-NLS-1$ //$NON-NLS-2$
41                                 if (flag) {
42                                         view.deleteCurrent();
43                                 }
44                         }
45                 }
46         }
47
48         /**
49          * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
50          */
51         public void selectionChanged(IAction action, ISelection selection) {
52         }
53
54 }