Mercurial > hg4j
comparison 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 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 321:ac38e75c9e8e | 322:d68dcb3b5f49 | 
|---|---|
| 47 return progressHelper; | 47 return progressHelper; | 
| 48 } | 48 } | 
| 49 return ProgressSupport.Factory.get(context); | 49 return ProgressSupport.Factory.get(context); | 
| 50 } | 50 } | 
| 51 | 51 | 
| 52 // shall not return null | 52 // shall not return null if create is true | 
| 53 protected CancelSupport getCancelSupport(Object context) { | 53 // CancelSupport from context, if any, takes precedence | 
| 54 protected CancelSupport getCancelSupport(Object context, boolean create) { | |
| 55 CancelSupport rv = CancelSupport.Factory.get(context, null); | |
| 56 if (rv != null) { | |
| 57 return rv; | |
| 58 } | |
| 54 if (cancelHelper != null) { | 59 if (cancelHelper != null) { | 
| 55 return cancelHelper; | 60 return cancelHelper; | 
| 56 } | 61 } | 
| 57 return CancelSupport.Factory.get(context); | 62 if (create) { | 
| 63 return CancelSupport.Factory.get(null); | |
| 64 } | |
| 65 return null; | |
| 58 } | 66 } | 
| 59 | 67 | 
| 60 } | 68 } | 
