aboutsummaryrefslogtreecommitdiff
path: root/src/com/cyanogenmod/filemanager/commands/java/Program.java
diff options
context:
space:
mode:
authorMartin Brabham <optedoblivion@cyngn.com>2015-04-02 20:33:41 -0700
committerMatt Garnes <matt@cyngn.com>2015-04-13 17:20:34 +0000
commit948e0d1d3407d8e611d0d82aac2f399703a494e3 (patch)
tree3c3cd6b89fee93a9e149c56dbadb6f0e4c2eee1f /src/com/cyanogenmod/filemanager/commands/java/Program.java
parent17388c6d5436f7736b38e11dda30a8a7fd0e17f6 (diff)
Implement ability to cancel file copy.
- Short circuit Java CopyCommand for move/copy when the user cancels the dialog. - Bubble up CancelledOperationException when the Cancel/Move operation is cancelled. Handle cancellation differently than success. Change-Id: I3e4426aaccf42e12bf299041d489e72b3b76a626 (cherry picked from commit 7e13ec2fa4fc052c2a880a8dba8ed871b3bc10ca)
Diffstat (limited to 'src/com/cyanogenmod/filemanager/commands/java/Program.java')
-rw-r--r--src/com/cyanogenmod/filemanager/commands/java/Program.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/filemanager/commands/java/Program.java b/src/com/cyanogenmod/filemanager/commands/java/Program.java
index b5eeebd..34e70cc 100644
--- a/src/com/cyanogenmod/filemanager/commands/java/Program.java
+++ b/src/com/cyanogenmod/filemanager/commands/java/Program.java
@@ -17,6 +17,7 @@
package com.cyanogenmod.filemanager.commands.java;
import com.cyanogenmod.filemanager.commands.Executable;
+import com.cyanogenmod.filemanager.console.CancelledOperationException;
import com.cyanogenmod.filemanager.console.ExecutionException;
import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory;
@@ -29,6 +30,7 @@ public abstract class Program implements Executable {
private boolean mTrace;
private int mBufferSize;
+ private boolean mCancelled = false;
/**
* Constructor of <code>Program</code>
@@ -92,6 +94,14 @@ public abstract class Program implements Executable {
* @throws ExecutionException If the operation returns a invalid exit code
*/
public abstract void execute()
- throws InsufficientPermissionsException, NoSuchFileOrDirectory, ExecutionException;
+ throws InsufficientPermissionsException, NoSuchFileOrDirectory, ExecutionException,
+ CancelledOperationException;
+ public void requestCancel() {
+ mCancelled = true;
+ }
+
+ public boolean isCancelled() {
+ return mCancelled;
+ }
}