3m9 compatible;
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / actions / NewSubsetAction.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.InputDialog;
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.SubsetView;
12 import net.sourceforge.phpdt.sql.view.bookmark.SubsetNode;
13
14 /**
15  * @author root
16  *
17  */
18 public class NewSubsetAction extends Action implements IViewActionDelegate {
19    IViewPart view;
20         /**
21          * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
22          */
23         public void init(IViewPart view) {
24                 this.view = view;
25                 
26         }
27
28         /**
29          * @see org.eclipse.ui.IActionDelegate#run(IAction)
30          */
31         public void run(IAction action) {
32                 run();
33         }
34         public void run() {
35                 System.out.println(Messages.getString("NewSubsetAction.CreatingNewSubset")); //$NON-NLS-1$
36                 InputDialog dialog = new InputDialog(view.getSite().getShell(), 
37                         Messages.getString("NewSubsetAction.NameOfNewSubset"), Messages.getString("NewSubsetAction.PleaseEnterName"), null, null); //$NON-NLS-1$ //$NON-NLS-2$
38                 dialog.open();
39                 String value = dialog.getValue();
40                 if (value != null) {
41                         SubsetNode subset = new SubsetNode(value);
42                         ((SubsetView) view).addNewSubset(subset);
43                 }
44                         
45         }
46
47         /**
48          * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
49          */
50         public void selectionChanged(IAction action, ISelection selection) {
51         }
52
53 }