use of org.rstudio.studio.client.workbench.commands.Commands in project rstudio by rstudio.
the class CompilePanel method connectToolbar.
public void connectToolbar(Toolbar toolbar) {
Commands commands = RStudioGinjector.INSTANCE.getCommands();
ImageResource stopImage = commands.interruptR().getImageResource();
stopButton_ = new ToolbarButton(stopImage, null);
stopButton_.setVisible(false);
toolbar.addRightWidget(stopButton_);
showOutputButton_ = new LeftRightToggleButton("Output", "Issues", false);
showOutputButton_.setVisible(false);
showOutputButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(false);
showErrorsButton_.setVisible(true);
panel_.setWidget(outputDisplay_.asWidget());
outputDisplay_.scrollToBottom();
}
});
toolbar.addRightWidget(showOutputButton_);
showErrorsButton_ = new LeftRightToggleButton("Output", "Issues", true);
showErrorsButton_.setVisible(false);
showErrorsButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(true);
showErrorsButton_.setVisible(false);
panel_.setWidget(errorList_);
}
});
toolbar.addRightWidget(showErrorsButton_);
}
use of org.rstudio.studio.client.workbench.commands.Commands in project rstudio by rstudio.
the class ChunkContextToolbar method initChangeChunkEngine.
@SuppressWarnings("unused")
private void initChangeChunkEngine(String engine) {
chunkTypeLabel_.setText(engine);
DOM.sinkEvents(chunkTypePanel_.getElement(), Event.ONCLICK);
DOM.setEventListener(chunkTypePanel_.getElement(), new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (DOM.eventGetType(event) == Event.ONCLICK) {
Commands commands = RStudioGinjector.INSTANCE.getCommands();
String engineLabel = chunkTypeLabel_.getText();
final ToolbarPopupMenu switchChunksMenu = new ToolbarPopupMenu();
if (engineLabel != "r") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkR(), "r"));
switchChunksMenu.addSeparator();
}
if (!BrowseCap.isWindowsDesktop() && engineLabel != "bash") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkBash(), "bash"));
}
if (engineLabel != "python") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkPython(), "python"));
}
if (engineLabel != "rcpp") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkRCPP(), "rcpp"));
}
if (engineLabel != "sql") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkSQL(), "sql"));
}
if (engineLabel != "stan") {
switchChunksMenu.addItem(createMenuItemForType(commands.switchToChunkStan(), "stan"));
}
switchChunksMenu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
switchChunksMenu.setPopupPosition(chunkTypePanel_.getAbsoluteLeft() + chunkTypePanel_.getOffsetWidth() - offsetWidth + 15, chunkTypePanel_.getAbsoluteTop() + chunkTypePanel_.getOffsetHeight());
}
});
}
}
});
}
Aggregations