01: package com.salmonllc.ideTools.eclipse;
02:
03: import org.eclipse.jface.action.IAction;
04: import org.eclipse.jface.viewers.ISelection;
05: import org.eclipse.ui.IWorkbenchWindow;
06: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
07:
08: /**
09: * @author Administrator
10: *
11: * To change this generated comment edit the template variable "typecomment":
12: * Window>Preferences>Java>Templates.
13: * To enable and disable the creation of type comments go to
14: * Window>Preferences>Java>Code Generation.
15: */
16: public class GenControllerAction implements
17: IWorkbenchWindowActionDelegate {
18:
19: String _lastFile = null;
20:
21: /**
22: * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
23: */
24: public void dispose() {
25: }
26:
27: /**
28: * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
29: */
30: public void init(IWorkbenchWindow window) {
31: }
32:
33: /**
34: * @see org.eclipse.ui.IActionDelegate#run(IAction)
35: */
36: public void run(IAction action) {
37: try {
38: if (_lastFile == null)
39: return;
40: String progArgs[] = new String[] { "-GENCONTROLLER",
41: "-DONTAPPENDPROJECT", "-URL", _lastFile };
42: SalmonPlugin.runIDETool(progArgs, true);
43: } catch (Exception e) {
44: e.printStackTrace();
45: }
46: }
47:
48: /**
49: * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
50: */
51: public void selectionChanged(IAction action, ISelection selection) {
52: _lastFile = SalmonPlugin.getSelectedFile(selection, ".jsp");
53: }
54:
55: }
|