From c6f4dcc067eef8a29db9241a7ae43a8fec2bf1e1 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 25 Jan 2007 18:25:13 +0000 Subject: [PATCH] shell output notification issues --- .../dstore/shell/DStoreShellOutputReader.java | 16 +++++++++++----- .../dstore/shells/DStoreHostShell.java | 7 +++++++ .../shells/AbstractHostShellOutputReader.java | 2 +- .../model/DStoreServiceCommandShell.java | 14 ++++++++++++++ .../subsystems/AbstractConnectorService.java | 18 ++++++++++++++++-- 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellOutputReader.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellOutputReader.java index 2482edc11a7..69fdd569fc3 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellOutputReader.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/shell/DStoreShellOutputReader.java @@ -75,8 +75,15 @@ public class DStoreShellOutputReader extends AbstractHostShellOutputReader imple try { - waitForResponse(); - return internalReadLine(); + if (_hostShell.isActive()) + { + waitForResponse(); + return internalReadLine(); + } + else + { + return null; + } } catch (Exception e) { @@ -122,8 +129,7 @@ public class DStoreShellOutputReader extends AbstractHostShellOutputReader imple } /** - * Causes the current thread to wait until this class request has been - * fulfilled. + * Causes the current thread to wait until notified */ public synchronized void waitForResponse() { @@ -138,7 +144,7 @@ public class DStoreShellOutputReader extends AbstractHostShellOutputReader imple } /** - * Causes all threads waiting for this class request to be filled + * Causes all threads waiting for this * to wake up. */ public synchronized void notifyResponse() diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/shells/DStoreHostShell.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/shells/DStoreHostShell.java index 553fafaece2..8fbbec090a1 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/shells/DStoreHostShell.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/shells/DStoreHostShell.java @@ -62,6 +62,13 @@ public class DStoreHostShell extends AbstractHostShell implements IHostShell { return _stderrHandler; } + + public DataElement getStatus() + { + return _status; + } + + public void exit() { diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java index 97fb596ecb9..dffca83fca1 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/shells/AbstractHostShellOutputReader.java @@ -77,6 +77,7 @@ public abstract class AbstractHostShellOutputReader extends Thread implements I else { finish(); + _keepRunning = false; } } @@ -158,7 +159,6 @@ public abstract class AbstractHostShellOutputReader extends Thread implements I { _waitIncrement = 0; - _keepRunning = false; //dispose(); } } diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.dstore/src/org/eclipse/rse/subsystems/shells/dstore/model/DStoreServiceCommandShell.java b/rse/plugins/org.eclipse.rse.subsystems.shells.dstore/src/org/eclipse/rse/subsystems/shells/dstore/model/DStoreServiceCommandShell.java index f4dbe768579..6b5cd308ed2 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.dstore/src/org/eclipse/rse/subsystems/shells/dstore/model/DStoreServiceCommandShell.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.dstore/src/org/eclipse/rse/subsystems/shells/dstore/model/DStoreServiceCommandShell.java @@ -130,5 +130,19 @@ public class DStoreServiceCommandShell extends ServiceCommandShell } */ } + + public boolean isActive() + { + boolean activeShell = _hostShell.isActive(); + if (!activeShell) + { + DataElement status = ((DStoreHostShell)_hostShell).getStatus(); + if (_output.size() < status.getNestedSize()) + { + return true; + } + } + return activeShell; + } } diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java index 6794e035294..636cfa188ec 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/AbstractConnectorService.java @@ -527,14 +527,28 @@ public abstract class AbstractConnectorService extends RSEModelObject implements } if (shell == null) { - shell = SystemBasePlugin.getActiveWorkbenchShell(); + try + { + shell = SystemBasePlugin.getActiveWorkbenchShell(); + } + catch (Exception e) + { + shell = new Shell(); + } } if (supportsPassword() || supportsUserId()) { if (shell == null) { - shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + try + { + shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + } + catch (Exception e) + { + shell = new Shell(); + } } if (shell != null) { boolean passwordNeeded = supportsPassword() && _passwordInfo.getPassword() == null;