Search in sources :

Example 1 with PackratPrerequisites

use of org.rstudio.studio.client.packrat.model.PackratPrerequisites in project rstudio by rstudio.

the class ProjectPackratPreferencesPane method verifyPrerequisites.

private void verifyPrerequisites() {
    final ProgressIndicator indicator = getProgressIndicator();
    indicator.onProgress("Verifying prequisites...");
    server_.getPackratPrerequisites(new ServerRequestCallback<PackratPrerequisites>() {

        @Override
        public void onResponseReceived(PackratPrerequisites prereqs) {
            indicator.onCompleted();
            if (prereqs.getBuildToolsAvailable()) {
                if (prereqs.getPackageAvailable()) {
                    setUsePackrat(true);
                } else {
                    setUsePackrat(false);
                    // install packrat (with short delay to allow
                    // the progress indicator to clear)
                    new Timer() {

                        @Override
                        public void run() {
                            dependencyManager_.withPackrat("Managing packages with packrat", new Command() {

                                @Override
                                public void execute() {
                                    setUsePackrat(true);
                                }
                            });
                        }
                    }.schedule(250);
                }
            } else {
                setUsePackrat(false);
                // install build tools (with short delay to allow
                // the progress indicator to clear)
                new Timer() {

                    @Override
                    public void run() {
                        server_.installBuildTools("Managing packages with Packrat", new SimpleRequestCallback<Boolean>() {
                        });
                    }
                }.schedule(250);
            }
        }

        @Override
        public void onError(ServerError error) {
            setUsePackrat(false);
            indicator.onError(error.getUserMessage());
        }
    });
}
Also used : PackratPrerequisites(org.rstudio.studio.client.packrat.model.PackratPrerequisites) Timer(com.google.gwt.user.client.Timer) Command(com.google.gwt.user.client.Command) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError)

Aggregations

Command (com.google.gwt.user.client.Command)1 Timer (com.google.gwt.user.client.Timer)1 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)1 PackratPrerequisites (org.rstudio.studio.client.packrat.model.PackratPrerequisites)1 ServerError (org.rstudio.studio.client.server.ServerError)1