Mercurial > jhg
diff src/org/tmatesoft/hg/core/HgAbstractCommand.java @ 322:d68dcb3b5f49
Propagate command's CancelSupport to low-level API. CancelSupport from context got priority over one from command
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 30 Sep 2011 08:00:04 +0200 |
parents | 41a778e3fd31 |
children |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgAbstractCommand.java Fri Sep 30 07:59:22 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgAbstractCommand.java Fri Sep 30 08:00:04 2011 +0200 @@ -49,12 +49,20 @@ return ProgressSupport.Factory.get(context); } - // shall not return null - protected CancelSupport getCancelSupport(Object context) { + // shall not return null if create is true + // CancelSupport from context, if any, takes precedence + protected CancelSupport getCancelSupport(Object context, boolean create) { + CancelSupport rv = CancelSupport.Factory.get(context, null); + if (rv != null) { + return rv; + } if (cancelHelper != null) { return cancelHelper; } - return CancelSupport.Factory.get(context); + if (create) { + return CancelSupport.Factory.get(null); + } + return null; } }