Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2008 MontaVista Software, Inc. |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
8 |
* Contributors: |
9 |
* Yu-Fen Kuo (MontaVista)- initial API and implementation |
10 |
*******************************************************************************/ |
11 |
|
12 |
package org.eclipse.rse.internal.subsystems.terminals.core; |
13 |
|
14 |
import org.eclipse.rse.core.model.IHost; |
15 |
import org.eclipse.rse.core.subsystems.IConnectorService; |
16 |
import org.eclipse.rse.core.subsystems.ISubSystem; |
17 |
import org.eclipse.rse.internal.services.terminals.ITerminalService; |
18 |
import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystem; |
19 |
import org.eclipse.rse.subsystems.terminals.core.TerminalServiceSubSystemConfiguration; |
20 |
|
21 |
public class TerminalSubSystemConfigurationImpl extends |
22 |
TerminalServiceSubSystemConfiguration { |
23 |
|
24 |
/** |
25 |
* Instantiate and return an instance of OUR subsystem. Do not populate it |
26 |
* yet though! |
27 |
* |
28 |
* @see org.eclipse.rse.core.subsystems.SubSystemConfiguration#createSubSystemInternal(IHost) |
29 |
*/ |
30 |
public ISubSystem createSubSystemInternal(IHost host) { |
31 |
IConnectorService connectorService = getConnectorService(host); |
32 |
ISubSystem subsys = new TerminalServiceSubSystem(host, |
33 |
connectorService, getTerminalService(host)); |
34 |
return subsys; |
35 |
} |
36 |
|
37 |
public ITerminalService createTerminalService(IHost host) { |
38 |
ISubSystem ss = TerminalSubSystemHelper.getSuitableSubSystem(host); |
39 |
if (ss != null) { |
40 |
return (ITerminalService) (ss.getSubSystemConfiguration() |
41 |
.getService(host)).getAdapter(ITerminalService.class); |
42 |
} else { |
43 |
return null; |
44 |
} |
45 |
} |
46 |
|
47 |
public void setConnectorService(IHost host, |
48 |
IConnectorService connectorService) { |
49 |
// SshConnectorServiceManager.getInstance().setConnectorService(host, |
50 |
// ISshService.class, connectorService); |
51 |
// Nothing to do here since we just re-use the existing suitable subsystem |
52 |
} |
53 |
|
54 |
public IConnectorService getConnectorService(IHost host) { |
55 |
ISubSystem ss = TerminalSubSystemHelper.getSuitableSubSystem(host); |
56 |
if (ss != null) { |
57 |
return ss.getConnectorService(); |
58 |
} else { |
59 |
return new DelegatingTerminalConnectorService(host); |
60 |
} |
61 |
} |
62 |
} |