use of org.rstudio.core.client.widget.ToolbarPopupMenu 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.ToolbarPopupMenu 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.ToolbarPopupMenu in project rstudio by rstudio.
the class GlobalToolbar method completeInitialization.
public void completeInitialization(SessionInfo sessionInfo) {
StandardIcons icons = StandardIcons.INSTANCE;
if (sessionInfo.isVcsEnabled()) {
addLeftSeparator();
ToolbarPopupMenu vcsMenu = new ToolbarPopupMenu();
vcsMenu.addItem(commands_.vcsFileDiff().createMenuItem(false));
vcsMenu.addItem(commands_.vcsFileLog().createMenuItem(false));
vcsMenu.addItem(commands_.vcsFileRevert().createMenuItem(false));
vcsMenu.addSeparator();
vcsMenu.addItem(commands_.vcsViewOnGitHub().createMenuItem(false));
vcsMenu.addItem(commands_.vcsBlameOnGitHub().createMenuItem(false));
vcsMenu.addSeparator();
vcsMenu.addItem(commands_.vcsCommit().createMenuItem(false));
vcsMenu.addSeparator();
vcsMenu.addItem(commands_.vcsPull().createMenuItem(false));
vcsMenu.addItem(commands_.vcsCleanup().createMenuItem(false));
vcsMenu.addItem(commands_.vcsPush().createMenuItem(false));
vcsMenu.addSeparator();
vcsMenu.addItem(commands_.vcsShowHistory().createMenuItem(false));
vcsMenu.addSeparator();
vcsMenu.addItem(commands_.versionControlProjectSetup().createMenuItem(false));
ImageResource vcsIcon = null;
if (sessionInfo.getVcsName().equals(VCSConstants.GIT_ID))
vcsIcon = new ImageResource2x(icons.git2x());
else if (sessionInfo.getVcsName().equals(VCSConstants.SVN_ID))
vcsIcon = new ImageResource2x(icons.svn2x());
ToolbarButton vcsButton = new ToolbarButton(null, vcsIcon, vcsMenu);
vcsButton.setTitle("Version control");
addLeftWidget(vcsButton);
}
// zoom button
addLeftSeparator();
ToolbarPopupMenu paneLayoutMenu = new ToolbarPopupMenu();
paneLayoutMenu.addItem(commands_.layoutEndZoom().createMenuItem(false));
paneLayoutMenu.addSeparator();
paneLayoutMenu.addItem(commands_.layoutConsoleOnLeft().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutConsoleOnRight().createMenuItem(false));
paneLayoutMenu.addSeparator();
paneLayoutMenu.addItem(commands_.paneLayout().createMenuItem(false));
paneLayoutMenu.addSeparator();
paneLayoutMenu.addItem(commands_.layoutZoomSource().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomConsole().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomHelp().createMenuItem(false));
paneLayoutMenu.addSeparator();
paneLayoutMenu.addItem(commands_.layoutZoomHistory().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomFiles().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomPlots().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomPackages().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomEnvironment().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomViewer().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomVcs().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomBuild().createMenuItem(false));
paneLayoutMenu.addItem(commands_.layoutZoomConnections().createMenuItem(false));
ImageResource paneLayoutIcon = new ImageResource2x(ThemeResources.INSTANCE.paneLayoutIcon2x());
ToolbarButton paneLayoutButton = new ToolbarButton(null, paneLayoutIcon, paneLayoutMenu);
paneLayoutButton.setTitle("Workspace Panes");
addLeftWidget(paneLayoutButton);
// addins menu
ToolbarPopupMenu addinsMenu = new ToolbarPopupMenu();
addinsMenu.addItem(commands_.addinsMru0().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru1().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru2().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru3().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru4().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru5().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru6().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru7().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru8().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru9().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru10().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru11().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru12().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru13().createMenuItem(false));
addinsMenu.addItem(commands_.addinsMru14().createMenuItem(false));
addinsMenu.addSeparator();
addinsMenu.addItem(commands_.browseAddins().createMenuItem(false));
addLeftSeparator();
ToolbarButton addinsButton = new ToolbarButton("Addins", CoreResources.INSTANCE.iconEmpty(), addinsMenu);
addLeftWidget(addinsButton);
// project popup menu
ProjectPopupMenu projectMenu = new ProjectPopupMenu(sessionInfo, commands_);
addRightWidget(projectMenu.getToolbarButton());
}
use of org.rstudio.core.client.widget.ToolbarPopupMenu in project rstudio by rstudio.
the class HTMLPreviewPanel method createToolbar.
private Toolbar createToolbar(Commands commands) {
Toolbar toolbar = new Toolbar();
toolbar.addLeftWidget(new ToolbarLabel("Preview: "));
fileLabel_ = new ToolbarLabel();
fileLabel_.addStyleName(ThemeStyles.INSTANCE.subtitle());
fileLabel_.getElement().getStyle().setMarginRight(7, Unit.PX);
toolbar.addLeftWidget(fileLabel_);
toolbar.addLeftSeparator();
toolbar.addLeftWidget(commands.openHtmlExternal().createToolbarButton());
showLogButtonSeparator_ = toolbar.addLeftSeparator();
showLogButton_ = commands.showHtmlPreviewLog().createToolbarButton();
toolbar.addLeftWidget(showLogButton_);
saveHtmlPreviewAsSeparator_ = toolbar.addLeftSeparator();
if (Desktop.isDesktop()) {
saveHtmlPreviewAs_ = commands.saveHtmlPreviewAs().createToolbarButton();
toolbar.addLeftWidget(saveHtmlPreviewAs_);
} else {
ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(commands.saveHtmlPreviewAs().createMenuItem(false));
menu.addItem(commands.saveHtmlPreviewAsLocalFile().createMenuItem(false));
saveHtmlPreviewAs_ = toolbar.addLeftWidget(new ToolbarButton("Save As", commands.saveSourceDoc().getImageResource(), menu));
}
publishButtonSeparator_ = toolbar.addLeftSeparator();
toolbar.addLeftWidget(publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null));
findTextBox_ = new FindTextBox("Find");
findTextBox_.setIconVisible(true);
findTextBox_.setOverrideWidth(120);
findTextBox_.getElement().getStyle().setMarginRight(6, Unit.PX);
toolbar.addRightWidget(findTextBox_);
findTextBox_.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
// enter key triggers a find
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
event.preventDefault();
event.stopPropagation();
findInTopic(findTextBox_.getValue().trim(), findTextBox_);
findTextBox_.focus();
} else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
findTextBox_.setValue("");
}
}
private void findInTopic(String term, CanFocus findInputSource) {
// get content window
WindowEx contentWindow = previewFrame_.getWindow();
if (contentWindow == null)
return;
if (!contentWindow.find(term, false, false, true, false)) {
RStudioGinjector.INSTANCE.getGlobalDisplay().showMessage(MessageDialog.INFO, "Find in Page", "No occurences found", findInputSource);
}
}
});
refreshButtonSeparator_ = toolbar.addRightSeparator();
refreshButton_ = toolbar.addRightWidget(commands.refreshHtmlPreview().createToolbarButton());
return toolbar;
}
use of org.rstudio.core.client.widget.ToolbarPopupMenu in project rstudio by rstudio.
the class EnvironmentPane method createMainToolbar.
// WorkbenchPane overrides -------------------------------------------------
@Override
protected Toolbar createMainToolbar() {
Toolbar toolbar = new Toolbar();
toolbar.addLeftWidget(commands_.loadWorkspace().createToolbarButton());
toolbar.addLeftWidget(commands_.saveWorkspace().createToolbarButton());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(createImportMenu());
toolbar.addLeftSeparator();
toolbar.addLeftWidget(commands_.clearWorkspace().createToolbarButton());
ToolbarPopupMenu menu = new ToolbarPopupMenu();
menu.addItem(createViewMenuItem(EnvironmentObjects.OBJECT_LIST_VIEW));
menu.addItem(createViewMenuItem(EnvironmentObjects.OBJECT_GRID_VIEW));
viewButton_ = new ToolbarButton(nameOfViewType(EnvironmentObjects.OBJECT_LIST_VIEW), imageOfViewType(EnvironmentObjects.OBJECT_LIST_VIEW), menu);
toolbar.addRightWidget(viewButton_);
toolbar.addRightSeparator();
toolbar.addRightWidget(commands_.refreshEnvironment().createToolbarButton());
return toolbar;
}
Aggregations