Search in sources :

Example 1 with VisibleChangedHandler

use of org.rstudio.core.client.command.VisibleChangedHandler in project rstudio by rstudio.

the class RSConnectPublishButton method initialize.

@Inject
public void initialize(RSConnectServerOperations server, RMarkdownServerOperations rmdServer, EventBus events, Commands commands, GlobalDisplay display, Provider<UIPrefs> pUiPrefs, Session session, PlotPublishMRUList plotMru) {
    server_ = server;
    rmdServer_ = rmdServer;
    events_ = events;
    commands_ = commands;
    display_ = display;
    session_ = session;
    pUiPrefs_ = pUiPrefs;
    plotMru_ = plotMru;
    // initialize visibility if requested
    if (boundCommand_ != null) {
        boundCommand_.addVisibleChangedHandler(new VisibleChangedHandler() {

            @Override
            public void onVisibleChanged(AppCommand command) {
                applyVisiblity();
            }
        });
        boundCommand_.addEnabledChangedHandler(new EnabledChangedHandler() {

            @Override
            public void onEnabledChanged(AppCommand command) {
                applyVisiblity();
            }
        });
    }
    events_.addHandler(RSConnectDeploymentCompletedEvent.TYPE, this);
    events_.addHandler(RPubsUploadStatusEvent.TYPE, this);
    events_.addHandler(RmdRenderCompletedEvent.TYPE, this);
    events_.addHandler(HTMLPreviewCompletedEvent.TYPE, this);
}
Also used : AppCommand(org.rstudio.core.client.command.AppCommand) VisibleChangedHandler(org.rstudio.core.client.command.VisibleChangedHandler) EnabledChangedHandler(org.rstudio.core.client.command.EnabledChangedHandler) Inject(com.google.inject.Inject)

Example 2 with VisibleChangedHandler

use of org.rstudio.core.client.command.VisibleChangedHandler 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_;
}
Also used : SearchWidget(org.rstudio.core.client.widget.SearchWidget) ArrayList(java.util.ArrayList) VisibleChangedHandler(org.rstudio.core.client.command.VisibleChangedHandler) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) AppCommand(org.rstudio.core.client.command.AppCommand) AnimationCallback(com.google.gwt.layout.client.Layout.AnimationCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle) Toolbar(org.rstudio.core.client.widget.Toolbar) SecondaryToolbar(org.rstudio.core.client.widget.SecondaryToolbar)

Aggregations

AppCommand (org.rstudio.core.client.command.AppCommand)2 VisibleChangedHandler (org.rstudio.core.client.command.VisibleChangedHandler)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 AnimationCallback (com.google.gwt.layout.client.Layout.AnimationCallback)1 SuggestOracle (com.google.gwt.user.client.ui.SuggestOracle)1 Inject (com.google.inject.Inject)1 ArrayList (java.util.ArrayList)1 EnabledChangedHandler (org.rstudio.core.client.command.EnabledChangedHandler)1 SearchWidget (org.rstudio.core.client.widget.SearchWidget)1 SecondaryToolbar (org.rstudio.core.client.widget.SecondaryToolbar)1 Toolbar (org.rstudio.core.client.widget.Toolbar)1 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)1 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)1