use of org.rstudio.studio.client.workbench.views.terminal.events.SwitchToTerminalEvent in project rstudio by rstudio.
the class TerminalPopupMenu method getDynamicPopupMenu.
@Override
public void getDynamicPopupMenu(final DynamicPopupMenuCallback callback) {
// clean out existing entries
clearItems();
addItem(commands_.newTerminal().createMenuItem(false));
addSeparator();
if (terminals_.terminalCount() > 0) {
for (final String handle : terminals_) {
Scheduler.ScheduledCommand cmd = new Scheduler.ScheduledCommand() {
@Override
public void execute() {
eventBus_.fireEvent(new SwitchToTerminalEvent(handle));
}
};
String caption = trimCaption(terminals_.getCaption(handle));
if (caption == null) {
continue;
}
// visual indicator that terminal has processes running
caption = addBusyIndicator(caption, terminals_.getHasSubprocs(handle));
String menuHtml = AppCommand.formatMenuLabel(null, /*icon*/
caption, /*label*/
false, /*html*/
null, /*shortcut*/
null, /*rightImage*/
null);
/*rightImageDesc*/
addItem(new MenuItem(menuHtml, true, cmd));
}
addSeparator();
addItem(commands_.renameTerminal().createMenuItem(false));
addItem(commands_.clearTerminalScrollbackBuffer().createMenuItem(false));
addSeparator();
addItem(commands_.previousTerminal().createMenuItem(false));
addItem(commands_.nextTerminal().createMenuItem(false));
addSeparator();
addItem(commands_.closeTerminal().createMenuItem(false));
}
callback.onPopupMenu(this);
}
use of org.rstudio.studio.client.workbench.views.terminal.events.SwitchToTerminalEvent in project rstudio by rstudio.
the class TerminalPane method onTerminalSessionStopped.
@Override
public void onTerminalSessionStopped(TerminalSessionStoppedEvent event) {
// Figure out which terminal to switch to, send message to do so,
// and remove the stopped terminal.
TerminalSession currentTerminal = event.getTerminalWidget();
String handle = currentTerminal.getHandle();
String newTerminalHandle = terminalToShowWhenClosing(handle);
if (newTerminalHandle != null) {
events_.fireEvent(new SwitchToTerminalEvent(newTerminalHandle));
}
terminals_.removeTerminal(handle);
terminalSessionsPanel_.remove(currentTerminal);
if (newTerminalHandle == null) {
activeTerminalToolbarButton_.setNoActiveTerminal();
setTerminalTitle("");
}
}
Aggregations