summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java32
1 files changed, 15 insertions, 17 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
index abc4b5b794c2..551431dd7f16 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/lock/CmdLockClient.java
@@ -5,15 +5,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.api.ProgressTracker;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
import org.tmatesoft.svn.core.SVNErrorMessage;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.wc.ISVNEventHandler;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
import org.tmatesoft.svn.core.wc2.SvnTarget;
import java.io.File;
@@ -26,22 +25,22 @@ import java.util.List;
public class CmdLockClient extends BaseSvnClient implements LockClient {
@Override
- public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = prepareParameters(file, force);
parameters.add("--message");
parameters.add(message);
CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.lock, parameters, null);
- handleCommandCompletion(command, file, SVNEventAction.LOCKED, SVNEventAction.LOCK_FAILED, handler);
+ handleCommandCompletion(command, file, EventAction.LOCKED, EventAction.LOCK_FAILED, handler);
}
@Override
- public void unlock(@NotNull File file, boolean force, @Nullable ISVNEventHandler handler) throws VcsException {
+ public void unlock(@NotNull File file, boolean force, @Nullable ProgressTracker handler) throws VcsException {
List<String> parameters = prepareParameters(file, force);
CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.unlock, parameters, null);
- handleCommandCompletion(command, file, SVNEventAction.UNLOCKED, SVNEventAction.UNLOCK_FAILED, handler);
+ handleCommandCompletion(command, file, EventAction.UNLOCKED, EventAction.UNLOCK_FAILED, handler);
}
private static List<String> prepareParameters(@NotNull File file, boolean force) {
@@ -55,9 +54,9 @@ public class CmdLockClient extends BaseSvnClient implements LockClient {
private static void handleCommandCompletion(@NotNull CommandExecutor command,
@NotNull File file,
- @NotNull SVNEventAction success,
- @NotNull SVNEventAction failure,
- @Nullable ISVNEventHandler handler) throws VcsException {
+ @NotNull EventAction success,
+ @NotNull EventAction failure,
+ @Nullable ProgressTracker handler) throws VcsException {
// just warning appears in output when can not lock/unlock file for some reason (like, that file is already locked)
SVNErrorMessage error = SvnUtil.parseWarning(command.getErrorOutput());
@@ -70,17 +69,16 @@ public class CmdLockClient extends BaseSvnClient implements LockClient {
}
private static void invokeHandler(@NotNull File file,
- @NotNull SVNEventAction action,
- @Nullable ISVNEventHandler handler,
+ @NotNull EventAction action,
+ @Nullable ProgressTracker handler,
@Nullable SVNErrorMessage error)
throws SVNException {
if (handler != null) {
- handler.handleEvent(createEvent(file, action, error), 1);
+ handler.consume(createEvent(file, action, error));
}
}
- private static SVNEvent createEvent(@NotNull File file, @NotNull SVNEventAction action, @Nullable SVNErrorMessage error) {
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE, null, -1, null, null, null, null, action, action,
- error, null, null, null, null);
+ private static ProgressEvent createEvent(@NotNull File file, @NotNull EventAction action, @Nullable SVNErrorMessage error) {
+ return new ProgressEvent(file, -1, null, null, action, error, null);
}
}