Search in sources :

Example 1 with ProcessCallback

use of org.rstudio.studio.client.workbench.views.vcs.common.ProcessCallback in project rstudio by rstudio.

the class SVNCommandHandler method onVcsResolve.

@Handler
void onVcsResolve() {
    ArrayList<StatusAndPath> items = display_.getSelectedItems();
    if (items.size() == 0)
        return;
    final ArrayList<String> paths = new ArrayList<String>();
    boolean conflict = false;
    for (StatusAndPath item : items) {
        paths.add(item.getPath());
        if ("C".equals(item.getStatus()))
            conflict = true;
        else if (item.isDirectory())
            conflict = true;
    }
    Operation resolveOperation = new Operation() {

        @Override
        public void execute() {
            new SVNResolveDialog(paths.size(), "Resolve", new OperationWithInput<String>() {

                @Override
                public void execute(String input) {
                    server_.svnResolve(input, paths, new ProcessCallback("SVN Resolve"));
                }
            }).showModal();
        }
    };
    if (conflict) {
        resolveOperation.execute();
    } else {
        String message = (paths.size() > 1 ? "None of the selected paths appear to have conflicts." : "The selected path does not appear to have conflicts.") + "\n\nDo you want to resolve anyway?";
        globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_WARNING, "No Conflicts Detected", message, resolveOperation, true);
    }
}
Also used : ProcessCallback(org.rstudio.studio.client.workbench.views.vcs.common.ProcessCallback) StatusAndPath(org.rstudio.studio.client.common.vcs.StatusAndPath) ArrayList(java.util.ArrayList) OperationWithInput(org.rstudio.core.client.widget.OperationWithInput) Operation(org.rstudio.core.client.widget.Operation) Handler(org.rstudio.core.client.command.Handler)

Example 2 with ProcessCallback

use of org.rstudio.studio.client.workbench.views.vcs.common.ProcessCallback in project rstudio by rstudio.

the class SVNCommandHandler method doRevert.

private void doRevert(final ArrayList<String> revertList, final Command onRevertConfirmed) {
    String noun = revertList.size() == 1 ? "file" : "files";
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_WARNING, "Revert Changes", "Changes to the selected " + noun + " will be reverted.\n\n" + "Are you sure you want to continue?", new Operation() {

        @Override
        public void execute() {
            if (onRevertConfirmed != null)
                onRevertConfirmed.execute();
            server_.svnRevert(revertList, new ProcessCallback("SVN Revert"));
        }
    }, false);
}
Also used : ProcessCallback(org.rstudio.studio.client.workbench.views.vcs.common.ProcessCallback) Operation(org.rstudio.core.client.widget.Operation)

Aggregations

Operation (org.rstudio.core.client.widget.Operation)2 ProcessCallback (org.rstudio.studio.client.workbench.views.vcs.common.ProcessCallback)2 ArrayList (java.util.ArrayList)1 Handler (org.rstudio.core.client.command.Handler)1 OperationWithInput (org.rstudio.core.client.widget.OperationWithInput)1 StatusAndPath (org.rstudio.studio.client.common.vcs.StatusAndPath)1