mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 15:15:25 +02:00
[259412] Extracted AbstractDelegatingTerminalService from DelegatingTerminalService.
This commit is contained in:
parent
8900a92d2b
commit
03d54c199f
4 changed files with 72 additions and 36 deletions
|
@ -9,6 +9,7 @@
|
|||
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||
* Anna Dushistova (MontaVista) - [261478] Remove SshShellService, SshHostShell (or deprecate and schedule for removal in 3.2)
|
||||
* Anna Dushistova (MontaVista) - [259412] [api][rseterminal] Decide whether to extract any API from DelegatingTerminalService
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.services;
|
||||
|
||||
|
@ -21,6 +22,8 @@ public class RSEServicesMessages extends NLS {
|
|||
private RSEServicesMessages() {
|
||||
}
|
||||
|
||||
public static String AbstractDelegatingTerminalService_description;
|
||||
public static String AbstractDelegatingTerminalService_name;
|
||||
public static String Socket_timeout;
|
||||
public static String FILEMSG_OPERATION_FAILED;
|
||||
public static String FILEMSG_OPERATION_FAILED_DETAILS;
|
||||
|
|
|
@ -10,12 +10,16 @@
|
|||
# Martin Oberhuber (Wind River) - copy Socket_timeout from team.cvs.core
|
||||
# David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||
# Anna Dushistova (MontaVista) - [261478] Remove SshShellService, SshHostShell (or deprecate and schedule for removal in 3.2)
|
||||
# Anna Dushistova (MontaVista) - [259412] [api][rseterminal] Decide whether to extract any API from DelegatingTerminalService
|
||||
###############################################################################
|
||||
|
||||
# NLS_MESSAGEFORMAT_VAR
|
||||
# NLS_ENCODING=UTF-8
|
||||
|
||||
#From org.eclipse.team.internal.ccvs.core/messages.properties
|
||||
|
||||
AbstractDelegatingTerminalService_name=Terminal Service
|
||||
AbstractDelegatingTerminalService_description=Generic Terminal Service
|
||||
Socket_timeout=A timeout occurred connecting to host {0}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008, 2009 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight.
|
||||
*
|
||||
* Contributors:
|
||||
* Anna Dushistova (MontaVista) - extracted from DelegatingTerminalService
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.services.terminals;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
import org.eclipse.rse.internal.services.RSEServicesMessages;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
|
||||
/**
|
||||
* Base class that can be used for decorating an existing terminal service with
|
||||
* additional functionality. By default, all method calls are passed through to
|
||||
* the original service.
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
public abstract class AbstractDelegatingTerminalService extends AbstractTerminalService {
|
||||
|
||||
public abstract ITerminalService getRealTerminalService();
|
||||
|
||||
public ITerminalShell launchTerminal(String ptyType, String encoding,
|
||||
String[] environment, String initialWorkingDirectory,
|
||||
String commandToRun, IProgressMonitor monitor)
|
||||
throws SystemMessageException {
|
||||
return getRealTerminalService().launchTerminal(ptyType, encoding, environment,
|
||||
initialWorkingDirectory, commandToRun, monitor);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return RSEServicesMessages.AbstractDelegatingTerminalService_description;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return RSEServicesMessages.AbstractDelegatingTerminalService_name;
|
||||
}
|
||||
|
||||
public void initService(IProgressMonitor monitor) {
|
||||
getRealTerminalService().initService(monitor);
|
||||
}
|
||||
|
||||
public void uninitService(IProgressMonitor monitor) {
|
||||
getRealTerminalService().uninitService(monitor);
|
||||
}
|
||||
|
||||
public Object getAdapter(Class adapter) {
|
||||
return getRealTerminalService().getAdapter(adapter);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2008, 2009 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -9,17 +9,15 @@
|
|||
* component that contains this file: David McKnight.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* Anna Dushistova (MontaVista) - [259412][api][rseterminal] Decide whether to extract any API from DelegatingTerminalService.
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.internal.subsystems.terminals.core;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.services.IService;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.services.terminals.AbstractDelegatingTerminalService;
|
||||
import org.eclipse.rse.services.terminals.ITerminalService;
|
||||
import org.eclipse.rse.services.terminals.ITerminalShell;
|
||||
|
||||
/**
|
||||
* Base class that can be used for decorating an existing terminal service with
|
||||
|
@ -35,7 +33,7 @@ import org.eclipse.rse.services.terminals.ITerminalShell;
|
|||
*
|
||||
* @since org.eclipse.rse.subsystems.terminals.core 1.0
|
||||
*/
|
||||
public class DelegatingTerminalService implements ITerminalService {
|
||||
public class DelegatingTerminalService extends AbstractDelegatingTerminalService {
|
||||
|
||||
private IHost _host;
|
||||
private ITerminalService _realService;
|
||||
|
@ -44,7 +42,7 @@ public class DelegatingTerminalService implements ITerminalService {
|
|||
_host = host;
|
||||
}
|
||||
|
||||
private ITerminalService getRealService() {
|
||||
public ITerminalService getRealTerminalService() {
|
||||
if (_host != null && _realService == null) {
|
||||
ISubSystem[] subSystems = _host.getSubSystems();
|
||||
if (subSystems != null) {
|
||||
|
@ -66,33 +64,4 @@ public class DelegatingTerminalService implements ITerminalService {
|
|||
|
||||
return _realService;
|
||||
}
|
||||
|
||||
public ITerminalShell launchTerminal(String ptyType, String encoding,
|
||||
String[] environment, String initialWorkingDirectory,
|
||||
String commandToRun, IProgressMonitor monitor)
|
||||
throws SystemMessageException {
|
||||
return getRealService().launchTerminal(ptyType, encoding, environment,
|
||||
initialWorkingDirectory, commandToRun, monitor);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Generic Terminal Service";
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "Terminal Service";
|
||||
}
|
||||
|
||||
public void initService(IProgressMonitor monitor) {
|
||||
getRealService().initService(monitor);
|
||||
}
|
||||
|
||||
public void uninitService(IProgressMonitor monitor) {
|
||||
getRealService().uninitService(monitor);
|
||||
}
|
||||
|
||||
public Object getAdapter(Class adapter) {
|
||||
return getRealService().getAdapter(adapter);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue