Difference between revisions of "Extending the Pretty Print Page"

From Event-B
Jump to navigationJump to search
imported>Tommy
m
imported>Tommy
Line 15: Line 15:
  
 
== How to contribute to the Pretty Print Page ==
 
== How to contribute to the Pretty Print Page ==
 +
 +
When contributing to the Event-B Editor, one uses the extension point <tt>org.eventb.ui.editorItems</tt>.
 +
This extension point defines extensions from which two of them have been updated in order to contribute to the pretty print page:
 +
 +
Those updated extensions are :
 +
* <tt>element</tt>
 +
:<tt>element</tt> has been extended with a child called <tt>prettyPrinter</tt> where the name of the class that will be used to pretty print the element in the pretty print view shall be given. This class must moreover implement <tt>org.eventb.ui.IElementPrettyPrinter</tt>.
 +
 +
* <tt>childRelation</tt>
 +
:the child element <tt>childType</tt> of a <tt>childRelation</tt> has been extended with <tt>implicitChildProvider</tt> where the name of the class that will be used to retrieve implicit children of this type in the pretty print view shall be given. The class must moreover implement <tt>org.eventb.ui.IImplicitChildProvider</tt>.
 +
 +
Hence, one that wants to contribute to the pretty print page for added items, must at least provide a <tt>prettyPrinter</tt> for each of those added items, and if needed, an <tt>implicitChildProvider</tt>, that will harvest the implicit children of the given type that should also be displayed.
  
 
== How the Pretty Print Page is created ==
 
== How the Pretty Print Page is created ==
  
 
== How to implement pretty printers (of Event-B Editor contributions) ==
 
== How to implement pretty printers (of Event-B Editor contributions) ==

Revision as of 13:30, 15 April 2010

The Petty Print Page of the Event-B Editor provides a rendered view of an edited machine or context, for an quicker and easier reading.

An example of pretty print page

As a mechanism is available to extend Rodin's Structured Editor, such a mechanism also exists in order to extend the Pretty Print Page. For each element to be displayed, a "pretty printer" is defined within the element extension of the structured editor.

We will have a look at :

  • how the extensions can contribute to the pretty print page,
  • how the pretty print page is created,
  • how to implement pretty printers.

How to contribute to the Pretty Print Page

When contributing to the Event-B Editor, one uses the extension point org.eventb.ui.editorItems. This extension point defines extensions from which two of them have been updated in order to contribute to the pretty print page:

Those updated extensions are :

  • element
element has been extended with a child called prettyPrinter where the name of the class that will be used to pretty print the element in the pretty print view shall be given. This class must moreover implement org.eventb.ui.IElementPrettyPrinter.
  • childRelation
the child element childType of a childRelation has been extended with implicitChildProvider where the name of the class that will be used to retrieve implicit children of this type in the pretty print view shall be given. The class must moreover implement org.eventb.ui.IImplicitChildProvider.

Hence, one that wants to contribute to the pretty print page for added items, must at least provide a prettyPrinter for each of those added items, and if needed, an implicitChildProvider, that will harvest the implicit children of the given type that should also be displayed.

How the Pretty Print Page is created

How to implement pretty printers (of Event-B Editor contributions)