@@ -17,7 +17,6 @@ package org.springframework.shell.component;
|
|||||||
|
|
||||||
import org.jline.terminal.Terminal;
|
import org.jline.terminal.Terminal;
|
||||||
|
|
||||||
import org.springframework.messaging.Message;
|
|
||||||
import org.springframework.shell.component.view.TerminalUI;
|
import org.springframework.shell.component.view.TerminalUI;
|
||||||
import org.springframework.shell.component.view.control.View;
|
import org.springframework.shell.component.view.control.View;
|
||||||
import org.springframework.shell.component.view.control.ViewDoneEvent;
|
import org.springframework.shell.component.view.control.ViewDoneEvent;
|
||||||
@@ -66,11 +65,7 @@ public class ViewComponent {
|
|||||||
if (eventLoop == null) {
|
if (eventLoop == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Message<String> msg = ShellMessageBuilder.withPayload("int")
|
eventLoop.dispatch(ShellMessageBuilder.ofInterrupt());
|
||||||
.setEventType(EventLoop.Type.SYSTEM)
|
|
||||||
.setPriority(0)
|
|
||||||
.build();
|
|
||||||
eventLoop.dispatch(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,18 @@ public final class ShellMessageBuilder<T> {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a {@code interrupt} message.
|
||||||
|
*
|
||||||
|
* @return a interrupt message
|
||||||
|
*/
|
||||||
|
public static Message<String> ofInterrupt() {
|
||||||
|
return new ShellMessageBuilder<>("int", null)
|
||||||
|
.setEventType(EventLoop.Type.SYSTEM)
|
||||||
|
.setPriority(0)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a message of a {@link MouseEvent}.
|
* Create a message of a {@link MouseEvent}.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.annotation.AnnotationUtils;
|
import org.springframework.core.annotation.AnnotationUtils;
|
||||||
import org.springframework.messaging.Message;
|
|
||||||
import org.springframework.shell.component.view.TerminalUI;
|
import org.springframework.shell.component.view.TerminalUI;
|
||||||
import org.springframework.shell.component.view.control.AppView;
|
import org.springframework.shell.component.view.control.AppView;
|
||||||
import org.springframework.shell.component.view.control.AppView.AppViewEvent;
|
import org.springframework.shell.component.view.control.AppView.AppViewEvent;
|
||||||
@@ -116,11 +115,7 @@ public class Catalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestQuit() {
|
private void requestQuit() {
|
||||||
Message<String> msg = ShellMessageBuilder.withPayload("int")
|
eventLoop.dispatch(ShellMessageBuilder.ofInterrupt());
|
||||||
.setEventType(EventLoop.Type.SYSTEM)
|
|
||||||
.setPriority(0)
|
|
||||||
.build();
|
|
||||||
eventLoop.dispatch(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user