mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-18 05:35:45 +02:00
[181069] can't do a query to get context for saving shell states. Need a new API for IRemoteCommandShell to getContextString() so that a query can be avoided at this point.
This commit is contained in:
parent
3b85d3f712
commit
8af84a782b
6 changed files with 39 additions and 9 deletions
|
@ -258,6 +258,11 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
|
||||||
return _cwd;
|
return _cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getContextString()
|
||||||
|
{
|
||||||
|
return _cwd.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|
|
@ -65,7 +65,14 @@ public interface IRemoteCommandShell
|
||||||
*/
|
*/
|
||||||
public Object getContext();
|
public Object getContext();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current context for this command shell as a string. Unlike getContext(), this method
|
||||||
|
* simply returns a string representation of the context (so that no query is required to get the
|
||||||
|
* working directory).
|
||||||
|
* @return the context as a string
|
||||||
|
*/
|
||||||
|
public String getContextString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of output objects for this command.
|
* Return the number of output objects for this command.
|
||||||
* @return the number of output objects
|
* @return the number of output objects
|
||||||
|
|
|
@ -586,12 +586,10 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
||||||
IRemoteCommandShell cmd = (IRemoteCommandShell) cmdShells.get(i);
|
IRemoteCommandShell cmd = (IRemoteCommandShell) cmdShells.get(i);
|
||||||
if (cmd.isActive())
|
if (cmd.isActive())
|
||||||
{
|
{
|
||||||
Object context = cmd.getContext();
|
Object context = cmd.getContextString();
|
||||||
if (context instanceof IRemoteFile)
|
if (context instanceof String)
|
||||||
{
|
{
|
||||||
IRemoteFile pwdf = (IRemoteFile) context;
|
shellBuffer.append(context);
|
||||||
String pwd = pwdf.getAbsolutePath();
|
|
||||||
shellBuffer.append(pwd);
|
|
||||||
gotShell = true;
|
gotShell = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefresh
|
||||||
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;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
import org.eclipse.rse.subsystems.shells.core.model.RemoteError;
|
import org.eclipse.rse.subsystems.shells.core.model.RemoteError;
|
||||||
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
|
import org.eclipse.rse.subsystems.shells.core.model.RemoteOutput;
|
||||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||||
|
@ -47,14 +48,24 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return getFileSubSystem().getRemoteFileObject(workingDir);
|
IRemoteFileSubSystem ss = getFileSubSystem();
|
||||||
|
if (ss.isConnected())
|
||||||
|
{
|
||||||
|
return ss.getRemoteFileObject(workingDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContextString()
|
||||||
|
{
|
||||||
|
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
||||||
|
DStoreShellOutputReader reader = (DStoreShellOutputReader)shell.getStandardOutputReader();
|
||||||
|
return reader.getWorkingDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||||
|
|
|
@ -69,7 +69,11 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContextString()
|
||||||
|
{
|
||||||
|
return _workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,11 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getContextString()
|
||||||
|
{
|
||||||
|
return _workingDir;
|
||||||
|
}
|
||||||
|
|
||||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue