Difference between pages "Refactoring Framework" and "Rodin Editor User Guide"

From Event-B
(Difference between pages)
Jump to navigationJump to search
imported>Renato
 
imported>Tommy
 
Line 1: Line 1:
{| align="right"
+
== Introduction ==
| __TOC__
 
|}
 
  
==News ==
+
The Rodin Editor plug-in provides a structured editor to model in Event-B withing Rodin. This editor uses a textual representation, and edition is done through an overlay text editor and action depending on the caret position in the text.<br>
* ''25th February 2010'': [[#Version_0.0.6|Version 0.0.6]] released. It is based on Rodin 1.2.x.
+
For more details about the principles of this editor,  see [[Rodin_Editor|the Rodin Editor Plug-in page]].<br>
* ''13th January 2010'': [[#Version_0.0.5|Version 0.0.5]] released. It is based on Rodin 1.1.0.
 
* ''5th November 2009'': [[#Version_0.0.4|Version 0.0.4]] released. It is based on Rodin 1.1.0.
 
* ''2nd November 2009'': [[#Version_0.0.4|Version 0.0.4]] released. It is based on Rodin 1.1.0.
 
* ''3rd July 2009'': [[#Version_0.0.2|Version 0.0.2]] released. It is based on Rodin 1.0.
 
* ''1st July 2009'': [[#Version_0.0.1|Version 0.0.1]] released. It is based on Rodin 1.0.0 RC1.
 
  
==The Rename Refactoring Plug-in ==
+
'''IMPORTANT FOR RODIN PLATFORMS BELOW RODIN 2.5''' :  ''we identified a source of concurrency issue in the current version (0.5.0) of the plug-in.''<br>
 +
'''The Rodin Editor is not maintained for these versions of Rodin  since Rodin 2.4. Please try to upgrade your plaform to the latest [[Rodin_Platform_Releases | version of Rodin available]].'''
 +
'''To avoid any trouble, please do not generate files while having some Rodin Editor open, and edit only one model per project at once.'''
  
[[User:Renato]] at [[Southampton]] is in charge of the [[Refactoring Framework]].
+
== Installation ==
  
One of the most recurring requirement from users of the Rodin platform is to have simple means for renaming modeling elements. Users want to have a unique operation that will rename an element both at its declaration and all its occurrences. Moreover, they require that renaming an element doesn't modify their existing proof state (no loss of proof).
+
=== Setup ===
 +
Since Rodin 2.4, the Rodin Editor is part of the core platform (i.e. it is pre-installed and available out of the box).
 +
Once you've installed Rodin 2.4 or upper, you are ready to use the Rodin Editor plug-in.
  
This requirement falls in the more general context of ''refactoring''. In software engineering, "refactoring" source code means improving it without changing its overall results, and is sometimes informally referred to as "cleaning it up". In the case of the Rodin platform, the refactoring framework is related to the first option, where refactoring should not change the overall behaviour of the files/elements, nor loosing proofs.
+
=== Release Notes ===
 +
See [[Rodin_Editor_Release_History | Rodin Editor Release Notes]]
  
The following diagram shows the architecture of the refactoring framework.
 
  
[[Image:Architecture_refactoring_framework.jpg]]
+
== Editing ==
  
==The Rename Refactoring Framework Architecture ==
+
This is a small exercice to get used to the principles of the new structured editor. It is based on the 'Celebrity' project of the tutorial. You can download the resulting project [http://sourceforge.net/projects/rodin-b-sharp/files/Doc_%20Tutorial/1.1/Celebrity.zip/download <tt>here</tt>].<br>
 +
We will here build the context ''Celebrity_C0''.
  
Currently, it is being developed the application of such framework to event-b files (context, machines, proofs obligations, etc) and elements (constants, variables, carrier sets, etc). There are still some tests to be run for the different elements of contexts and machines. The next goal would be to apply and use this framework on Rodin (together with file editors or perspectives).
+
=== Create a context, add elements to it ===
 +
Let's create a Rodin project, and add a context component called ''Celebrity_C0'' to it.<br>
 +
-- By opening this context with the Rodin Editor (right click > Open with > Rodin Editor) you shall obtain the following:<br>
 +
[[Image:RodinEditor_UserGuide_step1.png]]
  
[[Image:RefTree.jpg‎]]
+
This editor allows to do things based on the position of the caret.<br>
 +
-- The caret is place at the front of the context name, and this is fine because we want to add a constant
 +
to the context.
 +
-- To add a constant, right click and select '[Child]-> Add Constant' as in the picture below:
  
==== Refactoring Trees after processing the extension points ====
+
[[Image:RodinEditor_UserGuide_step3.png|400px]]
  
Since there are proof obligations associated with Event-B files, while renaming the goal would be to cause the less effort as possible on re-proving and if possible re-using the proofs that are already discharged. The refactoring should not change the semantic of any of the elements/files. Instead, it should just change names or labels, so the proofs should not have to be re-generated (nor re-discharged). That is one of final goals while applying of this framework to Event-B.
+
-- Save the file. <br>
 +
After saving the file, the error markers are recalculated, and you have an error that appears on the newly created constant 'cst1'.<br>
 +
You shall see something like this :
  
==Initial Work ==
+
[[Image:RodinEditor_UserGuide_step4.png|400px]]
  
Initial work towards implementation of this framework is described in [http://www.stups.uni-duesseldorf.de/thesis_detail.php?id=9 Sonja Holl's Bachelor thesis]
+
Note that you can visualize the error message by going over the error marker with the mouse.
  
==Installing/Updating ==
+
-- Now we enter the edition mode by clicking inside the label 'cst1', as we want to name the constant 'cst1' to 'k'.
  
The installation or update for the renaming/refactoring plug-in is available under the main Rodin Update site (http://rodin-b-sharp.sourceforge.net/updates). Like always, after the installation, restarting the application is recommended.
+
[[Image:RodinEditor_UserGuide_step5.png|550px]]
  
==Usage ==
+
The overlay editor then appears (the background is grey and a box is drawn[see above]) and you can modify the label of the constant.<br>
 +
-- Modify the label to be 'k'and exit the overlay edition by pressing 'Enter' or click next to k. ''Note that because 'Enter' is used to enter or exit the overlay mode under the caret, in order to insert carriage return in text, you have to press CTRL+ENTER (Apple+Enter) on mac platforms.<br>''
 +
You can then save the file. <br>
 +
You then see something like the following.
  
The Renaming/Refactory plug-in allows the renaming of:
+
[[Image:RodinEditor_UserGuide_step6.png|300px]]
  
* Variables
+
Then we want to give this constant an integer type. As the caret is near 'k', and k is a constant, we will use '[Sibling]-> Add sibling' command to add an axiom.<br>
* Parameters
+
-- Right-click and select "[Sibling]-> Add Axiom" you see then that a new axiom was created, named 'axm1'.
* Carrier Sets
 
* Constants
 
* Events
 
* Other labelled elements (invariants, axioms, guards, etc)
 
  
====Requirements before using ====
+
[[Image:RodinEditor_UserGuide_step8.png|400px]]
  
Before using the renaming/refactory, all the files in the project should be saved ( it will be asked to save if there are unsaved files). There should be no errors in the project, otherwise it could lead to even more errors after applying the renaming (warning).
+
You've just created an axiom that you can edit to give the constant k a type.
 +
You can then enter the overlay edition mode to change this value to 'k : INT'.<br>
 +
After saving the file, you obtain the following context :
  
==== Steps of usage ====
+
[[Image:RodinEditor_UserGuide_step9.png|500px]]
  
# User selects element to be renamed at the Event-B Explorer
+
and the markers disappear because there is no error left in your context.
# By right clicking in the element, there should appear an option 'Refactory...'. Selecting that option should open a wizard [[Image:refactory menu.png]]
+
Finally, suppose that the axiom axm1 should be considered as a theorem, click on not theorem after the axiom formula, to change the attribute of the predicate to a theorem.
# User introduces new element name in the first page of the wizard. Then click in 'Next'. [[Image:new_name_wizard.png]]
 
# A list of related files is created and the plug-in check for possible clashes and returns a report
 
# User decides if he wants to execute renaming (by clicking in 'Finish')
 
  
 +
''' CONGRATULATIONS! You learned how to use the Rodin Editor.'''
 +
You learned that :
 +
# To create an element:
 +
## or you place the caret before the label of its parent, and create a child using '[Child]->Add xxx' where xxx is the type of element you want to add, from the contextual menu,
 +
## or you place the caret next to a sibling element and you create a sibling using '[Sibling]->Add xxx' where xxx is the type of element you want to add, from the contextual menu.
 +
# To edit the attributes of an element:
 +
## you enter the overlay edition with left click or with "ENTER" and modify the textual contents,
 +
## you press 'ENTER' to quit overlay edition (or click outside the overlay editor).
  
 
+
=== Select, Move and delete elements ===
       
 
[[Image:refactory_report_wizard.png]]
 
  
 +
-- To select elements, you can double-click on them, or press CTRL and click on one element. The selected elements appear with a blue background,
 +
or a gray background if they are of different types. See the picture below.
  
== Bugs, Features and Comments ==
+
[[Image:RodinEditor_UserGuide_step11.png|350px]]
  
''Any reports of bugs, features or comments are welcome. You can add any of them here.''
+
-- To unselect element, by default, press ESC.
  
====Bugs ====
+
-- To move elements, try both:
* Renaming does not work when renamed element is in variant (fixed in v0.0.5)
+
* Move Up and Move Down commands in the context menu, once elements are selected,
* Renaming proofs did not propagate over related files (fixed in v0.0.5)
+
* Drag and drop on the selection.
  
====Features Request====
+
-- To delete elements, try both:
* Implement UNDO for renaming
+
* Use the 'Delete' command on a selection from the context menu,
 +
* Press the DEL or SUPPR key after selecting the elements you want to delete.
  
====Comments ====
+
=== Using keyboard shorcuts ===
* Renaming proofs ensures that all the discharged proof obligations remain discharged after the renaming (fixed in v0.0.6)
+
Here is the list of the currently key bindings which are set by default and specific to the Rodin Editor.
  
== Releases ==
+
{{SimpleHeader}}
 
+
|-
=====Version 0.0.6 =====
+
! scope=col | KEY SEQUENCE || ACTION
 
+
|-
''25th February 2010''
+
| BACKSPACE (ENTER) || Enter the edition mode using the overlay editor if the caret is on an editable place.
 
+
|-
A release of renaming/refactory (v0.0.6) compatible with Rodin v1.2.x is available in the main Rodin update site.
+
| DEL || Suppress the element after the caret position
 
+
|-
*Feature Request
+
| ALT+T || Add a sibling of the element pointed by the caret position. The sibling is placed just after this latter one.
**Renaming of all proofs after the element renaming. For each proof obligation, if proof rebuilding does not work, a new proofTree is created based on the initial proofTree and on the renamed element. By applying the ancient rule, if a proof is discharged before the renamed, it remains discharged after the renaming.
+
|-
 
+
| ALT+G || Opens a popup to select the element type of the child to add to the element pointed by the caret position. Note that if there is only one child type, the child will be directly created.
=====Version 0.0.5 =====
+
|-
 
+
| CTRL+BACKSPACE || Insert a new carriage return while editing with the overlay editor.
''13th January 2010''
+
|-
 
+
| ALT+ARROW_UP || Move up the selected elements.
A release of renaming/refactory (v0.0.5) fixing a few bugs found is already available.
+
|-
 
+
| ALT+ARROW_DOWN || Move down the selected elements.
=====Version 0.0.4 =====
+
|-
 
+
| SHIFT+ARROW_UP || Select elements up.
''5th November 2009''
+
|-
 
+
| SHIFT+ARROW_DOWN || Select elements down.
A release of renaming/refactory (v0.0.4) compatible with Rodin v1.1.0 is available in the main Rodin update site (bug fix from 0.0.3). Before starting the renaming, it is recommended to clean and build the project in order to have the indexer tables updated (IMPORTANT).
+
|-
 
+
| ESC || Quit the current overlay edition (if any) and forget the modifications made, frees the current selection.
*Bug fix
+
|-
** Renaming of proofs would not save the proof files after renaming
+
| TAB || Go to the next editable place (i.e. to the next editable element attribute)
** Renaming of labelled elements would not update the proofs.
+
|-
 
+
| SHIFT+TAB || Go to the previous editable place (i.e. to the next editable element attribute)
*Possible Problem
+
|}
** If you try to rename and the operation runs successfully without any errors but does not have any effect, you should:
 
*** First, try to fix the renaming manually on the respective file (or using the renaming framework, revert to the original name)
 
*** Try to make a CLEAN and BUILD to ensure that the Rodin indexer is updated before the renaming.
 
*** Run the renaming again and should be working fine.
 
 
 
=====Version 0.0.3 =====
 
 
 
''2nd November 2009''
 
 
 
A release of renaming/refactory (v0.0.3) compatible with Rodin v1.1.0 is already available in the main Rodin update site. Before starting the renaming, it is recommended to clean and build the project in order to have the indexer tables updated.
 
 
 
*Features
 
** Renaming of machines and contexts is possible using the indexers. After the renaming of a machine/context, the change is propagated over the related files
 
** Renaming of proofs: after the renaming, the proof obligations are also updated to reflect the renaming. It might be necessary to manually refresh the status of some proof obligations (although the proof is already discharged). This renaming is not fully-functional at the moment and some discharged proof obligations may have to be discharged again. We intend to fix this problem in the future.
 
 
 
=====Version 0.0.2 =====
 
 
 
''3rd July 2009''
 
 
 
*Bugs
 
** Validate if new name is in the list of reserved words of Event-B (dom,ran, card, etc)
 
 
 
=====Version 0.0.1 =====
 
 
 
''1st July 2009''
 
 
 
A release of renaming/refactory (v0.0.1) compatible with Rodin v1.0.0 is already available in the main Rodin update site.
 
 
 
Note that this version is still a prototype so prone to errors. So it is suggested to back up the projects before starting to use the renaming plug-in. The plug-in uses the most recent version of Rodin Indexer. Before starting the renaming, it is recommended to clean and build the project in order to have the indexer tables updated.
 
  
Although one of the goals is to the rename the respective proof obligations, this feature is not available in this version. It should be available in the next release. If you find bugs or errors, please let me know by updating this wiki-page or [mailto:ras07r@ecs.soton.ac.uk email].
+
=== Customize these shortcuts ===
 +
If you don't like these shortcuts, you can modify them by setting your own key preferences.
 +
To do so, go to Window > Preferences and then General > Key. A table appears were you can find and edit the shortcuts.
  
[[Category:Design]]
+
<!--== Tips & Tricks ==
 +
A command currently disable the possibility to use the ESC instead of ALT+ESC sequence. This is quite cumbersome, and can be tuned!
 +
To do so, open the preference table for key shortcuts (described above) and after ensuring you disabled the filters of uncategorized commands (using the Filters... dialog)
 +
search for the command named "Restore Styles". This is the command to release the highlights in the proving views. You can then swith the sequence of this command to ALT+ESC and change the value of the "Abort edition and free selected items" command to ESC. After applying these settings, the shortcuts will be modified as wished above.
 +
-->

Revision as of 10:09, 18 July 2012

Introduction

The Rodin Editor plug-in provides a structured editor to model in Event-B withing Rodin. This editor uses a textual representation, and edition is done through an overlay text editor and action depending on the caret position in the text.
For more details about the principles of this editor, see the Rodin Editor Plug-in page.

IMPORTANT FOR RODIN PLATFORMS BELOW RODIN 2.5 : we identified a source of concurrency issue in the current version (0.5.0) of the plug-in.
The Rodin Editor is not maintained for these versions of Rodin since Rodin 2.4. Please try to upgrade your plaform to the latest version of Rodin available. To avoid any trouble, please do not generate files while having some Rodin Editor open, and edit only one model per project at once.

Installation

Setup

Since Rodin 2.4, the Rodin Editor is part of the core platform (i.e. it is pre-installed and available out of the box). Once you've installed Rodin 2.4 or upper, you are ready to use the Rodin Editor plug-in.

Release Notes

See Rodin Editor Release Notes


Editing

This is a small exercice to get used to the principles of the new structured editor. It is based on the 'Celebrity' project of the tutorial. You can download the resulting project here.
We will here build the context Celebrity_C0.

Create a context, add elements to it

Let's create a Rodin project, and add a context component called Celebrity_C0 to it.
-- By opening this context with the Rodin Editor (right click > Open with > Rodin Editor) you shall obtain the following:
RodinEditor UserGuide step1.png

This editor allows to do things based on the position of the caret.
-- The caret is place at the front of the context name, and this is fine because we want to add a constant to the context. -- To add a constant, right click and select '[Child]-> Add Constant' as in the picture below:

RodinEditor UserGuide step3.png

-- Save the file.
After saving the file, the error markers are recalculated, and you have an error that appears on the newly created constant 'cst1'.
You shall see something like this :

RodinEditor UserGuide step4.png

Note that you can visualize the error message by going over the error marker with the mouse.

-- Now we enter the edition mode by clicking inside the label 'cst1', as we want to name the constant 'cst1' to 'k'.

RodinEditor UserGuide step5.png

The overlay editor then appears (the background is grey and a box is drawn[see above]) and you can modify the label of the constant.
-- Modify the label to be 'k'and exit the overlay edition by pressing 'Enter' or click next to k. Note that because 'Enter' is used to enter or exit the overlay mode under the caret, in order to insert carriage return in text, you have to press CTRL+ENTER (Apple+Enter) on mac platforms.
You can then save the file.
You then see something like the following.

RodinEditor UserGuide step6.png

Then we want to give this constant an integer type. As the caret is near 'k', and k is a constant, we will use '[Sibling]-> Add sibling' command to add an axiom.
-- Right-click and select "[Sibling]-> Add Axiom" you see then that a new axiom was created, named 'axm1'.

RodinEditor UserGuide step8.png

You've just created an axiom that you can edit to give the constant k a type. You can then enter the overlay edition mode to change this value to 'k : INT'.
After saving the file, you obtain the following context :

RodinEditor UserGuide step9.png

and the markers disappear because there is no error left in your context. Finally, suppose that the axiom axm1 should be considered as a theorem, click on not theorem after the axiom formula, to change the attribute of the predicate to a theorem.

CONGRATULATIONS! You learned how to use the Rodin Editor. You learned that :

  1. To create an element:
    1. or you place the caret before the label of its parent, and create a child using '[Child]->Add xxx' where xxx is the type of element you want to add, from the contextual menu,
    2. or you place the caret next to a sibling element and you create a sibling using '[Sibling]->Add xxx' where xxx is the type of element you want to add, from the contextual menu.
  2. To edit the attributes of an element:
    1. you enter the overlay edition with left click or with "ENTER" and modify the textual contents,
    2. you press 'ENTER' to quit overlay edition (or click outside the overlay editor).

Select, Move and delete elements

-- To select elements, you can double-click on them, or press CTRL and click on one element. The selected elements appear with a blue background, or a gray background if they are of different types. See the picture below.

RodinEditor UserGuide step11.png

-- To unselect element, by default, press ESC.

-- To move elements, try both:

  • Move Up and Move Down commands in the context menu, once elements are selected,
  • Drag and drop on the selection.

-- To delete elements, try both:

  • Use the 'Delete' command on a selection from the context menu,
  • Press the DEL or SUPPR key after selecting the elements you want to delete.

Using keyboard shorcuts

Here is the list of the currently key bindings which are set by default and specific to the Rodin Editor.


KEY SEQUENCE ACTION
BACKSPACE (ENTER) Enter the edition mode using the overlay editor if the caret is on an editable place.
DEL Suppress the element after the caret position
ALT+T Add a sibling of the element pointed by the caret position. The sibling is placed just after this latter one.
ALT+G Opens a popup to select the element type of the child to add to the element pointed by the caret position. Note that if there is only one child type, the child will be directly created.
CTRL+BACKSPACE Insert a new carriage return while editing with the overlay editor.
ALT+ARROW_UP Move up the selected elements.
ALT+ARROW_DOWN Move down the selected elements.
SHIFT+ARROW_UP Select elements up.
SHIFT+ARROW_DOWN Select elements down.
ESC Quit the current overlay edition (if any) and forget the modifications made, frees the current selection.
TAB Go to the next editable place (i.e. to the next editable element attribute)
SHIFT+TAB Go to the previous editable place (i.e. to the next editable element attribute)

Customize these shortcuts

If you don't like these shortcuts, you can modify them by setting your own key preferences. To do so, go to Window > Preferences and then General > Key. A table appears were you can find and edit the shortcuts.