Search in sources :

Example 1 with VoidServerRequestCallback

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

the class NotebookQueueState method executeChunk.

public void executeChunk(ChunkExecUnit chunk) {
    if (isExecuting()) {
        String chunkId = notebook_.getRowChunkId(chunk.getScope().getPreamble().getRow());
        if (chunkId == null)
            return;
        NotebookQueueUnit unit = getUnit(chunkId);
        if (unit == null) {
            // unit is not in the queue; add it
            queueChunkRange(chunk);
        } else if (chunk.getRange() != null) {
            // only part of the chunk needs to be executed
            NotebookExecRange execRange = getNotebookExecRange(chunk.getScope(), chunk.getRange());
            // (note: doesn't handle overlapping)
            if (unit.hasPendingRange(execRange))
                return;
            // unit is in the queue, modify it
            unit.addPendingRange(execRange);
            // redraw the pending lines
            renderQueueLineState(chunk.getScope(), unit);
            server_.updateNotebookExecQueue(unit, NotebookDocQueue.QUEUE_OP_UPDATE, "", new VoidServerRequestCallback());
        }
    } else {
        List<ChunkExecUnit> chunks = new ArrayList<ChunkExecUnit>();
        chunks.add(chunk);
        executeChunks("Run Chunk", chunks);
    }
}
Also used : NotebookQueueUnit(org.rstudio.studio.client.rmarkdown.model.NotebookQueueUnit) ArrayList(java.util.ArrayList) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) NotebookExecRange(org.rstudio.studio.client.rmarkdown.model.NotebookExecRange)

Example 2 with VoidServerRequestCallback

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

the class ViewerPresenter method onViewerSaveAsWebPage.

@Handler
public void onViewerSaveAsWebPage() {
    display_.bringToFront();
    if (saveAsWebPageDefaultPath_ == null)
        saveAsWebPageDefaultPath_ = workbenchContext_.getCurrentWorkingDir();
    dependencyManager_.withRMarkdown("Saving standalone web pages", new Command() {

        @Override
        public void execute() {
            fileDialogs_.saveFile("Save As Web Page", fileSystemContext_, saveAsWebPageDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {

                @Override
                public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
                    if (targetFile == null) {
                        indicator.onCompleted();
                        return;
                    }
                    indicator.onProgress("Saving as web page...");
                    server_.viewerSaveAsWebPage(targetFile.getPath(), new VoidServerRequestCallback(indicator) {

                        @Override
                        public void onSuccess() {
                            saveAsWebPageDefaultPath_ = targetFile.getParentPath();
                        }
                    });
                }
            });
        }
    });
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) AppCommand(org.rstudio.core.client.command.AppCommand) Command(com.google.gwt.user.client.Command) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ProgressOperationWithInput(org.rstudio.core.client.widget.ProgressOperationWithInput) EnabledChangedHandler(org.rstudio.core.client.command.EnabledChangedHandler) Handler(org.rstudio.core.client.command.Handler)

Example 3 with VoidServerRequestCallback

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

the class ViewerPresenter method stop.

private void stop(boolean interruptR, boolean clearAll, ProgressIndicator indicator) {
    // check whether this was a static widget (determine what we do
    // visa-vi widget history clearing/restoration)
    boolean wasStaticWidget = commands_.viewerZoom().isEnabled();
    manageCommands(false);
    navigate(ViewerPane.ABOUT_BLANK);
    if (interruptR)
        commands_.interruptR().execute();
    server_.viewerStopped(new VoidServerRequestCallback());
    // that the application has been stopped
    if (runningShinyAppParams_ != null) {
        runningShinyAppParams_.setState(ShinyApplicationParams.STATE_STOPPED);
        events_.fireEvent(new ShinyApplicationStatusEvent(runningShinyAppParams_));
    }
    runningShinyAppParams_ = null;
    events_.fireEvent(new ViewerClearedEvent(true));
    // if this was a static widget then clear the current widget
    if (clearAll)
        server_.viewerClearAll(new VoidServerRequestCallback(indicator));
    else if (wasStaticWidget)
        server_.viewerClearCurrent(new VoidServerRequestCallback(indicator));
    else
        // otherwise restore the last static widget
        server_.viewerCurrent(new VoidServerRequestCallback());
}
Also used : ViewerClearedEvent(org.rstudio.studio.client.workbench.views.viewer.events.ViewerClearedEvent) ShinyApplicationStatusEvent(org.rstudio.studio.client.shiny.events.ShinyApplicationStatusEvent) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 4 with VoidServerRequestCallback

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

the class ConsoleProgressDialog method onProcessExit.

@Override
public void onProcessExit(ProcessExitEvent event) {
    setExitCode(event.getExitCode());
    if (isShowing()) {
        display_.setReadOnly(true);
        stopButton().setFocus(true);
        // when a shell exits we close the dialog
        if (getInteractionMode() == ConsoleProcessInfo.INTERACTION_ALWAYS)
            stopButton().click();
        else // we also auto-close
        if (showOnOutput_ && (event.getExitCode() == 0))
            stopButton().click();
    } else // down registrations and reap the process
    if (showOnOutput_) {
        unregisterHandlers();
        if (consoleProcess_ != null)
            consoleProcess_.reap(new VoidServerRequestCallback());
    }
}
Also used : VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 5 with VoidServerRequestCallback

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

the class TerminalSession method onProcessExit.

@Override
public void onProcessExit(ProcessExitEvent event) {
    unregisterHandlers();
    if (consoleProcess_ != null) {
        consoleProcess_.reap(new VoidServerRequestCallback());
    }
    eventBus_.fireEvent(new TerminalSessionStoppedEvent(this));
}
Also used : TerminalSessionStoppedEvent(org.rstudio.studio.client.workbench.views.terminal.events.TerminalSessionStoppedEvent) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

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