1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 18:15:23 +02:00

shell output notification issues

This commit is contained in:
David McKnight 2007-01-25 18:25:13 +00:00
parent 1f537cc4d1
commit c6f4dcc067
5 changed files with 49 additions and 8 deletions

View file

@ -74,10 +74,17 @@ public class DStoreShellOutputReader extends AbstractHostShellOutputReader imple
try try
{
if (_hostShell.isActive())
{ {
waitForResponse(); waitForResponse();
return internalReadLine(); return internalReadLine();
} }
else
{
return null;
}
}
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
@ -122,8 +129,7 @@ public class DStoreShellOutputReader extends AbstractHostShellOutputReader imple
} }
/** /**
* Causes the current thread to wait until this class request has been * Causes the current thread to wait until notified
* fulfilled.
*/ */
public synchronized void waitForResponse() 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. * to wake up.
*/ */
public synchronized void notifyResponse() public synchronized void notifyResponse()

View file

@ -63,6 +63,13 @@ public class DStoreHostShell extends AbstractHostShell implements IHostShell
return _stderrHandler; return _stderrHandler;
} }
public DataElement getStatus()
{
return _status;
}
public void exit() public void exit()
{ {
writeToShell("exit"); //$NON-NLS-1$ writeToShell("exit"); //$NON-NLS-1$

View file

@ -77,6 +77,7 @@ public abstract class AbstractHostShellOutputReader extends Thread implements I
else else
{ {
finish(); finish();
_keepRunning = false;
} }
} }
@ -158,7 +159,6 @@ public abstract class AbstractHostShellOutputReader extends Thread implements I
{ {
_waitIncrement = 0; _waitIncrement = 0;
_keepRunning = false;
//dispose(); //dispose();
} }
} }

View file

@ -131,4 +131,18 @@ 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;
}
} }

View file

@ -526,16 +526,30 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
dialog.open(); dialog.open();
} }
if (shell == null) if (shell == null)
{
try
{ {
shell = SystemBasePlugin.getActiveWorkbenchShell(); shell = SystemBasePlugin.getActiveWorkbenchShell();
} }
catch (Exception e)
{
shell = new Shell();
}
}
if (supportsPassword() || supportsUserId()) if (supportsPassword() || supportsUserId())
{ {
if (shell == null) if (shell == null)
{
try
{ {
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
} }
catch (Exception e)
{
shell = new Shell();
}
}
if (shell != null) { if (shell != null) {
boolean passwordNeeded = supportsPassword() && _passwordInfo.getPassword() == null; boolean passwordNeeded = supportsPassword() && _passwordInfo.getPassword() == null;
boolean userIdNeeded = supportsUserId() && _passwordInfo.getUserid() == null; boolean userIdNeeded = supportsUserId() && _passwordInfo.getUserid() == null;