Search in sources :

Example 46 with Operation

use of org.rstudio.core.client.widget.Operation 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 47 with Operation

use of org.rstudio.core.client.widget.Operation 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)47 ServerError (org.rstudio.studio.client.server.ServerError)8 Command (com.google.gwt.user.client.Command)7 ArrayList (java.util.ArrayList)6 ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)5 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)5 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)4 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)4 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)4 JsArrayString (com.google.gwt.core.client.JsArrayString)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)3 ProgressOperation (org.rstudio.core.client.widget.ProgressOperation)3 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 Timer (com.google.gwt.user.client.Timer)2 HTML (com.google.gwt.user.client.ui.HTML)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 WindowEx (org.rstudio.core.client.dom.WindowEx)2 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)2