Search in sources :

Example 6 with ProgressIndicator

use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.

the class Projects method onShowDiagnosticsProject.

@Handler
public void onShowDiagnosticsProject() {
    final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Lint");
    indicator.onProgress("Analyzing project sources...");
    projServer_.analyzeProject(new ServerRequestCallback<Void>() {

        @Override
        public void onResponseReceived(Void response) {
            indicator.onCompleted();
        }

        @Override
        public void onError(ServerError error) {
            Debug.logError(error);
            indicator.onCompleted();
        }
    });
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) Void(org.rstudio.studio.client.server.Void) OpenProjectErrorHandler(org.rstudio.studio.client.projects.events.OpenProjectErrorHandler) SessionInitHandler(org.rstudio.studio.client.workbench.events.SessionInitHandler) Handler(org.rstudio.core.client.command.Handler) SwitchToProjectHandler(org.rstudio.studio.client.projects.events.SwitchToProjectHandler) OpenProjectFileHandler(org.rstudio.studio.client.projects.events.OpenProjectFileHandler) OpenProjectNewWindowHandler(org.rstudio.studio.client.projects.events.OpenProjectNewWindowHandler)

Example 7 with ProgressIndicator

use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.

the class Projects method handleNewProject.

private void handleNewProject(boolean forceSaveAll, final boolean allowOpenInNewWindow) {
    // first resolve the quit context (potentially saving edited documents   
    // and determining whether to save the R environment on exit)
    applicationQuit_.prepareForQuit("Save Current Workspace", forceSaveAll, new ApplicationQuit.QuitContext() {

        @Override
        public void onReadyToQuit(final boolean saveChanges) {
            projServer_.getNewProjectContext(new SimpleRequestCallback<NewProjectContext>() {

                @Override
                public void onResponseReceived(NewProjectContext context) {
                    NewProjectWizard wiz = new NewProjectWizard(session_.getSessionInfo(), pUIPrefs_.get(), pWorkbenchContext_.get(), new NewProjectInput(FileSystemItem.createDir(pUIPrefs_.get().defaultProjectLocation().getValue()), context), allowOpenInNewWindow, new ProgressOperationWithInput<NewProjectResult>() {

                        @Override
                        public void execute(NewProjectResult newProject, ProgressIndicator indicator) {
                            indicator.onCompleted();
                            createNewProject(newProject, saveChanges);
                        }
                    });
                    wiz.showModal();
                }
            });
        }
    });
}
Also used : NewProjectResult(org.rstudio.studio.client.projects.model.NewProjectResult) NewProjectContext(org.rstudio.studio.client.projects.model.NewProjectContext) ApplicationQuit(org.rstudio.studio.client.application.ApplicationQuit) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) NewProjectInput(org.rstudio.studio.client.projects.model.NewProjectInput) NewProjectWizard(org.rstudio.studio.client.projects.ui.newproject.NewProjectWizard) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback)

Example 8 with ProgressIndicator

use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.

the class RSConnect method publishWithWizard.

private void publishWithWizard(final RSConnectPublishInput input) {
    RSConnectPublishWizard wizard = new RSConnectPublishWizard(input, new ProgressOperationWithInput<RSConnectPublishResult>() {

        @Override
        public void execute(RSConnectPublishResult result, ProgressIndicator indicator) {
            switch(result.getPublishType()) {
                case RSConnectPublishResult.PUBLISH_STATIC:
                case RSConnectPublishResult.PUBLISH_CODE:
                    // always launch the browser--the wizard implies we're 
                    // doing a first-time publish, and we may need to do some
                    // post-publish configuration
                    fireRSConnectPublishEvent(result, true);
                    indicator.onCompleted();
                    break;
                case RSConnectPublishResult.PUBLISH_RPUBS:
                    uploadToRPubs(input, result, indicator);
                    break;
            }
        }
    });
    wizard.showModal();
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) RSConnectPublishResult(org.rstudio.studio.client.rsconnect.model.RSConnectPublishResult) RSConnectPublishWizard(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishWizard)

