3.x RC1 compatibility
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / actions / NewSubsetAction.java
1 package com.quantum.actions;
2
3 import com.quantum.Messages;
4 import com.quantum.view.subset.SubsetNode;
5 import com.quantum.view.subset.SubsetView;
6
7 import org.eclipse.jface.action.Action;
8 import org.eclipse.jface.action.IAction;
9 import org.eclipse.jface.dialogs.InputDialog;
10 import org.eclipse.jface.viewers.ISelection;
11 import org.eclipse.ui.IViewActionDelegate;
12 import org.eclipse.ui.IViewPart;
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 }