mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
[228577] [rseterminal] Clean up RSE Terminal impl (apply patch from Anna Dushistova)
This commit is contained in:
parent
b9ed3d694e
commit
0b82909c80
5 changed files with 32 additions and 47 deletions
|
@ -5,8 +5,9 @@
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Yu-Fen Kuo (MontaVista) - initial API and implementation
|
* 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
|
* 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
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.subsystems.terminals.core;
|
package org.eclipse.rse.subsystems.terminals.core;
|
||||||
|
@ -31,7 +32,7 @@ import org.eclipse.swt.widgets.Display;
|
||||||
public final class TerminalServiceSubSystem extends SubSystem implements
|
public final class TerminalServiceSubSystem extends SubSystem implements
|
||||||
ITerminalServiceSubSystem, ICommunicationsListener {
|
ITerminalServiceSubSystem, ICommunicationsListener {
|
||||||
|
|
||||||
protected ITerminalService _hostService;
|
protected ITerminalService _hostService = null;
|
||||||
|
|
||||||
private ArrayList children;
|
private ArrayList children;
|
||||||
|
|
||||||
|
@ -52,12 +53,14 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
||||||
protected TerminalServiceSubSystem(IHost host,
|
protected TerminalServiceSubSystem(IHost host,
|
||||||
IConnectorService connectorService) {
|
IConnectorService connectorService) {
|
||||||
super(host, connectorService);
|
super(host, connectorService);
|
||||||
|
children = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerminalServiceSubSystem(IHost host,
|
public TerminalServiceSubSystem(IHost host,
|
||||||
IConnectorService connectorService, ITerminalService hostService) {
|
IConnectorService connectorService, ITerminalService hostService) {
|
||||||
super(host, connectorService);
|
super(host, connectorService);
|
||||||
_hostService = hostService;
|
_hostService = hostService;
|
||||||
|
children = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITerminalService getTerminalService() {
|
public ITerminalService getTerminalService() {
|
||||||
|
@ -69,34 +72,28 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addChild(TerminalElement element) {
|
public void addChild(TerminalElement element) {
|
||||||
if (children == null) {
|
synchronized (children) {
|
||||||
children = new ArrayList();
|
children.add(element);
|
||||||
// if this is first shell, start listening so that on disconnect, we
|
}
|
||||||
// persist
|
|
||||||
getConnectorService().addCommunicationsListener(this);
|
|
||||||
}
|
|
||||||
children.add(element);
|
|
||||||
Display.getDefault().asyncExec(new Refresh(this));
|
Display.getDefault().asyncExec(new Refresh(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeChild(TerminalElement element) {
|
public void removeChild(TerminalElement element) {
|
||||||
if (children != null) {
|
synchronized (children) {
|
||||||
children.remove(element);
|
if (children.size() > 0) {
|
||||||
}
|
children.remove(element);
|
||||||
if (children == null) {
|
}
|
||||||
getConnectorService().removeCommunicationsListener(this);
|
}
|
||||||
}
|
Display.getDefault().asyncExec(new Refresh(this));
|
||||||
Display.getDefault().asyncExec(new Refresh(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeChild(String terminalTitle) {
|
public void removeChild(String terminalTitle) {
|
||||||
if (children != null) {
|
if (children.size() > 0) {
|
||||||
TerminalElement element = getChild(terminalTitle);
|
TerminalElement element = getChild(terminalTitle);
|
||||||
if (element != null){
|
if (element != null){
|
||||||
children.remove(element);
|
synchronized (children) {
|
||||||
if (children == null) {
|
children.remove(element);
|
||||||
getConnectorService().removeCommunicationsListener(this);
|
}
|
||||||
}
|
|
||||||
Display.getDefault().asyncExec(new Refresh(this));
|
Display.getDefault().asyncExec(new Refresh(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +160,7 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
||||||
try {
|
try {
|
||||||
removeTerminalElement(element);
|
removeTerminalElement(element);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
RSECorePlugin.getDefault().getLogger().logError("Error removing terminal", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anna Dushistova (MontaVista) - initial API and implementation
|
* Anna Dushistova (MontaVista) - initial API and implementation
|
||||||
|
* Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.internal.terminals.ui.views;
|
package org.eclipse.rse.internal.terminals.ui.views;
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ import java.io.InputStream;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.internal.services.terminals.ITerminalShell;
|
import org.eclipse.rse.internal.services.terminals.ITerminalShell;
|
||||||
import org.eclipse.rse.internal.services.terminals.ITerminalService;
|
import org.eclipse.rse.internal.services.terminals.ITerminalService;
|
||||||
import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
|
import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
|
||||||
|
@ -53,9 +55,8 @@ public class RSETerminalConnectionThread extends Thread {
|
||||||
}
|
}
|
||||||
fConn.setInputStream(shell.getInputStream());
|
fConn.setInputStream(shell.getInputStream());
|
||||||
fConn.setOutputStream(shell.getOutputStream());
|
fConn.setOutputStream(shell.getOutputStream());
|
||||||
} catch (SystemMessageException e1) {
|
} catch (SystemMessageException e) {
|
||||||
// TODO Auto-generated catch block
|
RSECorePlugin.getDefault().getLogger().logError("Error launching terminal", e); //$NON-NLS-1$
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
}
|
||||||
fConn.setTerminalHostShell(shell);
|
fConn.setTerminalHostShell(shell);
|
||||||
fControl.setState(TerminalState.CONNECTED);
|
fControl.setState(TerminalState.CONNECTED);
|
||||||
|
@ -69,8 +70,7 @@ public class RSETerminalConnectionThread extends Thread {
|
||||||
} catch (InterruptedIOException e) {
|
} catch (InterruptedIOException e) {
|
||||||
// we got interrupted: we are done...
|
// we got interrupted: we are done...
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
RSECorePlugin.getDefault().getLogger().logError("Error while reading data", e); //$NON-NLS-1$
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
// when reading is done, we set the state to closed
|
// when reading is done, we set the state to closed
|
||||||
|
@ -82,16 +82,6 @@ public class RSETerminalConnectionThread extends Thread {
|
||||||
*/
|
*/
|
||||||
void disconnect() {
|
void disconnect() {
|
||||||
interrupt();
|
interrupt();
|
||||||
synchronized (this) {
|
|
||||||
try {
|
|
||||||
// do not close the connection
|
|
||||||
// TerminalServiceHelper.getTerminalSubSystem(fConn.host)
|
|
||||||
// .disconnect();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Anna Dushistova (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
|
* 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
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.internal.terminals.ui.views;
|
package org.eclipse.rse.internal.terminals.ui.views;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.internal.services.terminals.ITerminalShell;
|
import org.eclipse.rse.internal.services.terminals.ITerminalShell;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||||
|
@ -42,7 +44,7 @@ public class RSETerminalConnectorImpl extends TerminalConnectorImpl {
|
||||||
try {
|
try {
|
||||||
getInputStream().close();
|
getInputStream().close();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
exception.printStackTrace();
|
RSECorePlugin.getDefault().getLogger().logError("Error while closing input stream", exception); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@ public class RSETerminalConnectorImpl extends TerminalConnectorImpl {
|
||||||
try {
|
try {
|
||||||
getTerminalToRemoteStream().close();
|
getTerminalToRemoteStream().close();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
exception.printStackTrace();
|
RSECorePlugin.getDefault().getLogger().logError("Error while closing terminal-to-remote stream", exception); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
* Radoslav Gerganov(ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist
|
* Radoslav Gerganov(ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist
|
||||||
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsViewPart
|
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsViewPart
|
||||||
* Anna Dushistova (MontaVista) - Adapted from SystemCommandsViewPart
|
* Anna Dushistova (MontaVista) - Adapted from SystemCommandsViewPart
|
||||||
* Yu-Fen Kuo (MontaVista) - [227572] RSE Terminal doesn't reset the "connected" state when the shell exits
|
* 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
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.internal.terminals.ui.views;
|
package org.eclipse.rse.internal.terminals.ui.views;
|
||||||
|
|
||||||
|
@ -38,8 +39,6 @@ import org.eclipse.rse.core.events.ISystemResourceChangeListener;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
|
||||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
|
||||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||||
import org.eclipse.rse.ui.model.ISystemShellProvider;
|
import org.eclipse.rse.ui.model.ISystemShellProvider;
|
||||||
import org.eclipse.rse.ui.view.IRSEViewPart;
|
import org.eclipse.rse.ui.view.IRSEViewPart;
|
||||||
|
@ -69,9 +68,6 @@ public class TerminalViewer extends ViewPart implements ISelectionListener,
|
||||||
.getSelectionService();
|
.getSelectionService();
|
||||||
selectionService.addSelectionListener(this);
|
selectionService.addSelectionListener(this);
|
||||||
|
|
||||||
SystemWidgetHelpers.setHelp(tabFolder, RSEUIPlugin.HELPPREFIX
|
|
||||||
+ "ucmd0000"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
|
|
||||||
registry.addSystemResourceChangeListener(this);
|
registry.addSystemResourceChangeListener(this);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsUI
|
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsUI
|
||||||
|
* Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.terminals.ui.views;
|
package org.eclipse.rse.internal.terminals.ui.views;
|
||||||
|
@ -56,7 +57,6 @@ public class TerminalsUI {
|
||||||
viewer = (TerminalViewer) page.showView(TerminalViewer.VIEW_ID);
|
viewer = (TerminalViewer) page.showView(TerminalViewer.VIEW_ID);
|
||||||
page.bringToTop(viewer);
|
page.bringToTop(viewer);
|
||||||
} catch (PartInitException e) {
|
} catch (PartInitException e) {
|
||||||
e.printStackTrace();
|
|
||||||
SystemBasePlugin.logError(Activator
|
SystemBasePlugin.logError(Activator
|
||||||
.getResourceString("TerminalsUI.cannotOpenView.error"), e); //$NON-NLS-1$
|
.getResourceString("TerminalsUI.cannotOpenView.error"), e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue