Showing posts with label forms. Show all posts
Showing posts with label forms. Show all posts

Wednesday, January 02, 2008

Cheat Sheet Extensibility

I've been looking at the Eclipse Cheat Sheet capability recently - with a view to using it more as a workflow assistance tool, rather than a "follow these instructions" helper.
As such, the idea of crafting specific tasks that the user can interact with seems an appealing idea.
Here's a screen shot of a simple first attempt.


Note that I've used the Eclipse Forms controls to blend in with the "flat look" layout.
This was pretty easy to get going:
  1. Define a task extension in your plug-in.
    <taskEditor
    class="mypdeproject.tasks.MyTaskExtension"
    icon="icons/sample.gif"
    id="MyPdeProject.taskEditor1">
    </taskEditor>

  2. Define the class referenced above. It needs to implement org.eclipse.ui.internal.provisional.cheatsheets.TaskEditor
  3. Implement the required methods. The main one of which is the createControl method - to create the UI controls used to edit the task.
    public void createControl(Composite comp, 
    FormToolkit toolkit) {

    form = toolkit.createForm(comp);
    form.setText("Hello, Eclipse Forms");

    }
    Obviously, you may want to define a few more fields in there than this.
  4. Define a complex task, and then reference our newly defined task extension.
    <task id="t2" kind="MyPdeProject.taskEditor1" 
    name="Extended task"
    skip="false">
    <intro>
    Introduction Extended
    </intro>
    <onCompletion>
    This is the Conclusion
    </onCompletion>
    </task>

And that's it! Simple really.
Next, I'll take a look at how you can use task variables to communicate between your tasks.