mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +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;
|
||||
}
|
||||
|
||||
public String getContextString()
|
||||
{
|
||||
return _cwd.getAbsolutePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current working directory for this command
|
||||
* @return the current working directory
|
||||
|
|
|
@ -65,7 +65,14 @@ public interface IRemoteCommandShell
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -586,12 +586,10 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
IRemoteCommandShell cmd = (IRemoteCommandShell) cmdShells.get(i);
|
||||
if (cmd.isActive())
|
||||
{
|
||||
Object context = cmd.getContext();
|
||||
if (context instanceof IRemoteFile)
|
||||
Object context = cmd.getContextString();
|
||||
if (context instanceof String)
|
||||
{
|
||||
IRemoteFile pwdf = (IRemoteFile) context;
|
||||
String pwd = pwdf.getAbsolutePath();
|
||||
shellBuffer.append(pwd);
|
||||
shellBuffer.append(context);
|
||||
gotShell = true;
|
||||
}
|
||||
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.IHostShell;
|
||||
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.RemoteOutput;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
|
||||
|
@ -47,14 +48,24 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
|
|||
{
|
||||
try
|
||||
{
|
||||
return getFileSubSystem().getRemoteFileObject(workingDir);
|
||||
IRemoteFileSubSystem ss = getFileSubSystem();
|
||||
if (ss.isConnected())
|
||||
{
|
||||
return ss.getRemoteFileObject(workingDir);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public String getContextString()
|
||||
{
|
||||
DStoreHostShell shell = (DStoreHostShell)getHostShell();
|
||||
DStoreShellOutputReader reader = (DStoreShellOutputReader)shell.getStandardOutputReader();
|
||||
return reader.getWorkingDirectory();
|
||||
}
|
||||
|
||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||
|
|
|
@ -69,7 +69,11 @@ public class LocalServiceCommandShell extends ServiceCommandShell
|
|||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public String getContextString()
|
||||
{
|
||||
return _workingDir;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,6 +77,11 @@ public class SshServiceCommandShell extends ServiceCommandShell
|
|||
return null;
|
||||
|
||||
}
|
||||
|
||||
public String getContextString()
|
||||
{
|
||||
return _workingDir;
|
||||
}
|
||||
|
||||
public void shellOutputChanged(IHostShellChangeEvent event)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue