mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
[225510][api] Fix OutputRefreshJob API leakage
This commit is contained in:
parent
a7c5de4b79
commit
c2d0336a1b
6 changed files with 171 additions and 196 deletions
|
@ -1,18 +1,18 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
||||||
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
protected IRemoteCmdSubSystem _cmdSubSystem;
|
protected IRemoteCmdSubSystem _cmdSubSystem;
|
||||||
protected ArrayList _cmdHistory;
|
protected ArrayList _cmdHistory;
|
||||||
protected IProject _project;
|
protected IProject _project;
|
||||||
|
|
||||||
public RemoteCommandShell(IRemoteCmdSubSystem cmdSubSystem)
|
public RemoteCommandShell(IRemoteCmdSubSystem cmdSubSystem)
|
||||||
{
|
{
|
||||||
_output = new ArrayList();
|
_output = new ArrayList();
|
||||||
|
@ -61,13 +61,13 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
if (_id == null)
|
if (_id == null)
|
||||||
{
|
{
|
||||||
IRemoteCmdSubSystem subSystem = getCommandSubSystem();
|
IRemoteCmdSubSystem subSystem = getCommandSubSystem();
|
||||||
|
@ -75,12 +75,12 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
String name = connection.getAliasName();
|
String name = connection.getAliasName();
|
||||||
|
|
||||||
IRemoteCommandShell[] shells = subSystem.getShells();
|
IRemoteCommandShell[] shells = subSystem.getShells();
|
||||||
|
|
||||||
List currentNames = new ArrayList();
|
List currentNames = new ArrayList();
|
||||||
for (int i = 0; i < shells.length; i++)
|
for (int i = 0; i < shells.length; i++)
|
||||||
{
|
{
|
||||||
IRemoteCommandShell shell = shells[i];
|
IRemoteCommandShell shell = shells[i];
|
||||||
if (shell != this)
|
if (shell != this)
|
||||||
{
|
{
|
||||||
// DKM - noticed that this caused a stack overflow in one scenario
|
// DKM - noticed that this caused a stack overflow in one scenario
|
||||||
if (shell instanceof RemoteCommandShell)
|
if (shell instanceof RemoteCommandShell)
|
||||||
|
@ -89,7 +89,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentNames.size() > 0)
|
if (currentNames.size() > 0)
|
||||||
{
|
{
|
||||||
int number = 2;
|
int number = 2;
|
||||||
String newName = name + " " + number; //$NON-NLS-1$
|
String newName = name + " " + number; //$NON-NLS-1$
|
||||||
|
@ -180,7 +180,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
public IRemoteCmdSubSystem getCommandSubSystem()
|
public IRemoteCmdSubSystem getCommandSubSystem()
|
||||||
{
|
{
|
||||||
if (_cmdSubSystem == null)
|
if (_cmdSubSystem == null)
|
||||||
{
|
{
|
||||||
if (_fileSubSystem != null)
|
if (_fileSubSystem != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -190,7 +190,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
ISubSystem[] sses = sr.getSubSystems(host);
|
ISubSystem[] sses = sr.getSubSystems(host);
|
||||||
for (int i = 0; i < sses.length; i++)
|
for (int i = 0; i < sses.length; i++)
|
||||||
{
|
{
|
||||||
if (sses[i] instanceof IRemoteCmdSubSystem)
|
if (sses[i] instanceof IRemoteCmdSubSystem)
|
||||||
{
|
{
|
||||||
IRemoteCmdSubSystem cmdSubSystem = (RemoteCmdSubSystem)sses[i];
|
IRemoteCmdSubSystem cmdSubSystem = (RemoteCmdSubSystem)sses[i];
|
||||||
_cmdSubSystem = cmdSubSystem;
|
_cmdSubSystem = cmdSubSystem;
|
||||||
|
@ -221,7 +221,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
public abstract boolean isActive();
|
public abstract boolean isActive();
|
||||||
|
|
||||||
public void updateHistory(String cmd)
|
public void updateHistory(String cmd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
String text = cmd;
|
String text = cmd;
|
||||||
int tagIndex = text.indexOf("BEGIN-END-TAG");
|
int tagIndex = text.indexOf("BEGIN-END-TAG");
|
||||||
|
@ -249,7 +249,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
}
|
}
|
||||||
return cmds;
|
return cmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current working directory for this command
|
* Get the current working directory for this command
|
||||||
|
@ -259,7 +259,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
{
|
{
|
||||||
return _cwd;
|
return _cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the context of this Shell as a String for persistence.
|
* Returns the context of this Shell as a String for persistence.
|
||||||
* The context is typically the current working directory.
|
* The context is typically the current working directory.
|
||||||
|
@ -275,7 +275,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current working directory for this command
|
* Get the current working directory for this command
|
||||||
* @return the current working directory
|
* @return the current working directory
|
||||||
|
@ -284,38 +284,39 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
{
|
{
|
||||||
return _cwd;
|
return _cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current working directory for this command
|
* Set the current working directory for this command
|
||||||
* @param file
|
*
|
||||||
|
* @param file the working directory.
|
||||||
*/
|
*/
|
||||||
public void setWorkingDirectory(IRemoteFile file)
|
public void setWorkingDirectory(IRemoteFile file)
|
||||||
{
|
{
|
||||||
_cwd = file;
|
_cwd = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isWindows()
|
protected boolean isWindows()
|
||||||
{
|
{
|
||||||
return getCommandSubSystem().getHost().getSystemType().isWindows();
|
return getCommandSubSystem().getHost().getSystemType().isWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override to provide a list of possible commands
|
* Override to provide a list of possible commands
|
||||||
*/
|
*/
|
||||||
public abstract ICandidateCommand[] getCandidateCommands();
|
public abstract ICandidateCommand[] getCandidateCommands();
|
||||||
|
|
||||||
|
|
||||||
public void associateProject(IProject project)
|
public void associateProject(IProject project)
|
||||||
{
|
{
|
||||||
_project = project;
|
_project = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IProject getAssociatedProject()
|
public IProject getAssociatedProject()
|
||||||
{
|
{
|
||||||
return _project;
|
return _project;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,12 +7,12 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem;
|
package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem;
|
||||||
|
@ -34,14 +34,14 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
|
||||||
public class ServiceCommandShell extends RemoteCommandShell implements IServiceCommandShell
|
public class ServiceCommandShell extends RemoteCommandShell implements IServiceCommandShell
|
||||||
{
|
{
|
||||||
protected IHostShell _hostShell;
|
protected IHostShell _hostShell;
|
||||||
protected OutputRefreshJob _lastRefreshJob;
|
private OutputRefreshJob _lastRefreshJob;
|
||||||
public ServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
public ServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
||||||
{
|
{
|
||||||
super(cmdSS);
|
super(cmdSS);
|
||||||
_hostShell = hostShell;
|
_hostShell = hostShell;
|
||||||
setType(ShellStrings.RESID_SHELLS_COMMAND_SHELL_LABEL);
|
setType(ShellStrings.RESID_SHELLS_COMMAND_SHELL_LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
return getId();
|
return getId();
|
||||||
|
@ -57,7 +57,7 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
|
||||||
{
|
{
|
||||||
return _hostShell;
|
return _hostShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||||
|
@ -75,7 +75,7 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
|
||||||
String type = event.isError() ? "stderr" : "stdout"; //$NON-NLS-1$ //$NON-NLS-2$
|
String type = event.isError() ? "stderr" : "stdout"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
if (event.isError())
|
if (event.isError())
|
||||||
{
|
{
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -83,11 +83,12 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
|
||||||
}
|
}
|
||||||
String str = line.getString();
|
String str = line.getString();
|
||||||
output.setText(str);
|
output.setText(str);
|
||||||
|
|
||||||
addOutput(output);
|
addOutput(output);
|
||||||
outputs[i] = output;
|
outputs[i] = output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// FIXME unify with notifyListeners() below?
|
||||||
if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
||||||
{
|
{
|
||||||
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
|
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
|
||||||
|
@ -98,7 +99,26 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
|
||||||
_lastRefreshJob.addOutputs(outputs);
|
_lastRefreshJob.addOutputs(outputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify listeners about new outputs. This will update any shell views with
|
||||||
|
* the new data.
|
||||||
|
*
|
||||||
|
* @param outputs the output objects to notify
|
||||||
|
* @param cwdChanged <code>true</code> if the current directory changed
|
||||||
|
* @since org.eclipse.rse.subsystems.shells.core 3.0
|
||||||
|
*/
|
||||||
|
protected void notifyOutputChanged(IRemoteOutput[] outputs, boolean cwdChanged) {
|
||||||
|
// if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
||||||
|
{
|
||||||
|
_lastRefreshJob = new OutputRefreshJob(this, outputs, cwdChanged);
|
||||||
|
_lastRefreshJob.schedule();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* else { _lastRefreshJob.addOutputs(outputs);
|
||||||
|
* _lastRefreshJob.schedule(); }
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public ICandidateCommand[] getCandidateCommands()
|
public ICandidateCommand[] getCandidateCommands()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,13 +7,13 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* David McKnight (IBM) - [202822] cleanup output datalements after use
|
||||||
* David McKnight (IBM) - [202822] cleanup output datalements after use
|
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.shells.dstore;
|
package org.eclipse.rse.internal.subsystems.shells.dstore;
|
||||||
|
@ -26,7 +26,6 @@ import org.eclipse.dstore.extra.IDomainListener;
|
||||||
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostOutput;
|
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostOutput;
|
||||||
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostShell;
|
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostShell;
|
||||||
import org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader;
|
import org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader;
|
||||||
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
|
|
||||||
import org.eclipse.rse.services.shells.IHostOutput;
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
import org.eclipse.rse.services.shells.IHostShell;
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
||||||
|
@ -45,21 +44,21 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
private DataElement _status;
|
private DataElement _status;
|
||||||
private DataStore _ds;
|
private DataStore _ds;
|
||||||
private boolean _done = false;
|
private boolean _done = false;
|
||||||
|
|
||||||
public CleanUpSpirited(DataElement status, String name)
|
public CleanUpSpirited(DataElement status, String name)
|
||||||
{
|
{
|
||||||
_status = status;
|
_status = status;
|
||||||
_ds = status.getDataStore();
|
_ds = status.getDataStore();
|
||||||
_ds.getDomainNotifier().addDomainListener(this);
|
_ds.getDomainNotifier().addDomainListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void domainChanged(DomainEvent e)
|
public void domainChanged(DomainEvent e)
|
||||||
{
|
{
|
||||||
deleteElements();
|
deleteElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
while (!_done)
|
while (!_done)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -67,12 +66,12 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
deleteElements();
|
deleteElements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteElements()
|
private void deleteElements()
|
||||||
{
|
{
|
||||||
if (_status.getNestedSize() > 0)
|
if (_status.getNestedSize() > 0)
|
||||||
|
@ -84,13 +83,13 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
{
|
{
|
||||||
// delete
|
// delete
|
||||||
_ds.deleteObjects(_status);
|
_ds.deleteObjects(_status);
|
||||||
_ds.refresh(_status);
|
_ds.refresh(_status);
|
||||||
|
|
||||||
_ds.getDomainNotifier().removeDomainListener(this);
|
_ds.getDomainNotifier().removeDomainListener(this);
|
||||||
_done = true;
|
_done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Shell getShell() {
|
public Shell getShell() {
|
||||||
|
@ -103,9 +102,9 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DStoreServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
public DStoreServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
||||||
{
|
{
|
||||||
super(cmdSS, hostShell);
|
super(cmdSS, hostShell);
|
||||||
|
@ -127,12 +126,12 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContextString()
|
public String getContextString()
|
||||||
{
|
{
|
||||||
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
||||||
|
@ -155,20 +154,20 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
String src = line.getSource();
|
String src = line.getSource();
|
||||||
if (event.isError())
|
if (event.isError())
|
||||||
{
|
{
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = new RemoteOutput(this, type);
|
output = new RemoteOutput(this, type);
|
||||||
}
|
}
|
||||||
output.setText(line.getName());
|
output.setText(line.getName());
|
||||||
|
|
||||||
int colonSep = src.indexOf(':');
|
int colonSep = src.indexOf(':');
|
||||||
// line numbers
|
// line numbers
|
||||||
if (colonSep > 0)
|
if (colonSep > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
String lineNo = src.substring(colonSep + 1);
|
String lineNo = src.substring(colonSep + 1);
|
||||||
String file = src.substring(0, colonSep);
|
String file = src.substring(0, colonSep);
|
||||||
int linen = 0;
|
int linen = 0;
|
||||||
|
@ -178,7 +177,7 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
if (linen != 0)
|
if (linen != 0)
|
||||||
{
|
{
|
||||||
|
@ -188,33 +187,22 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output.setAbsolutePath(src);
|
output.setAbsolutePath(src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output.setAbsolutePath(src);
|
output.setAbsolutePath(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addOutput(output);
|
addOutput(output);
|
||||||
outputs[i] = output;
|
outputs[i] = output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
notifyOutputChanged(outputs, false);
|
||||||
{
|
|
||||||
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_lastRefreshJob.addOutputs(outputs);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive()
|
public boolean isActive()
|
||||||
{
|
{
|
||||||
boolean activeShell = _hostShell.isActive();
|
boolean activeShell = _hostShell.isActive();
|
||||||
if (!activeShell)
|
if (!activeShell)
|
||||||
|
@ -223,13 +211,13 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
if (_output.size() < status.getNestedSize())
|
if (_output.size() < status.getNestedSize())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return activeShell;
|
return activeShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeOutput()
|
public void removeOutput()
|
||||||
{
|
{
|
||||||
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
||||||
DataElement status = shell.getStatus();
|
DataElement status = shell.getStatus();
|
||||||
DataStore ds = status.getDataStore();
|
DataStore ds = status.getDataStore();
|
||||||
|
@ -240,8 +228,8 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
if (!ds.isConnected())
|
if (!ds.isConnected())
|
||||||
{
|
{
|
||||||
status.removeNestedData();
|
status.removeNestedData();
|
||||||
}
|
}
|
||||||
else if (status.get(ssize - 1).isSpirit() || !ds.isDoSpirit())
|
else if (status.get(ssize - 1).isSpirit() || !ds.isDoSpirit())
|
||||||
{
|
{
|
||||||
// objects can be deleted directly at this point since there will be no more updates from the server
|
// objects can be deleted directly at this point since there will be no more updates from the server
|
||||||
ds.deleteObjects(status);
|
ds.deleteObjects(status);
|
||||||
|
@ -252,19 +240,19 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
// cleanup later
|
// cleanup later
|
||||||
// objects need to be deleted later since the server will still be sending spirited update
|
// objects need to be deleted later since the server will still be sending spirited update
|
||||||
// if we don't defer this, then the deleted elements would get recreated when the spirits are updated
|
// if we don't defer this, then the deleted elements would get recreated when the spirits are updated
|
||||||
CleanUpSpirited cleanUp = new CleanUpSpirited(status, getId());
|
CleanUpSpirited cleanUp = new CleanUpSpirited(status, getId());
|
||||||
cleanUp.start();
|
cleanUp.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
synchronized(_output)
|
synchronized(_output)
|
||||||
{
|
{
|
||||||
_output.clear();
|
_output.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,12 +7,12 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.shells.local.model;
|
package org.eclipse.rse.internal.subsystems.shells.local.model;
|
||||||
|
@ -22,7 +22,6 @@ import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
|
|
||||||
import org.eclipse.rse.services.shells.IHostOutput;
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
import org.eclipse.rse.services.shells.IHostShell;
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
||||||
|
@ -41,7 +40,7 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
private Patterns _patterns;
|
private Patterns _patterns;
|
||||||
private String _workingDir;
|
private String _workingDir;
|
||||||
private IRemoteFileSubSystem _fs;
|
private IRemoteFileSubSystem _fs;
|
||||||
|
|
||||||
public LocalServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
public LocalServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
||||||
{
|
{
|
||||||
super(cmdSS, hostShell);
|
super(cmdSS, hostShell);
|
||||||
|
@ -67,19 +66,19 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContextString()
|
public String getContextString()
|
||||||
{
|
{
|
||||||
return _workingDir;
|
return _workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||||
{
|
{
|
||||||
IHostOutput[] lines = event.getLines();
|
IHostOutput[] lines = event.getLines();
|
||||||
|
@ -88,16 +87,16 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
{
|
{
|
||||||
String line = lines[i].getString();
|
String line = lines[i].getString();
|
||||||
ParsedOutput parsedMsg = null;
|
ParsedOutput parsedMsg = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parsedMsg = _patterns.matchLine(line);
|
parsedMsg = _patterns.matchLine(line);
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteOutput output = null;
|
RemoteOutput output = null;
|
||||||
String type = "stdout"; //$NON-NLS-1$
|
String type = "stdout"; //$NON-NLS-1$
|
||||||
if (parsedMsg != null)
|
if (parsedMsg != null)
|
||||||
|
@ -111,7 +110,7 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
if (event.isError())
|
if (event.isError())
|
||||||
{
|
{
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = new RemoteOutput(this, type);
|
output = new RemoteOutput(this, type);
|
||||||
|
@ -119,7 +118,7 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
|
|
||||||
output.setText(line);
|
output.setText(line);
|
||||||
if (parsedMsg != null)
|
if (parsedMsg != null)
|
||||||
{
|
{
|
||||||
String file = parsedMsg.file;
|
String file = parsedMsg.file;
|
||||||
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
||||||
{
|
{
|
||||||
|
@ -137,29 +136,18 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
output.setAbsolutePath(_workingDir + File.separatorChar + file);
|
output.setAbsolutePath(_workingDir + File.separatorChar + file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addOutput(output);
|
addOutput(output);
|
||||||
outputs[i] = output;
|
outputs[i] = output;
|
||||||
}
|
}
|
||||||
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
notifyOutputChanged(outputs, false);
|
||||||
{
|
|
||||||
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_lastRefreshJob.addOutputs(outputs);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToShell(String cmd)
|
public void writeToShell(String cmd)
|
||||||
{
|
{
|
||||||
_patterns.update(cmd);
|
_patterns.update(cmd);
|
||||||
super.writeToShell(cmd);
|
super.writeToShell(cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,12 +7,13 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
|
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
|
||||||
|
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.subsystems.shells.ssh;
|
package org.eclipse.rse.internal.subsystems.shells.ssh;
|
||||||
|
@ -26,7 +27,6 @@ import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.internal.services.ssh.shell.SshHostShell;
|
import org.eclipse.rse.internal.services.ssh.shell.SshHostShell;
|
||||||
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
|
|
||||||
import org.eclipse.rse.services.shells.IHostOutput;
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
import org.eclipse.rse.services.shells.IHostShell;
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
||||||
|
@ -46,7 +46,7 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
private String _curCommand;
|
private String _curCommand;
|
||||||
private String _workingDir;
|
private String _workingDir;
|
||||||
private IRemoteFileSubSystem _fs;
|
private IRemoteFileSubSystem _fs;
|
||||||
|
|
||||||
public SshServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
public SshServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
|
||||||
{
|
{
|
||||||
super(cmdSS, hostShell);
|
super(cmdSS, hostShell);
|
||||||
|
@ -72,13 +72,13 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContextString()
|
public String getContextString()
|
||||||
{
|
{
|
||||||
return _workingDir;
|
return _workingDir;
|
||||||
|
@ -95,27 +95,27 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
if (line.endsWith(getPromptCommand())) {
|
if (line.endsWith(getPromptCommand())) {
|
||||||
continue; //ignore our synthetic prompt command
|
continue; //ignore our synthetic prompt command
|
||||||
}
|
}
|
||||||
|
|
||||||
ParsedOutput parsedMsg = null;
|
ParsedOutput parsedMsg = null;
|
||||||
if (!gotCommand && line.equals(_curCommand)) {
|
if (!gotCommand && line.equals(_curCommand)) {
|
||||||
gotCommand = true;
|
gotCommand = true;
|
||||||
continue; //ignore remote command echo
|
continue; //ignore remote command echo
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Bug 160202: Remote shell dies.
|
// Bug 160202: Remote shell dies.
|
||||||
if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
|
if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
|
||||||
parsedMsg = _patterns.matchLine(line);
|
parsedMsg = _patterns.matchLine(line);
|
||||||
|
|
||||||
// Bug 160202: Remote shell dies.
|
// Bug 160202: Remote shell dies.
|
||||||
if (_curCommand != null) {
|
if (_curCommand != null) {
|
||||||
String temp = _curCommand.trim();
|
String temp = _curCommand.trim();
|
||||||
StringTokenizer tokenizer = new StringTokenizer(temp);
|
StringTokenizer tokenizer = new StringTokenizer(temp);
|
||||||
|
|
||||||
if (tokenizer.countTokens() == 2) {
|
if (tokenizer.countTokens() == 2) {
|
||||||
String token1 = tokenizer.nextToken();
|
String token1 = tokenizer.nextToken();
|
||||||
String token2 = tokenizer.nextToken();
|
String token2 = tokenizer.nextToken();
|
||||||
|
|
||||||
if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
|
if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
|
||||||
if (line.startsWith("total")) { //$NON-NLS-1$
|
if (line.startsWith("total")) { //$NON-NLS-1$
|
||||||
parsedMsg = null;
|
parsedMsg = null;
|
||||||
|
@ -129,25 +129,25 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteOutput output = null;
|
RemoteOutput output = null;
|
||||||
|
|
||||||
String type = "stdout"; //$NON-NLS-1$
|
String type = "stdout"; //$NON-NLS-1$
|
||||||
|
|
||||||
if (parsedMsg != null) {
|
if (parsedMsg != null) {
|
||||||
type = parsedMsg.type;
|
type = parsedMsg.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isError()) {
|
if (event.isError()) {
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
output = new RemoteOutput(this, type);
|
output = new RemoteOutput(this, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.setText(line);
|
output.setText(line);
|
||||||
if (parsedMsg != null)
|
if (parsedMsg != null)
|
||||||
{
|
{
|
||||||
String file = parsedMsg.file;
|
String file = parsedMsg.file;
|
||||||
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
||||||
{
|
{
|
||||||
|
@ -164,29 +164,18 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
output.setAbsolutePath(file);
|
output.setAbsolutePath(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addOutput(output);
|
addOutput(output);
|
||||||
outputs.add(output);
|
outputs.add(output);
|
||||||
}
|
}
|
||||||
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
|
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
|
||||||
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
notifyOutputChanged(remoteOutputs, false);
|
||||||
{
|
|
||||||
_lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_lastRefreshJob.addOutputs(remoteOutputs);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the prompt command, such that lines ending with the
|
* Return the prompt command, such that lines ending with the
|
||||||
* prompt command can be removed from output.
|
* prompt command can be removed from output.
|
||||||
* Should be overridden in case the IHostShell used for this
|
* Should be overridden in case the IHostShell used for this
|
||||||
* service is not an SshHostShell.
|
* service is not an SshHostShell.
|
||||||
* @return String promptCommand
|
* @return String promptCommand
|
||||||
*/
|
*/
|
||||||
|
@ -207,5 +196,5 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
super.writeToShell(cmd);
|
super.writeToShell(cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 IBM Corporation and others.
|
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,13 +7,14 @@
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
|
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
|
||||||
* Sheldon D'souza (Celunite) - Adapted from SshServiceCommandShell
|
* Sheldon D'souza (Celunite) - Adapted from SshServiceCommandShell
|
||||||
|
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.subsystems.shells.telnet;
|
package org.eclipse.rse.internal.subsystems.shells.telnet;
|
||||||
|
|
||||||
|
@ -25,7 +26,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.internal.services.telnet.shell.TelnetHostShell;
|
import org.eclipse.rse.internal.services.telnet.shell.TelnetHostShell;
|
||||||
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
|
|
||||||
import org.eclipse.rse.services.shells.IHostOutput;
|
import org.eclipse.rse.services.shells.IHostOutput;
|
||||||
import org.eclipse.rse.services.shells.IHostShell;
|
import org.eclipse.rse.services.shells.IHostShell;
|
||||||
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
|
||||||
|
@ -45,7 +45,7 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
private String _curCommand;
|
private String _curCommand;
|
||||||
private String _workingDir;
|
private String _workingDir;
|
||||||
private IRemoteFileSubSystem _fs;
|
private IRemoteFileSubSystem _fs;
|
||||||
|
|
||||||
public TelnetServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) {
|
public TelnetServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) {
|
||||||
super(cmdSS, hostShell);
|
super(cmdSS, hostShell);
|
||||||
_patterns = new Patterns();
|
_patterns = new Patterns();
|
||||||
|
@ -70,7 +70,7 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -88,27 +88,27 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
if (line.endsWith(getPromptCommand())) {
|
if (line.endsWith(getPromptCommand())) {
|
||||||
continue; //ignore our synthetic prompt command
|
continue; //ignore our synthetic prompt command
|
||||||
}
|
}
|
||||||
|
|
||||||
ParsedOutput parsedMsg = null;
|
ParsedOutput parsedMsg = null;
|
||||||
if (!gotCommand && line.equals(_curCommand)) {
|
if (!gotCommand && line.equals(_curCommand)) {
|
||||||
gotCommand = true;
|
gotCommand = true;
|
||||||
continue; //ignore remote command echo
|
continue; //ignore remote command echo
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Bug 160202: Remote shell dies.
|
// Bug 160202: Remote shell dies.
|
||||||
if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
|
if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$
|
||||||
parsedMsg = _patterns.matchLine(line);
|
parsedMsg = _patterns.matchLine(line);
|
||||||
|
|
||||||
// Bug 160202: Remote shell dies.
|
// Bug 160202: Remote shell dies.
|
||||||
if (_curCommand != null) {
|
if (_curCommand != null) {
|
||||||
String temp = _curCommand.trim();
|
String temp = _curCommand.trim();
|
||||||
StringTokenizer tokenizer = new StringTokenizer(temp);
|
StringTokenizer tokenizer = new StringTokenizer(temp);
|
||||||
|
|
||||||
if (tokenizer.countTokens() == 2) {
|
if (tokenizer.countTokens() == 2) {
|
||||||
String token1 = tokenizer.nextToken();
|
String token1 = tokenizer.nextToken();
|
||||||
String token2 = tokenizer.nextToken();
|
String token2 = tokenizer.nextToken();
|
||||||
|
|
||||||
if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
|
if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$
|
||||||
if (line.startsWith("total")) { //$NON-NLS-1$
|
if (line.startsWith("total")) { //$NON-NLS-1$
|
||||||
parsedMsg = null;
|
parsedMsg = null;
|
||||||
|
@ -122,25 +122,25 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteOutput output = null;
|
RemoteOutput output = null;
|
||||||
|
|
||||||
String type = "stdout"; //$NON-NLS-1$
|
String type = "stdout"; //$NON-NLS-1$
|
||||||
|
|
||||||
if (parsedMsg != null) {
|
if (parsedMsg != null) {
|
||||||
type = parsedMsg.type;
|
type = parsedMsg.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isError()) {
|
if (event.isError()) {
|
||||||
output = new RemoteError(this, type);
|
output = new RemoteError(this, type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
output = new RemoteOutput(this, type);
|
output = new RemoteOutput(this, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.setText(line);
|
output.setText(line);
|
||||||
if (parsedMsg != null)
|
if (parsedMsg != null)
|
||||||
{
|
{
|
||||||
String file = parsedMsg.file;
|
String file = parsedMsg.file;
|
||||||
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT))
|
||||||
{
|
{
|
||||||
|
@ -157,29 +157,18 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
|
||||||
output.setAbsolutePath(file);
|
output.setAbsolutePath(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addOutput(output);
|
addOutput(output);
|
||||||
outputs.add(output);
|
outputs.add(output);
|
||||||
}
|
}
|
||||||
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
|
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
|
||||||
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
|
notifyOutputChanged(remoteOutputs, false);
|
||||||
{
|
|
||||||
_lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_lastRefreshJob.addOutputs(remoteOutputs);
|
|
||||||
_lastRefreshJob.schedule();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the prompt command, such that lines ending with the
|
* Return the prompt command, such that lines ending with the
|
||||||
* prompt command can be removed from output.
|
* prompt command can be removed from output.
|
||||||
* Should be overridden in case the IHostShell used for this
|
* Should be overridden in case the IHostShell used for this
|
||||||
* service is not an TelnetHostShell.
|
* service is not an TelnetHostShell.
|
||||||
* @return String promptCommand
|
* @return String promptCommand
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue