use of com.intellij.openapi.ui.playback.PlaybackContext in project intellij-community by JetBrains.
the class ActionMacroManager method playbackMacro.
private void playbackMacro(ActionMacro macro) {
final IdeFrame frame = WindowManager.getInstance().getIdeFrame(null);
assert frame != null;
StringBuffer script = new StringBuffer();
ActionMacro.ActionDescriptor[] actions = macro.getActions();
for (ActionMacro.ActionDescriptor each : actions) {
each.generateTo(script);
}
final PlaybackRunner runner = new PlaybackRunner(script.toString(), new PlaybackRunner.StatusCallback.Edt() {
@Override
public void messageEdt(PlaybackContext context, String text, Type type) {
if (type == Type.message || type == Type.error) {
StatusBar statusBar = frame.getStatusBar();
if (statusBar != null) {
if (context != null) {
text = "Line " + context.getCurrentLine() + ": " + text;
}
statusBar.setInfo(text);
}
}
}
}, Registry.is("actionSystem.playback.useDirectActionCall"), true, Registry.is("actionSystem.playback.useTypingTargets"));
myIsPlaying = true;
runner.run().doWhenDone(() -> {
StatusBar statusBar = frame.getStatusBar();
statusBar.setInfo("Script execution finished");
}).doWhenProcessed(() -> myIsPlaying = false);
}
Aggregations