Bug 399864 - [CDT/StateMachine] Papyrus shall enable to see code on transitions.
Summary: [CDT/StateMachine] Papyrus shall enable to see code on transitions.
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.10.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: SR2   Edit
Assignee: Ansgar Radermacher CLA
QA Contact:
URL:
Whiteboard: CDT
Keywords: plan
Depends on: 369305 374527
Blocks:
  Show dependency tree
 
Reported: 2013-02-04 07:54 EST by Camille Letavernier CLA
Modified: 2015-06-22 07:45 EDT (History)
5 users (show)

See Also:
rschnekenburger: kepler+


Attachments
Statemachine and associated code (237.06 KB, image/png)
2013-11-12 10:44 EST, Ansgar Radermacher CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Camille Letavernier CLA 2013-02-04 07:54:24 EST
It is sometime useful to see at the same time the code attached to several transitions: for that purpose, the property view is no more useful. It is then possible to open each piece of code attached to a transition into a specific textual editor by using a contextual menu on the transition ("Show source in an editor"). Then the tool asked which code you want to see (e.g., effect or guard) and open an editor to show the code.
Comment 1 Ansgar Radermacher CLA 2013-10-18 17:12:45 EDT
Clarification: showing the code directly on a diagram is not considered useful, as larger pieces of code would make the diagram unreadable. An exception is code that delegates directly to a method owned by the class. Thus, it might be useful to show the first line directly in the diagram (eventually cut after a certain number of characters and followed by ...)
Comment 2 Toni Siljamäki CLA 2013-10-19 10:59:59 EDT
Remind me of this next week and I will give you a demo of an efficient UI. :)
Comment 3 Ansgar Radermacher CLA 2013-11-12 10:44:28 EST
Created attachment 237397 [details]
Statemachine and associated code
Comment 4 Ansgar Radermacher CLA 2013-11-12 10:50:15 EST
A first fix has been added with commit 09757bb49805f1395e86a3a03a599ad11f2b1d6a (master).
Now, the preference page contains two additional boolean options:

(1) whether to indicate parameters in a call or attributes in a signal by means of (...) after the name of the operation or signal. Defaults to true.
(2) whether to make a line break after the "/", if an effect is present. Defaults to true. The intention is to avoid wide labels.
(3) the max. number of lines to display. Default is 1. Longer text is followed by "...".

In addition, it's possible to see the complete code with the old C/C++ view, when the transition is selected and to open a CDT editor.
Currently, the code generator has a complete class as granularity, i.e. there is no separate file for the behavior within the transition. The attachment shows a sample screenshot with the number of shown lines set to 0.

Things still missing:
- Allow per diagram settings
- Complete CDT integration, currently reverse is not properly done for effects
- The linebreak should perhaps not be done (regardless of the associated flag), if the number of lines to show is set to 0.
Comment 5 Ansgar Radermacher CLA 2015-02-12 09:46:01 EST
There is still no possibility to update the settings per diagram, which would be very useful as some diagrams would be unreadable if we show the complete code, while it may be useful for others.

Therefore, preference pages are not a suitable way, but the configuration must be part of the CSS for the diagram.
Comment 6 Ansgar Radermacher CLA 2015-02-13 05:45:23 EST
The option to control via CSS has been added with commit
f3e8a9db27f252723305c9f9ae95c00f6c51143b for master and
88586d4986afc80be8ec4cec06e51dd3f69263b9 for 1.0-maintenance

The additional properties are documented on:
https://wiki.eclipse.org/MDT/Papyrus/UserGuide/CSS#Style_properties

They can be applied to a diagram using for instance:

Transition > Label {
	bodyCutLength : 5;
	lineBreakBeforeEffect : true;
}
Comment 7 Ansgar Radermacher CLA 2015-06-22 07:45:48 EDT
I'm setting this bug to "resolved", see comment 6.