use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class ProjectPopupMenu method getToolbarButton.
public ToolbarButton getToolbarButton() {
if (toolbarButton_ == null) {
String buttonText = activeProjectFile_ != null ? mruList_.getQualifiedLabel(activeProjectFile_) : "Project: (None)";
toolbarButton_ = new ToolbarButton(buttonText, new ImageResource2x(RESOURCES.projectMenu2x()), this, true);
if (activeProjectFile_ != null) {
toolbarButton_.setTitle(activeProjectFile_);
// also set the doc title so the browser tab carries the project
if (!Desktop.isDesktop())
Document.get().setTitle("RStudio - " + buttonText);
}
if (activeProjectFile_ == null) {
toolbarButton_.addStyleName(ThemeResources.INSTANCE.themeStyles().emptyProjectMenu());
}
}
return toolbarButton_;
}
use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.
the class RmdOutputPanel method initToolbar.
@Override
protected void initToolbar(Toolbar toolbar, Commands commands) {
slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar, 400, 100, true);
fileLabel_ = new ToolbarLabel();
fileLabel_.addStyleName(ThemeStyles.INSTANCE.subtitle());
fileLabel_.getElement().getStyle().setMarginRight(7, Unit.PX);
toolbar.addLeftWidget(fileLabel_);
fileLabelSeparator_ = toolbar.addLeftSeparator();
ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton();
popoutButton.setText("Open in Browser");
toolbar.addLeftWidget(popoutButton);
findTextBox_ = new FindTextBox("Find");
findTextBox_.setIconVisible(true);
findTextBox_.setOverrideWidth(120);
findTextBox_.getElement().getStyle().setMarginRight(6, Unit.PX);
findSeparator_ = toolbar.addLeftSeparator();
toolbar.addLeftWidget(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 = getFrame().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);
}
}
});
toolbar.addLeftSeparator();
publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null);
toolbar.addRightWidget(publishButton_);
toolbar.addRightSeparator();
toolbar.addRightWidget(commands.viewerRefresh().createToolbarButton());
}
use of org.rstudio.core.client.widget.ToolbarButton 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.ToolbarButton in project rstudio by rstudio.
the class ViewFilePanel method createToolbar.
private Toolbar createToolbar() {
toolbar_ = new ViewFileToolbar();
toolbar_.addLeftWidget(new ToolbarButton("Save As", commands_.saveSourceDoc().getImageResource(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
saveFileAs();
}
}));
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(new ToolbarButton(null, commands_.printSourceDoc().getImageResource(), new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
docDisplay_.print();
}
}));
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(findReplace_.createFindReplaceButton());
return toolbar_;
}
use of org.rstudio.core.client.widget.ToolbarButton 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