Update gclc version
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
@@ -69,6 +69,7 @@ package net.bigeon.gclc.swt;
|
||||
* #L%
|
||||
*/
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -84,7 +85,6 @@ import net.bigeon.gclc.ConsoleApplication;
|
||||
import net.bigeon.gclc.manager.ConsoleInput;
|
||||
import net.bigeon.gclc.manager.ConsoleOutput;
|
||||
import net.bigeon.gclc.tools.ConstantString;
|
||||
import net.bigeon.gclc.tools.StringProvider;
|
||||
|
||||
/** A SWT component to connect to gclc {@link ConsoleApplication}.
|
||||
* <p>
|
||||
@@ -111,7 +111,7 @@ public final class SWTConsole extends Composite
|
||||
/** The prompt label. */
|
||||
private final Label lblPromptlabel;
|
||||
/** The prompt text. */
|
||||
private StringProvider prompt = new ConstantString("> "); //$NON-NLS-1$
|
||||
private Supplier<String> prompt = new ConstantString("> "); //$NON-NLS-1$
|
||||
/** The command entered by the user. */
|
||||
private String command = null;
|
||||
/** If the prompt should be active. */
|
||||
@@ -135,7 +135,7 @@ public final class SWTConsole extends Composite
|
||||
consoleOutput.setRedraw(true);
|
||||
|
||||
lblPromptlabel = new Label(this, SWT.NONE);
|
||||
lblPromptlabel.setText(prompt.apply());
|
||||
lblPromptlabel.setText(prompt.get());
|
||||
|
||||
consoleInput = new Text(this, SWT.BORDER);
|
||||
consoleInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
||||
@@ -175,7 +175,7 @@ public final class SWTConsole extends Composite
|
||||
/* (non-Javadoc)
|
||||
* @see fr.bigeon.gclc.ConsoleManager#getPrompt() */
|
||||
@Override
|
||||
public StringProvider getPrompt() {
|
||||
public Supplier<String> getPrompt() {
|
||||
return prompt;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public final class SWTConsole extends Composite
|
||||
@Override
|
||||
public String prompt() throws IOException {
|
||||
synchronized (promptLock) {
|
||||
initPrompt(prompt.apply());
|
||||
initPrompt(prompt.get());
|
||||
promptLock.notifyAll();
|
||||
try {
|
||||
while (prompting) {
|
||||
@@ -303,7 +303,7 @@ public final class SWTConsole extends Composite
|
||||
@Override
|
||||
public String prompt(final long timeout) throws IOException {
|
||||
synchronized (promptLock) {
|
||||
initPrompt(prompt.apply());
|
||||
initPrompt(prompt.get());
|
||||
promptLock.notifyAll();
|
||||
try {
|
||||
waitPromptResolution(timeout);
|
||||
@@ -386,7 +386,7 @@ public final class SWTConsole extends Composite
|
||||
@Override
|
||||
public void run() {
|
||||
if (!consoleOutput.isDisposed()) {
|
||||
lblPromptlabel.setText(prompt.apply());
|
||||
lblPromptlabel.setText(prompt.get());
|
||||
// relayout
|
||||
SWTConsole.this.layout();
|
||||
}
|
||||
@@ -419,14 +419,14 @@ public final class SWTConsole extends Composite
|
||||
/* (non-Javadoc)
|
||||
* @see fr.bigeon.gclc.ConsoleManager#setPrompt(java.lang.String) */
|
||||
@Override
|
||||
public void setPrompt(final StringProvider prompt) {
|
||||
public void setPrompt(final Supplier<String> prompt) {
|
||||
this.prompt = prompt;
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@SuppressWarnings("synthetic-access")
|
||||
@Override
|
||||
public void run() {
|
||||
if (!consoleOutput.isDisposed()) {
|
||||
lblPromptlabel.setText(prompt.apply());
|
||||
lblPromptlabel.setText(prompt.get());
|
||||
// relayout
|
||||
SWTConsole.this.layout();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user