Search in sources :

Example 41 with VoidServerRequestCallback

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

the class TextEditingTargetNotebook method setDirtyState.

private void setDirtyState() {
    if (getCommitMode() == MODE_UNCOMMITTED && !dirtyState_.getValue()) {
        // mark the document dirty (if it isn't already) since it now
        // contains notebook cache changes that haven't been committed 
        dirtyState_.markDirty(false);
        source_.setSourceDocumentDirty(docUpdateSentinel_.getId(), true, new VoidServerRequestCallback());
    }
}
Also used : VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 42 with VoidServerRequestCallback

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

the class ConsoleProgressDialog method attachToProcess.

public void attachToProcess(final ConsoleProcess consoleProcess) {
    consoleProcess_ = consoleProcess;
    // interaction-always mode is a shell -- customize ui accordingly
    if (getInteractionMode() == ConsoleProcessInfo.INTERACTION_ALWAYS) {
        hideProgress();
        stopButton().setText("Close");
        int height = Window.getClientHeight() - 150;
        int width = Math.min(800, Window.getClientWidth() - 150);
        Style style = display_.getShellWidget().getElement().getStyle();
        style.setHeight(height, Unit.PX);
        style.setWidth(width, Unit.PX);
    } else {
        showProgress();
        stopButton().setText("Stop");
    }
    stopButton().addClickHandler(this);
    if (consoleProcess != null) {
        addHandlerRegistration(consoleProcess.addConsolePromptHandler(this));
        addHandlerRegistration(consoleProcess.addConsoleOutputHandler(this));
        addHandlerRegistration(consoleProcess.addProcessExitHandler(this));
        consoleProcess.start(new SimpleRequestCallback<Void>() {

            @Override
            public void onError(ServerError error) {
                // Show error and stop
                super.onError(error);
                // if this is showOnOutput_ then we will never get
                // a ProcessExitEvent or an onUnload so we should unsubscribe 
                // from events here
                unregisterHandlers();
                closeDialog();
            }
        });
    }
    addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
            if (consoleProcess != null)
                consoleProcess.reap(new VoidServerRequestCallback());
        }
    });
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) Style(com.google.gwt.dom.client.Style) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) Void(org.rstudio.studio.client.server.Void)

Example 43 with VoidServerRequestCallback

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

the class TerminalPane method onTerminalTitle.

@Override
public void onTerminalTitle(TerminalTitleEvent event) {
    // Notification from a TerminalSession that it changed its title
    TerminalSession visibleTerm = getSelectedTerminal();
    TerminalSession retitledTerm = event.getTerminalSession();
    if (visibleTerm != null && visibleTerm.getHandle().equals(retitledTerm.getHandle())) {
        // update the toolbar label if currently displayed terminal has changed
        // its title
        setTerminalTitle(retitledTerm.getTitle());
    }
    // Update local metadata
    if (!terminals_.retitleTerminal(retitledTerm.getHandle(), retitledTerm.getTitle())) {
        // title unchanged
        return;
    }
    // update server
    server_.processSetTitle(retitledTerm.getHandle(), retitledTerm.getTitle(), new VoidServerRequestCallback() {

        @Override
        public void onError(ServerError error) {
            // failed; this might mean we show the wrong title after
            // a reset, but it will update itself fairly quickly
            Debug.logError(error);
        }
    });
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 44 with VoidServerRequestCallback

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

the class TerminalSession method onResizeTerminal.

@Override
public void onResizeTerminal(ResizeTerminalEvent event) {
    cols_ = event.getCols();
    rows_ = event.getRows();
    consoleProcess_.resizeTerminal(cols_, rows_, new VoidServerRequestCallback() {

        @Override
        public void onError(ServerError error) {
            writeError(error.getUserMessage());
        }
    });
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) 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