void (final ConsoleCommunication communication) { ApplicationManager.getApplication().getService(CommandQueueForPythonConsoleService.class) .addListener(communication, new CommandQueueListener() { @Override public void removeCommand(ConsoleCommunication.@NotNull ConsoleCodeFragment command) { ApplicationManager.getApplication().invokeLater(() -> { myCommandQueuePanel.removeCommand(command); }); } @Override public void addCommand(ConsoleCommunication.@NotNull ConsoleCodeFragment command) { myCommandQueuePanel.addCommand(command); } @Override public void removeAll() { myCommandQueuePanel.removeAllCommands(); } @Override public void disableConsole() { myCommandQueuePanel.removeAllCommands(); isShowQueue = false; restoreQueueWindow(false); } }); }