|
47 | 47 | import org.scijava.ItemVisibility; |
48 | 48 | import org.scijava.Locatable; |
49 | 49 | import org.scijava.ValidityProblem; |
| 50 | +import org.scijava.Versioned; |
50 | 51 | import org.scijava.event.EventService; |
51 | 52 | import org.scijava.module.Module; |
52 | 53 | import org.scijava.module.ModuleException; |
|
58 | 59 | import org.scijava.plugin.PluginInfo; |
59 | 60 | import org.scijava.service.Service; |
60 | 61 | import org.scijava.util.ClassUtils; |
| 62 | +import org.scijava.util.Manifest; |
61 | 63 | import org.scijava.util.StringMaker; |
62 | 64 |
|
63 | 65 | /** |
|
77 | 79 | * commands and the rich {@link Module} interface. |
78 | 80 | */ |
79 | 81 | public class CommandInfo extends PluginInfo<Command> implements ModuleInfo, |
80 | | - Identifiable, Locatable |
| 82 | + Identifiable, Locatable, Versioned |
81 | 83 | { |
82 | 84 |
|
83 | 85 | /** Wrapped {@link PluginInfo}, if any. */ |
@@ -435,6 +437,19 @@ public String getLocation() { |
435 | 437 | } |
436 | 438 | } |
437 | 439 |
|
| 440 | + // -- Versioned methods -- |
| 441 | + |
| 442 | + @Override |
| 443 | + public String getVersion() { |
| 444 | + try { |
| 445 | + final Manifest m = Manifest.getManifest(loadDelegateClass()); |
| 446 | + return m == null ? null : m.getImplementationVersion(); |
| 447 | + } |
| 448 | + catch (final ClassNotFoundException exc) { |
| 449 | + return null; |
| 450 | + } |
| 451 | + } |
| 452 | + |
438 | 453 | // -- Helper methods -- |
439 | 454 |
|
440 | 455 | /** |
|
0 commit comments