Search in sources :

Example 21 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class PackagesPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    Toolbar toolbar = new Toolbar();
    // install packages
    toolbar.addLeftWidget(commands_.installPackage().createToolbarButton());
    toolbar.addLeftSeparator();
    // update packages
    toolbar.addLeftWidget(commands_.updatePackages().createToolbarButton());
    prePackratSeparator_ = toolbar.addLeftSeparator();
    // packrat (all packrat UI starts out hidden and then appears
    // in response to changes in the packages state)
    // create packrat bootstrap button
    packratBootstrapButton_ = commands_.packratBootstrap().createToolbarButton(false);
    toolbar.addLeftWidget(packratBootstrapButton_);
    packratBootstrapButton_.setVisible(false);
    // create packrat menu + button
    ToolbarPopupMenu packratMenu = new ToolbarPopupMenu();
    packratMenu.addItem(commands_.packratHelp().createMenuItem(false));
    packratMenu.addSeparator();
    packratMenu.addItem(commands_.packratClean().createMenuItem(false));
    packratMenu.addItem(commands_.packratBundle().createMenuItem(false));
    packratMenu.addSeparator();
    packratMenu.addItem(commands_.packratOptions().createMenuItem(false));
    packratMenuButton_ = new ToolbarButton("Packrat", commands_.packratBootstrap().getImageResource(), packratMenu);
    toolbar.addLeftWidget(packratMenuButton_);
    packratMenuButton_.setVisible(false);
    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) {
            observer_.onPackageFilterChanged(event.getValue().trim());
        }
    });
    toolbar.addRightWidget(searchWidget_);
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands_.refreshPackages().createToolbarButton());
    return toolbar;
}
Also used : SearchWidget(org.rstudio.core.client.widget.SearchWidget) PackageInstallRequest(org.rstudio.studio.client.workbench.views.packages.model.PackageInstallRequest) ArrayList(java.util.ArrayList) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 22 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton in project rstudio by rstudio.

the class CodeBrowserEditingTargetWidget method createToolbar.

private Toolbar createToolbar() {
    Toolbar toolbar = new EditingTargetToolbar(commands_, true);
    toolbar.addLeftWidget(commands_.printSourceDoc().createToolbarButton());
    toolbar.addLeftSeparator();
    toolbar.addLeftWidget(findReplace_.createFindReplaceButton());
    ImageResource icon = new ImageResource2x(ThemeResources.INSTANCE.codeTransform2x());
    ToolbarPopupMenu menu = new ToolbarPopupMenu();
    menu.addItem(commands_.goToHelp().createMenuItem(false));
    menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false));
    ToolbarButton codeTools = new ToolbarButton("", icon, menu);
    codeTools.setTitle("Code Tools");
    toolbar.addLeftWidget(codeTools);
    toolbar.addRightWidget(commands_.executeCode().createToolbarButton());
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands_.executeLastCode().createToolbarButton());
    return toolbar;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) EditingTargetToolbar(org.rstudio.studio.client.workbench.views.source.editors.EditingTargetToolbar) ImageResource(com.google.gwt.resources.client.ImageResource) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) EditingTargetToolbar(org.rstudio.studio.client.workbench.views.source.editors.EditingTargetToolbar) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 23 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton 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_;
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) PublishHtmlSource(org.rstudio.studio.client.rsconnect.model.PublishHtmlSource) ServerError(org.rstudio.studio.client.server.ServerError) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) ServerRequestCallback(org.rstudio.studio.client.server.ServerRequestCallback) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 24 with ToolbarButton

use of org.rstudio.core.client.widget.ToolbarButton 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;
}
Also used : CheckoutBranchToolbarButton(org.rstudio.studio.client.workbench.views.vcs.CheckoutBranchToolbarButton) CreateBranchToolbarButton(org.rstudio.studio.client.workbench.views.vcs.CreateBranchToolbarButton) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Toolbar(org.rstudio.core.client.widget.Toolbar)

Aggregations

ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)24 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)13 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)11 Toolbar (org.rstudio.core.client.widget.Toolbar)10 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)5 SecondaryToolbar (org.rstudio.core.client.widget.SecondaryToolbar)4 ImageResource (com.google.gwt.resources.client.ImageResource)3 SuggestOracle (com.google.gwt.user.client.ui.SuggestOracle)3 SearchWidget (org.rstudio.core.client.widget.SearchWidget)3 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)3 JsArrayString (com.google.gwt.core.client.JsArrayString)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 ArrayList (java.util.ArrayList)2 WindowEx (org.rstudio.core.client.dom.WindowEx)2 CanFocus (org.rstudio.core.client.widget.CanFocus)2 FindTextBox (org.rstudio.core.client.widget.FindTextBox)2 SlideNavigationToolbarMenu (org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu)2