use of org.rstudio.core.client.widget.ToolbarPopupMenu in project rstudio by rstudio.
the class ViewerPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
toolbar_ = new Toolbar();
// add html widget buttons
toolbar_.addLeftWidget(commands_.viewerBack().createToolbarButton());
toolbar_.addLeftWidget(commands_.viewerForward().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerZoom().createToolbarButton());
// export commands
exportButtonSeparator_ = toolbar_.addLeftSeparator();
ToolbarPopupMenu exportMenu = new ToolbarPopupMenu();
exportMenu.addItem(commands_.viewerSaveAsImage().createMenuItem(false));
exportMenu.addItem(commands_.viewerCopyToClipboard().createMenuItem(false));
exportMenu.addSeparator();
exportMenu.addItem(commands_.viewerSaveAsWebPage().createMenuItem(false));
exportButton_ = new ToolbarButton("Export", new ImageResource2x(StandardIcons.INSTANCE.export_menu2x()), exportMenu);
toolbar_.addLeftWidget(exportButton_);
exportButton_.setVisible(false);
exportButtonSeparator_.setVisible(false);
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerClear().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerClearAll().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerPopout().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerStop().createToolbarButton());
// add publish button
publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null);
toolbar_.addRightWidget(publishButton_);
toolbar_.addRightSeparator();
toolbar_.addRightWidget(commands_.viewerRefresh().createToolbarButton());
// create an HTML generator
publishButton_.setPublishHtmlSource(new PublishHtmlSource() {
@Override
public void generatePublishHtml(final CommandWithArg<String> onCompleted) {
server_.viewerCreateRPubsHtml(getTitle(), "", new ServerRequestCallback<String>() {
@Override
public void onResponseReceived(String htmlFile) {
onCompleted.execute(htmlFile);
}
@Override
public void onError(ServerError error) {
globalDisplay_.showErrorMessage("Could Not Publish", error.getMessage());
}
});
}
@Override
public String getTitle() {
String title = frame_.getTitle();
if (StringUtil.isNullOrEmpty(title))
title = "Viewer Content";
return title;
}
});
return toolbar_;
}
use of org.rstudio.core.client.widget.ToolbarPopupMenu in project rstudio by rstudio.
the class GitPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
moreMenu.addItem(commands_.vcsRevert().createMenuItem(false));
moreMenu.addItem(commands_.vcsIgnore().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.showShellDialog().createMenuItem(false));
Toolbar toolbar = new Toolbar();
toolbar.addLeftWidget(commands_.vcsDiff().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(commands_.vcsCommit().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(pullButton_ = commands_.vcsPull().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(pushButton_ = commands_.vcsPush().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(historyButton_ = commands_.vcsShowHistory().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(moreButton_ = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu));
toolbar.addRightWidget(createBranchToolbarButton_);
toolbar.addRightSeparator();
toolbar.addRightWidget(switchBranchToolbarButton_);
toolbar.addRightSeparator();
toolbar.addRightWidget(new ToolbarButton(commands_.vcsRefresh().getImageResource(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
table_.showProgress();
commands_.vcsRefresh().execute();
}
}));
return toolbar;
}
use of org.rstudio.core.client.widget.ToolbarPopupMenu in project rstudio by rstudio.
the class GitPane method showContextMenu.
@Override
public void showContextMenu(final int clientX, final int clientY) {
final ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands_.vcsDiff().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsRevert().createMenuItem(false));
menu.addItem(commands_.vcsIgnore().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.vcsOpen().createMenuItem(false));
menu.setPopupPositionAndShow(new PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
menu.setPopupPosition(clientX, clientY);
}
});
}
Aggregations