Bug 494267 - Tooltips should be computed on-demand and not stored in the model
Summary: Tooltips should be computed on-demand and not stored in the model
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-05-23 04:54 EDT by Pierre-Charles David CLA
Modified: 2016-11-23 15:13 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2016-05-23 04:54:22 EDT
Currently tooltip expressions are computed for each element during each refresh, and stored (in a way that is similar to labels) directly inside the model.

This has a (small but still present) overhead in refresh time, in load/save time, in memory usage (keeping hunderds/thousands or strings in memory), and can make diagrams "dirty" for no visible reason if the tooltip computation is not stable.

I don't see any obvious drawback with computing them on-demand. Tooltips only appear after the user has stopped the mouse cursor on an element for something like 500ms. An additional delay of 1 or 2ms to compute the expression should not be detectable.
Comment 1 Laurent Redor CLA 2016-05-25 02:53:30 EDT
This can also induce unexpected dirty session state, as for example with ecoretools and the bug 494270.
Comment 2 Pierre-Charles David CLA 2016-11-23 15:13:56 EST
Some code pointers/rough ideas:
* In DDiagramElementSynchronizer.refreshTooltip(DDiagramElement, TooltipStyleDescription): transmit the raw expression (unevaluated)
* Then in all of AbstractDiagramNameEditPart.refreshVisuals(), DiagramContainerEditPartOperation.refreshVisuals(AbstractDiagramElementContainerEditPart), DiagramNodeEditPartOperation.refreshFigure(IStyleEditPart), AbstractDiagramNodeEditPartOperation.setTooltipText(IAbstractDiagramNodeEditPart, String), create a Label which only computes the expression once (per refreshVisual() invocation), at paintFigure()-time.