View | Details | Raw Unified | Return to bug 227569 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+3 lines)
Lines 14-16 Link Here
14
14
15
pluginName = RSE Terminals Core (Incubation)
15
pluginName = RSE Terminals Core (Incubation)
16
providerName = Eclipse.org
16
providerName = Eclipse.org
17
18
TerminalSubsystemName = Terminals
19
TerminalSubsystemDescription = Work with terminals and commands on remote systems.
(-)src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java (+5 lines)
Lines 51-54 Link Here
51
		return ITerminalService.class;
51
		return ITerminalService.class;
52
	}
52
	}
53
53
54
	public boolean isFactoryFor(Class subSystemType) {
55
		boolean isFor = TerminalServiceSubSystem.class.equals(subSystemType);
56
		return isFor;
57
	}
58
54
}
59
}
(-)src/org/eclipse/rse/internal/subsystems/terminals/core/TerminalSubSystemConfigurationImpl.java (+62 lines)
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
}
(-)src/org/eclipse/rse/internal/subsystems/terminals/core/DelegatingTerminalConnectorService.java (+66 lines)
Added Link Here
1
/********************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
3
 * This program and the accompanying materials are made available under the terms
4
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is 
5
 * available at http://www.eclipse.org/legal/epl-v10.html
6
 * 
7
 * Initial Contributors:
8
 * The following IBM employees contributed to the Remote System Explorer
9
 * component that contains this file: David McKnight.
10
 * 
11
 * Contributors:
12
 * Anna Dushistova  (MontaVista) - [239159] The shell process subsystem not working without the shells subsystem present for the systemType
13
 ********************************************************************************/
14
package org.eclipse.rse.internal.subsystems.terminals.core;
15
16
import org.eclipse.rse.core.model.IHost;
17
import org.eclipse.rse.core.subsystems.AbstractDelegatingConnectorService;
18
import org.eclipse.rse.core.subsystems.IConnectorService;
19
import org.eclipse.rse.core.subsystems.ISubSystem;
20
import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
21
22
/**
23
 * This class delegates the connector service requests for the terminal
24
 * subsystem to the connector service of any subsystem that has service which can be adopted to ITerminalService.
25
 */
26
public class DelegatingTerminalConnectorService extends AbstractDelegatingConnectorService 
27
{
28
	private IConnectorService _realService;
29
30
	/**
31
	 * @param host the linux host that is the target for this connector service.
32
	 */
33
	public DelegatingTerminalConnectorService(IHost host) 
34
	{
35
		super(host);
36
	}
37
38
	/* (non-Javadoc)
39
	 * @see org.eclipse.rse.core.subsystems.AbstractDelegatingConnectorService#getRealConnectorService()
40
	 */
41
	public IConnectorService getRealConnectorService()
42
	{
43
		if (_realService != null)
44
		{
45
			return _realService;
46
		}
47
		else
48
		{
49
			ISubSystem ss = TerminalSubSystemHelper.getSuitableSubSystem(getHost());
50
			if (ss != null)
51
			{
52
				_realService = ss.getConnectorService();
53
				
54
				// register the process subsystem
55
				ITerminalServiceSubSystem ts = TerminalSubSystemHelper.getTerminalServiceSubSystem(getHost());
56
				_realService.registerSubSystem(ts);
57
				return _realService;
58
			}
59
			else
60
			{
61
				return null;
62
			}
63
		}
64
	}
65
66
}
(-)plugin.xml (+30 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
Copyright (c) 2008 MontaVista Software, Inc. 
4
All rights reserved. This program and the accompanying materials 
5
are made available under the terms of the Eclipse Public License v1.0 
6
which accompanies this distribution, and is available at 
7
http://www.eclipse.org/legal/epl-v10.html 
8
9
Contributors: 
10
Yu-Fen Kuo (MontaVista)- initial API and implementation 
11
-->
12
<?eclipse version="3.1"?>
13
<plugin>
14
    <extension
15
        point="org.eclipse.rse.core.subsystemConfigurations">
16
        <configuration
17
        category="terminals"
18
        class="org.eclipse.rse.internal.subsystems.terminals.core.TerminalSubSystemConfigurationImpl"
19
        description="%TerminalSubsystemDescription"
20
        icon="icons/full/obj16/terminalcommands_obj.gif"
21
        iconlive="icons/full/obj16/terminalcommandslive_obj.gif"
22
        id="terminals"
23
        name="%TerminalSubsystemName"
24
        priority="300"
25
        systemTypeIds="org.eclipse.rse.systemtype.linux;org.eclipse.rse.systemtype.unix;org.eclipse.rse.systemtype.aix;org.eclipse.rse.systemtype.ssh"
26
        vendor="%providerName">
27
        </configuration>
28
    </extension>
29
30
</plugin> 
(-)src/org/eclipse/rse/internal/subsystems/terminals/core/TerminalSubSystemHelper.java (+50 lines)
Added Link Here
1
package org.eclipse.rse.internal.subsystems.terminals.core;
2
3
import org.eclipse.rse.core.model.IHost;
4
import org.eclipse.rse.core.subsystems.ISubSystem;
5
import org.eclipse.rse.internal.services.terminals.ITerminalService;
6
import org.eclipse.rse.services.IService;
7
import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
8
9
public class TerminalSubSystemHelper {
10
	/**
11
	 * Find the first ITerminalServiceSubSystem service associated with the
12
	 * host.
13
	 * 
14
	 * @param host
15
	 *            the connection
16
	 * @return shell service subsystem, or <code>null</code> if not found.
17
	 */
18
	public static ISubSystem getSuitableSubSystem(IHost host) {
19
		if (host == null)
20
			return null;
21
		ISubSystem[] subSystems = host.getSubSystems();
22
		ITerminalService ssvc = null;
23
		for (int i = 0; subSystems != null && i < subSystems.length; i++) {
24
			IService svc = subSystems[i].getSubSystemConfiguration()
25
					.getService(host);
26
			if (svc != null) {
27
				ssvc = (ITerminalService) svc
28
						.getAdapter(ITerminalService.class);
29
				if (ssvc != null) {
30
					return subSystems[i];
31
				}
32
			}
33
		}
34
		return null;
35
	}
36
37
	public static ITerminalServiceSubSystem getTerminalServiceSubSystem(
38
			IHost host) {
39
		if (host == null)
40
			return null;
41
		ISubSystem[] subSystems = host.getSubSystems();
42
		for (int i = 0; subSystems != null && i < subSystems.length; i++) {
43
			if (subSystems[i] instanceof ITerminalServiceSubSystem) {
44
				return (ITerminalServiceSubSystem) subSystems[i];
45
			}
46
		}
47
		return null;
48
	}
49
50
}

Return to bug 227569