Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
titleAssignment

In text files, lists can be written like this:

Code Block
* Monday
  * Prepare lecture
  * Meeting
  * Prepare lecture again
* Tuesday
  * Throw away lecture
  * Prepare exam
    * Assignment 1
    * Assignment 2
    * Assignment 3
* Wednesday
  * Do nothing

Create a new project that provides a menu item that fires up a visualization for this kind of list format. The visualization should look something like this:

  1. Start by creating Create a new Plug-in Project.
  2. Create a data structure that represents lists of this kind. This doesn't need to be a fancy EMF model, a simple Java class can be quite enough.
  3. Create a command handler that turns a selected IFile into an instance of your data structure. You can use the command handler from our tutorial as a templateKLighD Project that visualizes String instances. Let the wizard create a context menu item for files with the extension textlist.
  4. The generated command handler will try to let the Eclipse Modeling Framework load the file. Replace this code with code that simply opens the file and reads its content into a String.
  5. Write a synthesis that turns an instance of your data structure String into a KGraph. You can use the synthesis from our tutorial as a template.Register the command handler and the synthesis with Eclipse and KLighD. You can use the plugin.xml from our tutorial as a template.

When parsing the text filestring, you can simply assume that each level of the list gets indented by exactly two spaces, and that the text of each list item starts after an asterisk followed by a space. No need to build fancy error checking into your solution.