mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
[431378] [shells] Remote shells not always restored properly on
reconnect
This commit is contained in:
parent
b6ef45d1b0
commit
c93a4bbe65
4 changed files with 40 additions and 41 deletions
|
@ -15,6 +15,7 @@
|
|||
* David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
|
||||
* David McKnight (IBM) - [338031] Remote Shell view tabs should have close (x) icon
|
||||
* David McKnight (IBM) -[425014] profile commit job don't always complete during shutdown
|
||||
* David McKnight (IBM) -[431378] [shells] Remote shells not always restored properly on reconnect
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.shells.ui.view;
|
||||
|
@ -180,7 +181,8 @@ public class CommandsViewWorkbook extends Composite
|
|||
for (int i = 0; i < _folder.getItemCount(); i++)
|
||||
{
|
||||
CTabItem item = _folder.getItem(i);
|
||||
CommandsViewPage page = (CommandsViewPage) item.getData();
|
||||
Object data = item.getData();
|
||||
CommandsViewPage page = (CommandsViewPage)data;
|
||||
if (page != null && root == page.getInput())
|
||||
{
|
||||
if (!root.isActive())
|
||||
|
@ -192,14 +194,6 @@ public class CommandsViewWorkbook extends Composite
|
|||
|
||||
page.updateOutput();
|
||||
|
||||
/* DKM - changing focus can get annoying
|
||||
* see defect 142978
|
||||
*
|
||||
if (_folder.getSelectionIndex() != i)
|
||||
{
|
||||
_folder.setSelection(item);
|
||||
}
|
||||
*/
|
||||
updateActionStates();
|
||||
//page.setFocus();
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others. All rights reserved.
|
||||
* Copyright (c) 2002, 2014 IBM Corporation and others. All rights reserved.
|
||||
* 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
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
|
@ -21,6 +21,7 @@
|
|||
* Radoslav Gerganov (ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist
|
||||
* David McKnight (IBM) - [294398] [shells] SystemCommandsViewPart always assumes systemResourceChanged() called on Display thread
|
||||
* David McKnight (IBM) - [351750] [shells] need to check for disposed widget when handling events
|
||||
* David McKnight (IBM) -[431378] [shells] Remote shells not always restored properly on reconnect
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.shells.ui.view;
|
||||
|
@ -727,12 +728,9 @@ public class SystemCommandsViewPart
|
|||
|
||||
protected void restoreCommandShells(IRemoteCmdSubSystem cmdSS)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
IRemoteCommandShell[] cmds = cmdSS.getShells();
|
||||
if (cmds == null || cmds.length == 0)
|
||||
{
|
||||
if (cmds == null || cmds.length == 0){
|
||||
cmds = cmdSS.restoreShellState(getShell());
|
||||
if (cmds!=null)
|
||||
{
|
||||
|
@ -743,11 +741,8 @@ public class SystemCommandsViewPart
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
catch (Exception e){
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -780,8 +775,6 @@ public class SystemCommandsViewPart
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2013 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2014 IBM Corporation and others.
|
||||
* All rights reserved. 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 available at
|
||||
|
@ -32,6 +32,7 @@
|
|||
* Martin Oberhuber (Wind River) - [227135] Cryptic exception when sftp-server is missing
|
||||
* David McKnight (IBM) - [336640] SystemViewRemoteOutputAdapter should not use hard-coded editor id
|
||||
* David McKnight (IBM) - [404310] [shells][performance] view adapter should not query file in getSubSystem()
|
||||
* David McKnight (IBM) -[431378] [shells] Remote shells not always restored properly on reconnect
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.shells.ui.view;
|
||||
|
@ -825,12 +826,22 @@ implements ISystemRemoteElementAdapter
|
|||
ImageDescriptor imageDescriptor = null;
|
||||
if (command.isActive())
|
||||
{
|
||||
if (factoryAdapter == null){ // handle case where adapter not loaded yet
|
||||
imageDescriptor = ShellsUIPlugin.getDefault().getImageDescriptor(ShellsUIPlugin.ICON_SYSTEM_SHELLLIVE_ID);
|
||||
}
|
||||
else {
|
||||
imageDescriptor = factoryAdapter.getActiveCommandShellImageDescriptor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (factoryAdapter == null){ // handle case where adapter not loaded yet
|
||||
imageDescriptor = ShellsUIPlugin.getDefault().getImageDescriptor(ShellsUIPlugin.ICON_SYSTEM_SHELL_ID);
|
||||
}
|
||||
else {
|
||||
imageDescriptor = factoryAdapter.getInactiveCommandShellImageDescriptor();
|
||||
}
|
||||
}
|
||||
return imageDescriptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2014 IBM Corporation and others.
|
||||
* All rights reserved. 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 available at
|
||||
|
@ -25,6 +25,7 @@
|
|||
* David McKnight (IBM) [302724] problems with environment variable substitution
|
||||
* David McKnight (IBM) - [338031] Remote Shell view tabs should have close (x) icon
|
||||
* David McKnight (IBM) - [349491] possible NPE on shutdown due to event firing
|
||||
* David McKnight (IBM) -[431378] [shells] Remote shells not always restored properly on reconnect
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.subsystems.shells.core.subsystems;
|
||||
|
@ -79,6 +80,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
protected IRemoteCommandShell _defaultShell;
|
||||
|
||||
protected IRemoteFileSubSystem _fileSubSystem;
|
||||
private boolean _hasRestoredState = false;
|
||||
|
||||
public RemoteCmdSubSystem(IHost host, IConnectorService connectorService)
|
||||
{
|
||||
|
@ -88,6 +90,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
|
||||
public void initializeSubSystem(IProgressMonitor monitor) throws SystemMessageException {
|
||||
super.initializeSubSystem(monitor);
|
||||
_hasRestoredState = false; // reset so shells are restored after this connect
|
||||
// load UI plugin for adapters right after successful connect
|
||||
Platform.getAdapterManager().loadAdapter(new RemoteOutput(null, ""), "org.eclipse.rse.ui.view.ISystemViewElementAdapter"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
@ -564,7 +567,6 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
{
|
||||
// DKM: changing this so that only first active shell is saved
|
||||
StringBuffer shellBuffer = new StringBuffer();
|
||||
boolean gotShell = false;
|
||||
for (int i = 0; i < cmdShells.size() /*&& !gotShell*/; i++)
|
||||
{
|
||||
|
||||
|
@ -573,18 +575,16 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
}
|
||||
|
||||
IRemoteCommandShell cmd = (IRemoteCommandShell) cmdShells.get(i);
|
||||
if (cmd.isActive())
|
||||
if (cmd != null && cmd.isActive())
|
||||
{
|
||||
Object context = cmd.getContextString();
|
||||
if (context instanceof String)
|
||||
{
|
||||
shellBuffer.append(context);
|
||||
gotShell = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
shellBuffer.append(cmd.getType());
|
||||
gotShell = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,14 +624,15 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
_cmdShells.remove(command);
|
||||
Display.getDefault().asyncExec(new RefreshRemovedShell(this, cmdShell));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// called to restore running shells - behaviour determined by UI
|
||||
public IRemoteCommandShell[] restoreShellState(Shell shellWindow)
|
||||
{
|
||||
if (_hasRestoredState){
|
||||
return null; // already did this, don't do it again! Returning null just means shells view won't restore again
|
||||
}
|
||||
this.shell = shellWindow;
|
||||
IRemoteCommandShell[] results = null;
|
||||
|
||||
|
@ -666,10 +667,10 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
|
|||
}
|
||||
}
|
||||
|
||||
//ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||
// registry.fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this));
|
||||
|
||||
if (numShells > 0){
|
||||
Display.getDefault().asyncExec(new Refresh(this));
|
||||
}
|
||||
_hasRestoredState = true;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue