interrupt prompt by closing correctly
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
dd3072615a
commit
e6b4766d89
@ -117,6 +117,7 @@ public final class SWTConsole extends Composite
|
||||
@Override
|
||||
public void close() {
|
||||
synchronized (promptLock) {
|
||||
prompting = false;
|
||||
promptLock.notifyAll();
|
||||
}
|
||||
if (consoleInput.isDisposed()) {
|
||||
@ -159,7 +160,10 @@ public final class SWTConsole extends Composite
|
||||
/* (non-Javadoc)
|
||||
* @see fr.bigeon.gclc.ConsoleManager#print(java.lang.String) */
|
||||
@Override
|
||||
public void print(final String text) {
|
||||
public void print(final String text) throws IOException {
|
||||
if (isDisposed()) {
|
||||
throw new IOException();
|
||||
}
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@SuppressWarnings("synthetic-access")
|
||||
@Override
|
||||
@ -174,7 +178,10 @@ public final class SWTConsole extends Composite
|
||||
/* (non-Javadoc)
|
||||
* @see fr.bigeon.gclc.ConsoleManager#println() */
|
||||
@Override
|
||||
public void println() {
|
||||
public void println() throws IOException {
|
||||
if (isDisposed()) {
|
||||
throw new IOException();
|
||||
}
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@SuppressWarnings("synthetic-access")
|
||||
@Override
|
||||
@ -189,7 +196,10 @@ public final class SWTConsole extends Composite
|
||||
/* (non-Javadoc)
|
||||
* @see fr.bigeon.gclc.ConsoleManager#println(java.lang.String) */
|
||||
@Override
|
||||
public void println(final String message) {
|
||||
public void println(final String message) throws IOException {
|
||||
if (isDisposed()) {
|
||||
throw new IOException();
|
||||
}
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@SuppressWarnings("synthetic-access")
|
||||
@Override
|
||||
@ -264,7 +274,7 @@ public final class SWTConsole extends Composite
|
||||
prompting = true;
|
||||
command = null;
|
||||
promptLock.notifyAll();
|
||||
long start = System.currentTimeMillis();
|
||||
final long start = System.currentTimeMillis();
|
||||
long cur = start;
|
||||
while (prompting && start + timeout>cur) {
|
||||
promptLock.wait((cur-start-timeout)/2);
|
||||
|
Loading…
Reference in New Issue
Block a user