Search in sources :

Example 1 with ProcessResult

use of org.rstudio.studio.client.common.vcs.ProcessResult in project rstudio by rstudio.

the class Ignore method showDialog.

public void showDialog(final IgnoreList ignoreList, final Strategy strategy) {
    // show progress
    final ProgressIndicator globalIndicator = new GlobalProgressDelayer(globalDisplay_, 500, "Getting ignored files for path...").getIndicator();
    // get existing ignores
    final String fullPath = projPathToFullPath(ignoreList.getPath());
    strategy.getIgnores(fullPath, new ServerRequestCallback<ProcessResult>() {

        @Override
        public void onResponseReceived(final ProcessResult result) {
            globalIndicator.onCompleted();
            if (checkForProcessError(strategy.getDialogCaption(), result))
                return;
            // show the ignore dialog
            String ignored = getIgnored(ignoreList, result.getOutput());
            showDialog(fullPath, ignored, strategy);
        }

        @Override
        public void onError(ServerError error) {
            globalIndicator.onError(error.getUserMessage());
        }
    });
}
Also used : ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) GlobalProgressDelayer(org.rstudio.studio.client.common.GlobalProgressDelayer) ProcessResult(org.rstudio.studio.client.common.vcs.ProcessResult)

Example 2 with ProcessResult

use of org.rstudio.studio.client.common.vcs.ProcessResult in project rstudio by rstudio.

the class Ignore method showDialog.

private void showDialog(final String initialPath, String ignores, final Strategy strategy) {
    final Display display = pDisplay_.get();
    final ProgressIndicator indicator = display.progressIndicator();
    display.setDialogCaption(strategy.getDialogCaption());
    display.setIgnoresCaption(strategy.getIgnoresCaption());
    display.setHelpLinkName(strategy.getHelpLinkName());
    display.setCurrentPath(initialPath);
    display.setIgnored(ignores);
    display.scrollToBottom();
    display.addPathChangedHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            display.setIgnored("");
            indicator.onProgress("Getting ignored files for path...");
            strategy.getIgnores(display.getCurrentPath(), new ServerRequestCallback<ProcessResult>() {

                @Override
                public void onResponseReceived(final ProcessResult result) {
                    indicator.clearProgress();
                    if (checkForProcessError(strategy.getDialogCaption(), result))
                        return;
                    display.setIgnored(result.getOutput());
                    display.focusIgnored();
                }

                @Override
                public void onError(ServerError error) {
                    indicator.onError(error.getUserMessage());
                }
            });
        }
    });
    display.saveButton().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            indicator.onProgress("Setting ignored files for path...");
            strategy.setIgnores(display.getCurrentPath(), display.getIgnored(), new ServerRequestCallback<ProcessResult>() {

                @Override
                public void onResponseReceived(ProcessResult result) {
                    indicator.onCompleted();
                    checkForProcessError(strategy.getDialogCaption(), result);
                }

                @Override
                public void onError(ServerError error) {
                    indicator.onError(error.getUserMessage());
                }
            });
        }
    });
    display.showModal();
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ProcessResult(org.rstudio.studio.client.common.vcs.ProcessResult) ServerRequestCallback(org.rstudio.studio.client.server.ServerRequestCallback) GlobalDisplay(org.rstudio.studio.client.common.GlobalDisplay)

Aggregations

ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)2 ProcessResult (org.rstudio.studio.client.common.vcs.ProcessResult)2 ServerError (org.rstudio.studio.client.server.ServerError)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 GlobalDisplay (org.rstudio.studio.client.common.GlobalDisplay)1 GlobalProgressDelayer (org.rstudio.studio.client.common.GlobalProgressDelayer)1 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)1