Textual Rule Editor

The rule editor is where rule managers and developers will be spending most of their time. The rule editor follows the pattern of a normal text editor in Eclipse, with all the customary features of a text editor. On top of this, the rule editor provides pop-up content assistance. You invoke pop-up content assistance the "normal" way by pressing Control+Space.

Figure 7.6. The rule editor in action

The rule editor in action

The rule editor works on files that have a .drl (or .rule) extension. Usually these contain related rules, but it would also be possible to have rules in individual files, grouped by being in the same package "namespace", if you so prefer. These DRL files are plain text files.

You can see from the example above that the rule group is using a domain specific language. Note the expander keyword, which tells the rule compiler to look for a dsl file of that name, to resolve the rule language. Even with the domain specific language (DSL) the rules are still stored as plain text as you see it onscreen, which allows simpler management of rules and versions, e.g., comparing versions of rules.

The editor has an outline view that is kept in sync with the structure of the rules; it is updated on save. This provides a quick way of navigating around rules by name, even in a file which may have hundreds of rules. The items are sorted alphabetically by default.

Figure 7.7. The rule outline view

The rule outline view