KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > lifl > eclipse > plugin > PopUpMenu > popup > actions > LaunchShellAction


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2003 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Offroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.omg.lifl.eclipse.plugin.PopUpMenu.popup.actions;
27
28 import java.io.IOException JavaDoc;
29
30 import org.eclipse.jface.action.IAction;
31 import org.eclipse.jface.viewers.ISelection;
32 import org.eclipse.ui.IObjectActionDelegate;
33 import org.eclipse.ui.IWorkbenchPart;
34
35 import org.omg.lifl.eclipse.plugin.utils.OSHelper;
36 import org.omg.lifl.eclipse.plugin.utils.WorkBenchHelper;
37
38 public class LaunchShellAction implements IObjectActionDelegate {
39
40     /**
41      * Constructor for LaunchShellAction.
42      */

43     public LaunchShellAction() {
44         super();
45     }
46
47     /**
48      * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
49      */

50     public void setActivePart(IAction action, IWorkbenchPart targetPart) {
51     }
52
53     /**
54      * @see IActionDelegate#run(IAction)
55      */

56     public void run(IAction action) {
57         //WorkBenchHelper.log();
58

59         String JavaDoc srciptCmd = null;
60         if (OSHelper.isWindowsOS()) { // Windows OS
61
srciptCmd =
62                 OSHelper.createWin32Shell()
63                     + WorkBenchHelper.getSelectedRessourceFullFileName();
64         } else if (OSHelper.isLinuxOS()) { // Linux OS
65
srciptCmd = null;
66             return; //create exec command for linux shell
67
} else // other OS
68
return;
69         
70         try {
71             OSHelper.launchProcess(srciptCmd);
72
73         } catch (IOException JavaDoc e) {
74             // the shell command cannot be launch
75
e.printStackTrace();
76         }
77     }
78
79     /**
80      * @see IActionDelegate#selectionChanged(IAction, ISelection)
81      */

82     public void selectionChanged(IAction action, ISelection selection) {
83     }
84
85 }
86
Popular Tags