Example 9 with ProgressIndicator

use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.

the class HTMLPreviewPresenter method onSaveHtmlPreviewAs.

@Handler
public void onSaveHtmlPreviewAs() {
    if (lastSuccessfulPreview_ != null) {
        FileSystemItem defaultDir = savePreviewDir_ != null ? FileSystemItem.createDir(savePreviewDir_) : FileSystemItem.home();
        final FileSystemItem sourceFile = FileSystemItem.createFile(lastSuccessfulPreview_.getHtmlFile());
        FileSystemItem initialFilePath = FileSystemItem.createFile(defaultDir.completePath(sourceFile.getStem()));
        fileDialogs_.saveFile("Save File As", fileSystemContext_, initialFilePath, sourceFile.getExtension(), false, new ProgressOperationWithInput<FileSystemItem>() {

            @Override
            public void execute(FileSystemItem targetFile, ProgressIndicator indicator) {
                if (targetFile == null || sourceFile.equalTo(targetFile)) {
                    indicator.onCompleted();
                    return;
                }
                indicator.onProgress("Saving File...");
                server_.copyFile(sourceFile, targetFile, true, new VoidServerRequestCallback(indicator));
                savePreviewDir_ = targetFile.getParentPathString();
                session_.persistClientState();
            }
        });
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) CloseHandler(com.google.gwt.event.logical.shared.CloseHandler) Handler(org.rstudio.core.client.command.Handler)

Example 10 with ProgressIndicator

use of org.rstudio.core.client.widget.ProgressIndicator in project rstudio by rstudio.

the class ProfilerEditingTarget method saveNewFile.

private void saveNewFile(final String suggestedPath) {
    FileSystemItem fsi;
    if (suggestedPath != null)
        fsi = FileSystemItem.createFile(suggestedPath).getParentPath();
    else
        fsi = workbenchContext_.getDefaultFileDialogDir();
    fileDialogs_.saveFile("Save File - " + getName().getValue(), fileContext_, fsi, fileType_.getDefaultExtension(), false, new ProgressOperationWithInput<FileSystemItem>() {

        public void execute(final FileSystemItem saveItem, final ProgressIndicator indicator) {
            if (saveItem == null)
                return;
            workbenchContext_.setDefaultFileDialogDir(saveItem.getParentPath());
            final String toPath = saveItem.getPath();
            server_.copyProfile(htmlLocalPath_, toPath, new ServerRequestCallback<JavaScriptObject>() {

                @Override
                public void onResponseReceived(JavaScriptObject response) {
                    savePropertiesWithPath(saveItem.getPath());
                    persistDocumentProperty("isUserSaved", "saved");
                    isUserSaved_ = true;
                    indicator.onCompleted();
                }

                @Override
                public void onError(ServerError error) {
                    Debug.logError(error);
                    indicator.onCompleted();
                    globalDisplay_.showErrorMessage("Failed to Save Profile", error.getMessage());
                }
            });
        }
    });
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) ServerRequestCallback(org.rstudio.studio.client.server.ServerRequestCallback)

Aggregations

ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)51 ServerError (org.rstudio.studio.client.server.ServerError)26 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)16 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)15 Handler (org.rstudio.core.client.command.Handler)12 GlobalProgressDelayer (org.rstudio.studio.client.common.GlobalProgressDelayer)8 ProgressOperation (org.rstudio.core.client.widget.ProgressOperation)7 Command (com.google.gwt.user.client.Command)6 JsArrayString (com.google.gwt.core.client.JsArrayString)5 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)5 ProgressOperationWithInput (org.rstudio.core.client.widget.ProgressOperationWithInput)5 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)5 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Operation (org.rstudio.core.client.widget.Operation)4 SourceLocation (org.rstudio.studio.client.common.synctex.model.SourceLocation)4 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 CloseHandler (com.google.gwt.event.logical.shared.CloseHandler)3 JSONString (com.google.gwt.json.client.JSONString)3 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)3