mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +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
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.terminals.core;
|
||||
|
@ -31,7 +32,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
public final class TerminalServiceSubSystem extends SubSystem implements
|
||||
ITerminalServiceSubSystem, ICommunicationsListener {
|
||||
|
||||
protected ITerminalService _hostService;
|
||||
protected ITerminalService _hostService = null;
|
||||
|
||||
private ArrayList children;
|
||||
|
||||
|
@ -52,12 +53,14 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
|||
protected TerminalServiceSubSystem(IHost host,
|
||||
IConnectorService connectorService) {
|
||||
super(host, connectorService);
|
||||
children = new ArrayList();
|
||||
}
|
||||
|
||||
public TerminalServiceSubSystem(IHost host,
|
||||
IConnectorService connectorService, ITerminalService hostService) {
|
||||
super(host, connectorService);
|
||||
_hostService = hostService;
|
||||
children = new ArrayList();
|
||||
}
|
||||
|
||||
public ITerminalService getTerminalService() {
|
||||
|
@ -69,34 +72,28 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
|||
}
|
||||
|
||||
public void addChild(TerminalElement element) {
|
||||
if (children == null) {
|
||||
children = new ArrayList();
|
||||
// if this is first shell, start listening so that on disconnect, we
|
||||
// persist
|
||||
getConnectorService().addCommunicationsListener(this);
|
||||
}
|
||||
children.add(element);
|
||||
synchronized (children) {
|
||||
children.add(element);
|
||||
}
|
||||
Display.getDefault().asyncExec(new Refresh(this));
|
||||
}
|
||||
|
||||
public void removeChild(TerminalElement element) {
|
||||
if (children != null) {
|
||||
children.remove(element);
|
||||
}
|
||||
if (children == null) {
|
||||
getConnectorService().removeCommunicationsListener(this);
|
||||
}
|
||||
Display.getDefault().asyncExec(new Refresh(this));
|
||||
synchronized (children) {
|
||||
if (children.size() > 0) {
|
||||
children.remove(element);
|
||||
}
|
||||
}
|
||||
Display.getDefault().asyncExec(new Refresh(this));
|
||||
}
|
||||
|
||||
public void removeChild(String terminalTitle) {
|
||||
if (children != null) {
|
||||
if (children.size() > 0) {
|
||||
TerminalElement element = getChild(terminalTitle);
|
||||
if (element != null){
|
||||
children.remove(element);
|
||||
if (children == null) {
|
||||
getConnectorService().removeCommunicationsListener(this);
|
||||
}
|
||||
synchronized (children) {
|
||||
children.remove(element);
|
||||
}
|
||||
Display.getDefault().asyncExec(new Refresh(this));
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +160,7 @@ public final class TerminalServiceSubSystem extends SubSystem implements
|
|||
try {
|
||||
removeTerminalElement(element);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
RSECorePlugin.getDefault().getLogger().logError("Error removing terminal", e); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* 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;
|
||||
|
||||
|
@ -14,6 +15,7 @@ import java.io.InputStream;
|
|||
import java.io.InterruptedIOException;
|
||||
|
||||
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.ITerminalService;
|
||||
import org.eclipse.rse.internal.terminals.ui.TerminalServiceHelper;
|
||||
|
@ -53,9 +55,8 @@ public class RSETerminalConnectionThread extends Thread {
|
|||
}
|
||||
fConn.setInputStream(shell.getInputStream());
|
||||
fConn.setOutputStream(shell.getOutputStream());
|
||||
} catch (SystemMessageException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
} catch (SystemMessageException e) {
|
||||
RSECorePlugin.getDefault().getLogger().logError("Error launching terminal", e); //$NON-NLS-1$
|
||||
}
|
||||
fConn.setTerminalHostShell(shell);
|
||||
fControl.setState(TerminalState.CONNECTED);
|
||||
|
@ -69,8 +70,7 @@ public class RSETerminalConnectionThread extends Thread {
|
|||
} catch (InterruptedIOException e) {
|
||||
// we got interrupted: we are done...
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
RSECorePlugin.getDefault().getLogger().logError("Error while reading data", e); //$NON-NLS-1$
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
// when reading is done, we set the state to closed
|
||||
|
@ -82,16 +82,6 @@ public class RSETerminalConnectionThread extends Thread {
|
|||
*/
|
||||
void disconnect() {
|
||||
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:
|
||||
* Anna Dushistova (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
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.internal.terminals.ui.views;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.internal.services.terminals.ITerminalShell;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl;
|
||||
|
@ -42,7 +44,7 @@ public class RSETerminalConnectorImpl extends TerminalConnectorImpl {
|
|||
try {
|
||||
getInputStream().close();
|
||||
} 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 {
|
||||
getTerminalToRemoteStream().close();
|
||||
} 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
|
||||
* Yu-Fen Kuo (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;
|
||||
|
||||
|
@ -38,8 +39,6 @@ import org.eclipse.rse.core.events.ISystemResourceChangeListener;
|
|||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
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.model.ISystemShellProvider;
|
||||
import org.eclipse.rse.ui.view.IRSEViewPart;
|
||||
|
@ -69,9 +68,6 @@ public class TerminalViewer extends ViewPart implements ISelectionListener,
|
|||
.getSelectionService();
|
||||
selectionService.addSelectionListener(this);
|
||||
|
||||
SystemWidgetHelpers.setHelp(tabFolder, RSEUIPlugin.HELPPREFIX
|
||||
+ "ucmd0000"); //$NON-NLS-1$
|
||||
|
||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||
|
||||
registry.addSystemResourceChangeListener(this);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||
* 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;
|
||||
|
@ -56,7 +57,6 @@ public class TerminalsUI {
|
|||
viewer = (TerminalViewer) page.showView(TerminalViewer.VIEW_ID);
|
||||
page.bringToTop(viewer);
|
||||
} catch (PartInitException e) {
|
||||
e.printStackTrace();
|
||||
SystemBasePlugin.logError(Activator
|
||||
.getResourceString("TerminalsUI.cannotOpenView.error"), e); //$NON-NLS-1$
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue