diff options
Diffstat (limited to 'rse/plugins/org.eclipse.rse.subsystems.terminals.core/src')
5 files changed, 0 insertions, 369 deletions
diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java deleted file mode 100644 index bd2c6fc12..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystem.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. - * 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 - * - * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation - * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits - ********************************************************************************/ -package org.eclipse.rse.subsystems.terminals.core; - -import org.eclipse.rse.core.subsystems.ISubSystem; -import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; - -public interface ITerminalServiceSubSystem extends ISubSystem { - public void addChild(TerminalElement element); - - public void removeChild(TerminalElement element); - - public void removeChild(String terminalTitle); - - public TerminalElement getChild(String terminalTitle); -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java deleted file mode 100644 index 60434e45b..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/ITerminalServiceSubSystemConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. - * 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 - * - * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation - ********************************************************************************/ - -package org.eclipse.rse.subsystems.terminals.core; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.internal.services.terminals.ITerminalService; - -public interface ITerminalServiceSubSystemConfiguration extends - ISubSystemConfiguration { - public ITerminalService getTerminalService(IHost host); - - public ITerminalService createTerminalService(IHost host); - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java deleted file mode 100644 index 371824df9..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystem.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. 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 - * - * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation - * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits - * Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl - * Martin Oberhuber (Wind River) - [228577] [rseterminal] Further cleanup - ********************************************************************************/ - -package org.eclipse.rse.subsystems.terminals.core; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.events.ISystemResourceChangeEvents; -import org.eclipse.rse.core.events.SystemResourceChangeEvent; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.subsystems.CommunicationsEvent; -import org.eclipse.rse.core.subsystems.ICommunicationsListener; -import org.eclipse.rse.core.subsystems.IConnectorService; -import org.eclipse.rse.core.subsystems.SubSystem; -import org.eclipse.rse.internal.services.terminals.ITerminalService; -import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement; -import org.eclipse.swt.widgets.Display; - -/** - * A Subsystem that has terminal instances as children. - */ -public class TerminalServiceSubSystem extends SubSystem implements - ITerminalServiceSubSystem, ICommunicationsListener { - - private ITerminalService _hostService = null; - - private ArrayList children = new ArrayList(); - - /** - * Constructor. - */ - public TerminalServiceSubSystem(IHost host, - IConnectorService connectorService, ITerminalService hostService) { - super(host, connectorService); - _hostService = hostService; - } - - private void fireAsyncRefresh(final Object target) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - registry.fireEvent(new SystemResourceChangeEvent(target, ISystemResourceChangeEvents.EVENT_REFRESH, target)); - - } - }); - } - - /** - * Return the Terminal Service associated with this subsystem. - */ - public ITerminalService getTerminalService() { - return _hostService; - } - - public Class getServiceType() { - return ITerminalService.class; - } - - public void addChild(TerminalElement element) { - if (element != null) { - synchronized (children) { - children.add(element); - } - fireAsyncRefresh(this); - } - } - - public void removeChild(TerminalElement element) { - if(element!=null){ - synchronized (children) { - children.remove(element); - } - fireAsyncRefresh(this); - } - } - - public void removeChild(String terminalTitle) { - removeChild(getChild(terminalTitle)); - } - - public TerminalElement getChild(String terminalTitle) { - synchronized (children) { - for (Iterator it = children.iterator(); it.hasNext();) { - TerminalElement element = (TerminalElement) it.next(); - if (element.getName().equals(terminalTitle)) - return element; - } - } - return null; - } - - public Object[] getChildren() { - synchronized (children) { - return children.toArray(); - } - } - - public boolean hasChildren() { - synchronized (children) { - return !children.isEmpty(); - } - } - - /** - * Set the terminal service associated with this subsystem. - */ - public void setTerminalService(ITerminalService service) { - _hostService = service; - } - - public void communicationsStateChange(CommunicationsEvent e) { - switch (e.getState()) { - case CommunicationsEvent.AFTER_DISCONNECT: - // no longer listen - getConnectorService().removeCommunicationsListener(this); - break; - - case CommunicationsEvent.BEFORE_DISCONNECT: - case CommunicationsEvent.CONNECTION_ERROR: - Display.getDefault().asyncExec(new Runnable(){ - public void run() { - cancelAllTerminals(); - } - }); - break; - default: - break; - } - - } - - public boolean isPassiveCommunicationsListener() { - return true; - } - - /** - * Set the terminal service associated with this subsystem. - */ - public void cancelAllTerminals() { - Object[] terminals; - synchronized (children) { - terminals = getChildren(); - children.clear(); - } - if (terminals.length > 0) { - for (int i = terminals.length - 1; i >= 0; i--) { - TerminalElement element = (TerminalElement) terminals[i]; - try { - removeTerminalElement(element); - } catch (Exception e) { - RSECorePlugin.getDefault().getLogger().logError("Error removing terminal", e); //$NON-NLS-1$ - } - } - fireAsyncRefresh(this); - } - } - - private void removeTerminalElement(TerminalElement element) { - element.getTerminalShell().exit(); - ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - registry.fireEvent(new SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED, null)); - } - - public void initializeSubSystem(IProgressMonitor monitor) { - super.initializeSubSystem(monitor); - getConnectorService().addCommunicationsListener(this); - } - - public void uninitializeSubSystem(IProgressMonitor monitor) { - getConnectorService().removeCommunicationsListener(this); - super.uninitializeSubSystem(monitor); - } -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java deleted file mode 100644 index b74083a41..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/TerminalServiceSubSystemConfiguration.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. - * 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 - * - * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation - ********************************************************************************/ - -package org.eclipse.rse.subsystems.terminals.core; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.subsystems.SubSystemConfiguration; -import org.eclipse.rse.internal.services.terminals.ITerminalService; -import org.eclipse.rse.services.IService; - - -public abstract class TerminalServiceSubSystemConfiguration extends - SubSystemConfiguration implements - ITerminalServiceSubSystemConfiguration { - - private Map _services; - - protected TerminalServiceSubSystemConfiguration() { - super(); - _services = new HashMap(); - } - - public boolean supportsFilters() { - return false; - } - - public final ITerminalService getTerminalService(IHost host) { - ITerminalService service = (ITerminalService) _services.get(host); - if (service == null) { - service = createTerminalService(host); - _services.put(host, service); - } - return service; - } - - public final IService getService(IHost host) { - return getTerminalService(host); - } - - public Class getServiceType() { - return ITerminalService.class; - } - -} diff --git a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java b/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java deleted file mode 100644 index be3d4184e..000000000 --- a/rse/plugins/org.eclipse.rse.subsystems.terminals.core/src/org/eclipse/rse/subsystems/terminals/core/elements/TerminalElement.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2008 MontaVista Software, Inc. 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 - * - * Contributors: - * Yu-Fen Kuo (MontaVista) - initial API and implementation - * Anna Dushistova (MontaVista) - initial API and implementation - * Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits - * Martin Oberhuber (Wind River) - [228577] [rseterminal] Further cleanup - ********************************************************************************/ -package org.eclipse.rse.subsystems.terminals.core.elements; - -import org.eclipse.rse.core.subsystems.AbstractResource; -import org.eclipse.rse.internal.services.terminals.ITerminalShell; -import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem; - -/** - * An element in the RSE Tree that resembles a Terminal connection. - */ -public class TerminalElement extends AbstractResource { - private String name; - private ITerminalShell terminalShell; - - /** - * Constructor. - */ - public TerminalElement(String name, - ITerminalServiceSubSystem terminalServiceSubSystem) { - super(terminalServiceSubSystem); - this.name = name; - } - - /** - * Return the name of this element, which will also be used as the label in - * the tree. - */ - public final String getName() { - return name; - } - - public String toString() { - return getName(); - } - - public boolean equals(Object obj) { - if (obj == this) - return true; - if (!(obj instanceof TerminalElement)) - return false; - TerminalElement other = (TerminalElement) obj; - return name.equals(other.getName()) - && getSubSystem().equals(other.getSubSystem()) - && (terminalShell == null ? other.getTerminalShell() == null - : terminalShell.equals(other.getTerminalShell())); - } - - public int hashCode() { - if (terminalShell != null) - return terminalShell.hashCode() * 37 + name.hashCode(); - return name.hashCode() ; - } - - /** - * Return the back-end connection of this terminal instance. - */ - public ITerminalShell getTerminalShell() { - return terminalShell; - } - - /** - * Set the back-end connection of this terminal instance. - */ - public void setTerminalShell(ITerminalShell terminalShell) { - this.terminalShell = terminalShell; - } - -} |