Search in sources :

Example 26 with VoidServerRequestCallback

use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.

the class BreakpointManager method notifyServer.

private void notifyServer(Breakpoint breakpoint, boolean added, boolean arm) {
    ArrayList<Breakpoint> bps = new ArrayList<Breakpoint>();
    bps.add(breakpoint);
    server_.updateBreakpoints(bps, added, arm, new VoidServerRequestCallback());
}
Also used : Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint) ArrayList(java.util.ArrayList) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 27 with VoidServerRequestCallback

use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.

the class BreakpointManager method clearAllBreakpoints.

private void clearAllBreakpoints() {
    Set<FileFunction> functions = new TreeSet<FileFunction>();
    for (Breakpoint breakpoint : breakpoints_) {
        breakpoint.setState(Breakpoint.STATE_REMOVING);
        if (breakpoint.getType() == Breakpoint.TYPE_FUNCTION)
            functions.add(new FileFunction(breakpoint));
    }
    // set previously
    for (FileFunction function : functions) {
        server_.setFunctionBreakpoints(function.functionName, function.fileName, function.packageName, new ArrayList<String>(), new ServerRequestCallback<Void>() {

            @Override
            public void onError(ServerError error) {
            // There's a possibility here that the breakpoints were
            // not successfully cleared, so we may be in a temporarily
            // confusing state, but no error message will be less 
            // confusing. 
            }
        });
    }
    server_.removeAllBreakpoints(new VoidServerRequestCallback());
    notifyBreakpointsSaved(new ArrayList<Breakpoint>(breakpoints_), false);
    breakpoints_.clear();
    onBreakpointAddOrRemove();
}
Also used : Breakpoint(org.rstudio.studio.client.common.debugging.model.Breakpoint) TreeSet(java.util.TreeSet) ServerError(org.rstudio.studio.client.server.ServerError) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) Void(org.rstudio.studio.client.server.Void)

Example 28 with VoidServerRequestCallback

use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.

the class RmdOutputFramePane method onViewerCleared.

@Override
public void onViewerCleared(ViewerClearedEvent event) {
    // viewer is cleared
    if (isShiny_ && event.isForStop()) {
        server_.terminateRenderRmd(true, new VoidServerRequestCallback());
        isShiny_ = false;
    }
}
Also used : VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 29 with VoidServerRequestCallback

use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.

the class ProjectSourceControlPreferencesPane method confirmGitRepo.

private void confirmGitRepo(final Command onConfirmed) {
    final ProgressIndicator indicator = getProgressIndicator();
    indicator.onProgress("Checking for git repository...");
    final String projDir = session_.getSessionInfo().getActiveProjectDir().getPath();
    server_.gitHasRepo(projDir, new ServerRequestCallback<Boolean>() {

        @Override
        public void onResponseReceived(Boolean result) {
            indicator.onCompleted();
            if (result) {
                onConfirmed.execute();
            } else {
                globalDisplay_.showYesNoMessage(MessageDialog.QUESTION, "Confirm New Git Repository", "Do you want to initialize a new git repository " + "for this project?", false, new Operation() {

                    @Override
                    public void execute() {
                        server_.gitInitRepo(projDir, new VoidServerRequestCallback(indicator) {

                            @Override
                            public void onSuccess() {
                                onConfirmed.execute();
                            }

                            @Override
                            public void onFailure() {
                                setVcsSelection(VCSConstants.NO_ID);
                            }
                        });
                    }
                }, new Operation() {

                    @Override
                    public void execute() {
                        setVcsSelection(VCSConstants.NO_ID);
                        indicator.onCompleted();
                    }
                }, true);
            }
        }

        @Override
        public void onError(ServerError error) {
            setVcsSelection(VCSConstants.NO_ID);
            indicator.onError(error.getUserMessage());
        }
    });
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) JsArrayString(com.google.gwt.core.client.JsArrayString) Operation(org.rstudio.core.client.widget.Operation)

Example 30 with VoidServerRequestCallback

use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.

the class Shell method onConsoleClear.

@Handler
void onConsoleClear() {
    // clear output
    view_.clearOutput();
    // notify server
    server_.resetConsoleActions(new VoidServerRequestCallback());
    // if we don't bounce setFocus the menu retains focus
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        public void execute() {
            view_.getInputEditorDisplay().setFocus(true);
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) Handler(org.rstudio.core.client.command.Handler)

Aggregations

VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)44 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)14 Handler (org.rstudio.core.client.command.Handler)8 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)7 ServerError (org.rstudio.studio.client.server.ServerError)7 Command (com.google.gwt.user.client.Command)6 Operation (org.rstudio.core.client.widget.Operation)4 ProgressOperation (org.rstudio.core.client.widget.ProgressOperation)4 Void (org.rstudio.studio.client.server.Void)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)3 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)3 ArrayList (java.util.ArrayList)3 AppCommand (org.rstudio.core.client.command.AppCommand)3 ProgressOperationWithInput (org.rstudio.core.client.widget.ProgressOperationWithInput)3 EditingTarget (org.rstudio.studio.client.workbench.views.source.editors.EditingTarget)3 CodeBrowserEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserEditingTarget)3 DataEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget)3 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)3 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)2