use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class ConnectionsPane method installConnectionExplorerToolbar.
private void installConnectionExplorerToolbar(final Connection connection) {
toolbar_.removeAllWidgets();
toolbar_.addLeftWidget(backToConnectionsButton_);
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(connectMenuButton_);
toolbar_.addLeftSeparator();
if (isConnected(connection.getId()) && connection.getActions() != null) {
// if we have any actions, create a toolbar button for each one
for (int i = 0; i < connection.getActions().length(); i++) {
final ConnectionAction action = connection.getActions().get(i);
// use the supplied base64 icon data if it was provided
Image icon = StringUtil.isNullOrEmpty(action.getIconData()) ? null : new Image(action.getIconData());
// force to 20x18
if (icon != null) {
icon.setWidth("20px");
icon.setHeight("18px");
}
ToolbarButton button = new ToolbarButton(action.getName(), // left image
icon, // right image
null, // invoke the action when the button is clicked
new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
fireEvent(new ExecuteConnectionActionEvent(connection.getId(), action.getName()));
}
});
// none was supplied
if (StringUtil.isNullOrEmpty(action.getIconData()))
button.getElement().getStyle().setMarginTop(-5, Unit.PX);
toolbar_.addLeftWidget(button);
toolbar_.addLeftSeparator();
}
}
toolbar_.addLeftWidget(commands_.disconnectConnection().createToolbarButton());
toolbar_.addRightWidget(commands_.removeConnection().createToolbarButton());
toolbar_.addRightWidget(commands_.refreshConnection().createToolbarButton());
connectionName_.setText(connection.getDisplayName());
setSecondaryToolbarVisible(true);
}
use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class ConnectionsPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
toolbar_ = new Toolbar();
searchWidget_ = new SearchWidget(new SuggestOracle() {
@Override
public void requestSuggestions(Request request, Callback callback) {
// no suggestions
callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
}
});
backToConnectionsButton_ = new ToolbarButton(commands_.helpBack().getImageResource(), (ClickHandler) null);
backToConnectionsButton_.setTitle("View all connections");
// connect meuu
ToolbarPopupMenu connectMenu = new ToolbarPopupMenu();
connectMenu.addItem(connectMenuItem(commands_.historySendToConsole().getImageResource(), "R Console", ConnectionOptions.CONNECT_R_CONSOLE));
connectMenu.addSeparator();
connectMenu.addItem(connectMenuItem(commands_.newSourceDoc().getImageResource(), "New R Script", ConnectionOptions.CONNECT_NEW_R_SCRIPT));
connectMenu.addItem(connectMenuItem(commands_.newRNotebook().getImageResource(), "New R Notebook", ConnectionOptions.CONNECT_NEW_R_NOTEBOOK));
if (BrowseCap.INSTANCE.canCopyToClipboard()) {
connectMenu.addSeparator();
connectMenu.addItem(connectMenuItem(commands_.copyPlotToClipboard().getImageResource(), "Copy to Clipboard", ConnectionOptions.CONNECT_COPY_TO_CLIPBOARD));
}
connectMenuButton_ = new ToolbarButton("Connect", commands_.newConnection().getImageResource(), connectMenu);
// manage connect menu visibility
connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
commands_.disconnectConnection().addVisibleChangedHandler(new VisibleChangedHandler() {
@Override
public void onVisibleChanged(AppCommand command) {
connectMenuButton_.setVisible(!commands_.disconnectConnection().isVisible());
}
});
installConnectionsToolbar();
return toolbar_;
}
use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class BuildPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
Toolbar toolbar = new Toolbar();
SessionInfo sessionInfo = session_.getSessionInfo();
String type = sessionInfo.getBuildToolsType();
boolean pkg = type.equals(SessionInfo.BUILD_TOOLS_PACKAGE);
boolean makefile = type.equals(SessionInfo.BUILD_TOOLS_MAKEFILE);
boolean website = type.equals(SessionInfo.BUILD_TOOLS_WEBSITE);
// always include build all
ToolbarButton buildAllButton = commands_.buildAll().createToolbarButton();
if (website) {
if (sessionInfo.getBuildToolsBookdownWebsite()) {
buildAllButton.setText("Build Book");
} else {
buildAllButton.setText("Build Website");
}
}
toolbar.addLeftWidget(buildAllButton);
// book build menu
if (sessionInfo.getBuildToolsBookdownWebsite()) {
BookdownBuildPopupMenu buildPopupMenu = new BookdownBuildPopupMenu();
ToolbarButton buildMenuButton = new ToolbarButton(buildPopupMenu, true);
toolbar.addLeftWidget(buildMenuButton);
}
toolbar.addLeftSeparator();
// packages get check package
if (pkg) {
toolbar.addLeftWidget(commands_.checkPackage().createToolbarButton());
toolbar.addLeftSeparator();
}
// create more menu
if (makefile || website || pkg) {
ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
if (makefile || website) {
if (makefile)
moreMenu.addItem(commands_.rebuildAll().createMenuItem(false));
moreMenu.addItem(commands_.cleanAll().createMenuItem(false));
moreMenu.addSeparator();
} else // packages get additional commands
if (pkg) {
moreMenu.addItem(commands_.devtoolsLoadAll().createMenuItem(false));
moreMenu.addItem(commands_.rebuildAll().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.testPackage().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.checkPackage().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.buildSourcePackage().createMenuItem(false));
moreMenu.addItem(commands_.buildBinaryPackage().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.roxygenizePackage().createMenuItem(false));
moreMenu.addSeparator();
}
moreMenu.addItem(commands_.buildToolsProjectSetup().createMenuItem(false));
// add more menu
ToolbarButton moreButton = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu);
toolbar.addLeftWidget(moreButton);
}
// connect compile panel
compilePanel_.connectToolbar(toolbar);
return toolbar;
}
use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class EnvironmentPane method createImportMenu.
private Widget createImportMenu() {
ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.setAutoOpen(true);
menu.addItem(commands_.importDatasetFromFile().createMenuItem(false));
menu.addItem(commands_.importDatasetFromURL().createMenuItem(false));
menu.addItem(commands_.importDatasetFromCsvUsingBase().createMenuItem(false));
menu.addItem(commands_.importDatasetFromCsvUsingReadr().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.importDatasetFromXLS().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.importDatasetFromSAV().createMenuItem(false));
menu.addItem(commands_.importDatasetFromSAS().createMenuItem(false));
menu.addItem(commands_.importDatasetFromStata().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.importDatasetFromXML().createMenuItem(false));
menu.addItem(commands_.importDatasetFromJSON().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.importDatasetFromJDBC().createMenuItem(false));
menu.addItem(commands_.importDatasetFromODBC().createMenuItem(false));
menu.addSeparator();
menu.addItem(commands_.importDatasetFromMongo().createMenuItem(false));
dataImportButton_ = new ToolbarButton("Import Dataset", new ImageResource2x(StandardIcons.INSTANCE.import_dataset2x()), menu);
return dataImportButton_;
}
use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class EnvironmentPane method createSecondaryToolbar.
@Override
protected SecondaryToolbar createSecondaryToolbar() {
SecondaryToolbar toolbar = new SecondaryToolbar();
environmentMenu_ = new EnvironmentPopupMenu();
environmentButton_ = new ToolbarButton(friendlyEnvironmentName(), imageOfEnvironment(environmentName_, environmentIsLocal_), environmentMenu_);
toolbar.addLeftWidget(environmentButton_);
SearchWidget searchWidget = new SearchWidget(new SuggestOracle() {
@Override
public void requestSuggestions(Request request, Callback callback) {
// no suggestions
callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
}
});
searchWidget.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
objects_.setFilterText(event.getValue());
}
});
searchWidget.getElement().getStyle().setMarginTop(1, Unit.PX);
toolbar.addRightWidget(searchWidget);
return toolbar;
}
Aggregations