2. The JessDE Developer's Environment
Jess includes an Eclipse-based development environment. There is an editor, a debugger, and a Rete network viewer. More components (a rule browser and other tools) may be included in future releases.
2.1. Installing the JessDE
The Jess Developer's Environment (JessDE) is a set of plugins for the popular open-source IDE Eclipse; in particular, these are plugins for Eclipse version 3.7 or later. Note that the JessDE requires a full version of Eclipse that includes the Java Development Tools (JDT) -- the smaller "Platform Runtime Binary" is insufficient.
To install the JessDE, you use the Eclipse "Update Site" facility. *** INSTRUCTIONS TBD ***
2.1.1. Verifying your installation
Under the "Help" menu, choose "about Eclipse SDK". There will be a button with the Jess logo on it on the main "About Eclipse SDK" window. Press "Plug-in Details". If the JessDE is installed properly, you'll find three or four Jess-related plugins in the list -- in my copy of Eclipse, they appear near the bottom.
Then create a "Java Project" using the "New Project" wizard. Create a new file in that project, and name it "hello.clp". It should open in the Jess editor, which has a little silver ball with a red "J" as its icon. Enter some Jess code, like
(printout t "Hello, World" crlf)
You should see appropriate syntax highlighting. If so, congratulations, everything is working! Read on for more information about the other features of the JessDE.
2.1.2. A few more details
The JessDE editor creates problem markers to point out syntax errors and warnings in your Jess documents. You most likely want to have these markers show up in the Eclipse "Problems" view, although they might not show up by default. After installing the JessDE and restarting Eclipse, in the Problems view, click on the "Filters" icon in the title bar, and check the box labelled "Jess Problem" (if it's not already checked.) Your Problems view should now display Jess errors and warnings.
To use the Rete Network View, you'll need to have the Eclipse Graph Editing Framework (GEF) installed. Most current Eclipse distributions already include the GEF, but if yours does not you can get it from the Eclipse project page here, or install it through Eclipse's built-in update manager. Then to display this view, find it under the "Jess Debugger" group in Eclipse's "Show view" dialog. Then when the cursor is inside a rule in a Jess editor window, the Rete Network View will show the compiled network for that rule.
2.2. Using the JessDE
2.2.1. The Jess language editor
The JessDE editor can edit ".clp" files. By default, any file you create with the extension "clp" will be opened using the JessDE editor. There's no separate Jess perspective, or Jess project type; we expect that most people will use the JessDE tools to write the Jess components of a hybrid Jess/Java application, and so the tools expect to be used on files in a Java project. The JessDE uses your Java project's class path to resolve Java class names used in Jess language code -- i.e., in a call to the defclass function.
The editor has all the features you'd expect from a modern programmer's editor.
- Syntax coloring you can customize.
- You can change the default colors using the "Jess Editor" tab of the Eclipse global preferences dialog.
- Content assistant supplies deftemplate, slot and function names.
- You can invoke Eclipse's "Content Assist" feature in many different places within the JessDE editor; JessDE will make it much easier to enter Jess code. Press Alt-'/' while typing to produce a list of choices.
- "Quick fix" assistant can repair code automatically
- This feature is bound to Ctrl-1 by default. Quick fix currently knows how to define undefined deftemplates, and add new slots to existing deftemplates (if they're defined in the same file.)
- Real-time error checking with markers and error highlighting
- Errors and warnings are highlighted as you type
- Automatic code formatting
- Code is indented as you type. You can also choose "Format" from the "Source" menu to format an entire buffer.
- Fast navigation using outline view
- The Eclipse outline view lists all the constructs defined in a buffer; you can click on any one of them to quickly navigate to it.
- Parenthesis matching and auto-insertion
- When you type a '(' or '"' character, JessDE insert the matching character as well. When your cursor is next to a parenthesis, JessDE shows you the matching parenthesis.
- Online help for Jess functions and constructs via "hovers"
- You have quick access to the Jess manual description of every function and construct type.
- Help hovers for deftemplates and deffunctions
- If you hold your mouse over the name of a deftemplate or deffunction, anywhere in the code, JessDE will show a "tooltip" containing information about that template or function.
- Run and Debug commands for Jess programs
- You can run or debug a Jess program using the normal Eclipse "Run..." menu or by right clicking on Navigator items or in the edit window.
2.2.2. Dependencies among files
Sometimes one *.clp file depends on code in some other *.clp file having been read first; for example, rules.clp might need the definitions in templates.clp. Without these definitions, rules.clp will appear to have syntax errors. To deal with this, you can use the require* function. "require*" lets you explicitly declare these dependencies.
If a file rules.clp depends on Jess commands being executed from Java, you can deal with this by creating a special file just for this purpose (you might call it ruledepends.clp). That special file can contain whatever declarations are needed to make rule.clp parse properly in the editor. If you add "(require* ruledepends)" to rules.clp, then this extra file will be parsed only if it's present, as it will be during development. When you deploy the code, you can simply not deploy ruledepends.clp, and allow rules.clp to get its declarations from Java code.
The "require" mechanism replaces the "Source dependencies" property sheet from earlier versions of JessDE, which is no longer supported.
2.2.3. The Rete Network view
You can instantly see a graphical representation of the Rete network derived from any rule using the JessDE's "Rete Network View". When this view is open (you can open it using the "Windows | View | Other..." dialog in Eclipse) it will display the Rete network for the rule that the editor caret is in. You can use this to see, in real time, how modifying a rule changes the Rete network. The graph layout is far superior to that you get from the Jess "view" command -- there are no overlapping or crossing lines, and the height of each "column" can vary.