Navigation:  Application Architecture > Structure of a ClearCanvas Application > Tools >

Tools as Action providers

Previous pageReturn to chapter overviewNext page

In order for a tool to be useful, the user must be able to interact with it.  Therefore, it would make sense for a tool to provide a set of actions to be integrated somehow into the user-interface.  For this reason, ITool exposes an Actions property, which simply returns a set of IAction objects that are typically configured to call back to methods on the tool object itself.

The question of how the framework obtains the IAction objects can now be partially answered:  Tools are in fact the primary means of providing actions to the framework.

Although it is possible, as the developer of a tool, to implement the Actions property oneself and return a set of IAction objects constructed at runtime, it is often far simpler (and therefore more common) to use a set of attributes provided by the framework to specify declaratively the set of actions that the tool would like to expose.  These attributes are known as the action attributes, and the abstract base class Tool uses the attributes to automatically construct the appropriate action objects at runtime.  See the appendix “Action Attributes” for more on this topic.