|
Lines 1-13
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2006, 2007 MontaVista Software, Inc. and others. |
2 |
* Copyright (c) 2006, 2008 MontaVista Software, Inc. and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* Yu-Fen Kuo (MontaVista) - initial API and implementation |
9 |
* Yu-Fen Kuo (MontaVista) - initial API and implementation |
| 10 |
* Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere |
10 |
* Martin Oberhuber (Wind River) - [refactor] "shell" instead of "ssh" everywhere |
|
|
11 |
* Anna Dushistova (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType |
| 11 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
| 12 |
|
13 |
|
| 13 |
package org.eclipse.rse.internal.subsystems.processes.shell.linux; |
14 |
package org.eclipse.rse.internal.subsystems.processes.shell.linux; |
|
Lines 22-30
Link Here
|
| 22 |
|
23 |
|
| 23 |
import org.eclipse.rse.core.model.IHost; |
24 |
import org.eclipse.rse.core.model.IHost; |
| 24 |
import org.eclipse.rse.core.subsystems.ISubSystem; |
25 |
import org.eclipse.rse.core.subsystems.ISubSystem; |
|
|
26 |
import org.eclipse.rse.services.IService; |
| 25 |
import org.eclipse.rse.services.shells.IShellService; |
27 |
import org.eclipse.rse.services.shells.IShellService; |
| 26 |
import org.eclipse.rse.subsystems.processes.servicesubsystem.IProcessServiceSubSystem; |
28 |
import org.eclipse.rse.subsystems.processes.servicesubsystem.IProcessServiceSubSystem; |
| 27 |
import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem; |
|
|
| 28 |
|
29 |
|
| 29 |
/** |
30 |
/** |
| 30 |
* The activator class controls the plug-in life cycle |
31 |
* The activator class controls the plug-in life cycle |
|
Lines 159-167
Link Here
|
| 159 |
* @return shell service object, or <code>null</code> if not found. |
160 |
* @return shell service object, or <code>null</code> if not found. |
| 160 |
*/ |
161 |
*/ |
| 161 |
public static IShellService getShellService(IHost host) { |
162 |
public static IShellService getShellService(IHost host) { |
| 162 |
IShellServiceSubSystem ss = getShellServiceSubSystem(host); |
163 |
ISubSystem ss = getSuitableSubSystem(host); |
| 163 |
if (ss!=null) { |
164 |
if (ss!=null) { |
| 164 |
return ss.getShellService(); |
165 |
return (IShellService)ss.getSubSystemConfiguration().getService(host).getAdapter(IShellService.class); |
| 165 |
} |
166 |
} |
| 166 |
return null; |
167 |
return null; |
| 167 |
} |
168 |
} |
|
Lines 172-185
Link Here
|
| 172 |
* @param host the connection |
173 |
* @param host the connection |
| 173 |
* @return shell service subsystem, or <code>null</code> if not found. |
174 |
* @return shell service subsystem, or <code>null</code> if not found. |
| 174 |
*/ |
175 |
*/ |
| 175 |
public static IShellServiceSubSystem getShellServiceSubSystem(IHost host) { |
176 |
public static ISubSystem getSuitableSubSystem(IHost host) { |
| 176 |
if (host == null) |
177 |
if (host == null) |
| 177 |
return null; |
178 |
return null; |
| 178 |
ISubSystem[] subSystems = host.getSubSystems(); |
179 |
ISubSystem[] subSystems = host.getSubSystems(); |
|
|
180 |
IShellService ssvc = null; |
| 179 |
for (int i = 0; subSystems != null && i < subSystems.length; i++) { |
181 |
for (int i = 0; subSystems != null && i < subSystems.length; i++) { |
| 180 |
if (subSystems[i] instanceof IShellServiceSubSystem) { |
182 |
IService svc = subSystems[i].getSubSystemConfiguration().getService(host); |
| 181 |
return (IShellServiceSubSystem)subSystems[i]; |
183 |
if (svc!=null) { |
| 182 |
} |
184 |
ssvc = (IShellService)svc.getAdapter(IShellService.class); |
|
|
185 |
if (ssvc != null) { |
| 186 |
return subSystems[i]; |
| 187 |
} |
| 188 |
} |
| 183 |
} |
189 |
} |
| 184 |
return null; |
190 |
return null; |
| 185 |
} |
191 |
} |