Stuart McCulloch | 2a0afd6 | 2012-09-06 18:28:06 +0000 | [diff] [blame] | 1 | package aQute.bnd.service; |
| 2 | |
| 3 | import java.util.*; |
| 4 | |
| 5 | /** |
| 6 | * An interface to allow bnd to provide commands on elements. This interface can |
| 7 | * provide information about the implementer but it can also provide information |
| 8 | * about its elements. These elements are identified by a <i>target</i>. A |
| 9 | * target is one or more objects that uniquely identify a child in the |
| 10 | * container. The exact protocol for the target is left to the implementers, |
| 11 | * this interface is just a conduit between the bnd world (no Eclipse etc) and |
| 12 | * the GUI world, using only bnd and java interfaces. |
| 13 | */ |
| 14 | public interface Actionable { |
| 15 | /** |
| 16 | * Return a map with command names (potentially localized) and a Runnable. |
| 17 | * The caller can execute the caller at will. |
| 18 | * |
| 19 | * @param target |
| 20 | * the target object, null if commands for the encompassing |
| 21 | * entity is sought (e.g. the repo itself). |
| 22 | * @return A Map with the actions or null if no actions are available. |
| 23 | * @throws Exception |
| 24 | */ |
| 25 | Map<String,Runnable> actions(Object... target) throws Exception; |
| 26 | |
| 27 | /** |
| 28 | * Return a tooltip for the given target or the encompassing entity if null |
| 29 | * is passed. |
| 30 | * |
| 31 | * @param target |
| 32 | * the target, any number of parameters to identify |
| 33 | * @return the tooltip or null |
| 34 | * @throws Exception |
| 35 | */ |
| 36 | String tooltip(Object... target) throws Exception; |
| 37 | |
| 38 | /** |
| 39 | * Provide a title for an element. |
| 40 | * |
| 41 | * @param target |
| 42 | * the target, any number of parameters to identify |
| 43 | * @return the text for this element |
| 44 | * @throws Exception |
| 45 | */ |
| 46 | |
| 47 | String title(Object... target) throws Exception; |
| 48 | } |