Search in sources :

Example 1 with PerformConnectionEvent

use of org.rstudio.studio.client.workbench.views.connections.events.PerformConnectionEvent in project rstudio by rstudio.

the class ConnectionsPresenter method onNewConnection.

public void onNewConnection() {
    // if r session bussy, fail
    if (commands_.interruptR().isEnabled()) {
        showError("The R session is currently busy. Wait for completion or " + "interrupt the current session and retry.");
        return;
    }
    // get the context
    server_.getNewConnectionContext(new DelayedProgressRequestCallback<NewConnectionContext>("New Connection...") {

        @Override
        protected void onSuccess(final NewConnectionContext context) {
            // show dialog
            NewConnectionWizard newConnectionWizard = new NewConnectionWizard(context, new ProgressOperationWithInput<ConnectionOptions>() {

                @Override
                public void execute(ConnectionOptions result, ProgressIndicator indicator) {
                    indicator.onCompleted();
                    eventBus_.fireEvent(new PerformConnectionEvent(result.getConnectVia(), result.getConnectCode()));
                }
            });
            newConnectionWizard.showModal();
        }
    });
}
Also used : NewConnectionContext(org.rstudio.studio.client.workbench.views.connections.model.NewConnectionContext) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) PerformConnectionEvent(org.rstudio.studio.client.workbench.views.connections.events.PerformConnectionEvent) NewConnectionWizard(org.rstudio.studio.client.workbench.views.connections.ui.NewConnectionWizard) ConnectionOptions(org.rstudio.studio.client.workbench.views.connections.model.ConnectionOptions) ProgressOperationWithInput(org.rstudio.core.client.widget.ProgressOperationWithInput)

Aggregations

ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)1 ProgressOperationWithInput (org.rstudio.core.client.widget.ProgressOperationWithInput)1 PerformConnectionEvent (org.rstudio.studio.client.workbench.views.connections.events.PerformConnectionEvent)1 ConnectionOptions (org.rstudio.studio.client.workbench.views.connections.model.ConnectionOptions)1 NewConnectionContext (org.rstudio.studio.client.workbench.views.connections.model.NewConnectionContext)1 NewConnectionWizard (org.rstudio.studio.client.workbench.views.connections.ui.NewConnectionWizard)1