Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342245 - Tooltip for connection labels not updated after custom command execution
Summary: Tooltip for connection labels not updated after custom command execution
Status: CLOSED FIXED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.8.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: Indigo RC3 theme_bugs
Keywords:
Depends on:
Blocks: 342216
  Show dependency tree
 
Reported: 2011-04-08 04:36 EDT by Henrik Rentz-Reichert CLA
Modified: 2011-06-24 08:50 EDT (History)
3 users (show)

See Also:
matthias.gorning: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Rentz-Reichert CLA 2011-04-08 04:36:24 EDT
The tooltip for connection decorator labels is not updated after a custom command execution with model change.
But it is updated when the label is moved.

I use Graphiti HEAD of 2011-03-23.
Comment 1 Matthias Gorning CLA 2011-05-17 04:48:28 EDT
I need more information to produce this error:

* What do you mean with a custom command? A custom feature?
* Is the changed model object linked with the connection and/or the connection decorator?
* Does the model change influence the decorator's label?
Comment 2 Henrik Rentz-Reichert CLA 2011-05-18 00:57:24 EDT
(In reply to comment #1)
> I need more information to produce this error:
> 
> * What do you mean with a custom command? A custom feature?
yes, a org.eclipse.graphiti.features.custom.AbstractCustomFeature
> * Is the changed model object linked with the connection and/or the connection
> decorator?
the changed object is a nested object of the linked object
> * Does the model change influence the decorator's label?
the label is always re-computed and updated.
It seems though that the tooltip is updated if and only if the label text has actually changed.

I can give you further details if needed.
Comment 3 Matthias Gorning CLA 2011-05-23 09:49:54 EDT
I have two further questions:

* Is your domain model in EMF?
* Is your decorator an active decorator?
Comment 4 Henrik Rentz-Reichert CLA 2011-05-23 10:14:08 EDT
(In reply to comment #3)
> I have two further questions:
> 
> * Is your domain model in EMF?
yes
> * Is your decorator an active decorator?
yes

You can find the relevant code in file
http://git.eclipse.org/c/etrice/org.eclipse.etrice.git/tree/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java

line 266ff
Comment 5 Matthias Gorning CLA 2011-05-24 09:59:20 EDT
Currently I am not able to reproduce this error.

I've made some tests with internal test tools and I've also spent some to inspect our code, but I could not find any problem with the tooltip refresh. I've found out that there is a special refresh handling for active connection decorators. It does not matter whether the whole diagram or only parts of the diagram will be refreshed. In each case all the existing active connection decorators will be refreshed. And at the end of each refresh we will ask the toolbehaviour provider for the tooltip.

Your code in TransitionSupport.java also looks well.

We saw that you have several providers. Perhaps we asked the wrong provider for the tooltip?

For verification you should set a breakpoint in the class PictogramElementDelegate at the end of the method 
refreshFigureForGraphicsAlgorithm where the line starts with 

   final String toolTip = toolBehaviorProvider.getToolTip(graphicsAlgorithm);
Comment 6 Henrik Rentz-Reichert CLA 2011-05-25 00:59:43 EDT
Matthias,

I observe that in
org.eclipse.graphiti.ui.internal.editor.DiagramChangeListener.resourceSetChanged(ResourceSetChangeEvent)
I get notifications after the command is executed.

In the case where the tooltip update works the Text of the Decorator changed and isRelevant is found to be true.
In the case where it doesn't work only notifications containing EObjects from my business model are received. In this case isRelevant always is false.

If the update is triggered only if Graphiti objects have changed:
boolean isRelevant = isGraphitiMmObject(eClass) || superClassIsGraphitiMmObject(eClass);
then pure business model changes can never be reflected.

Or are there other paths which lead to a refresh of the tool tips?
Comment 7 Matthias Gorning CLA 2011-05-25 03:48:45 EDT
For changes in the business model there is a DomainModelChangeListener.

Did you set the breakpoint as proposed?
Comment 8 Henrik Rentz-Reichert CLA 2011-05-25 06:03:20 EDT
(In reply to comment #7)
> For changes in the business model there is a DomainModelChangeListener.
> 
> Did you set the breakpoint as proposed?

yes, I did. But it is not hit.

That's why I tried to investigate how it is supposed to work.

I checked what the DomainModelChangeListener does.
It seems to me that affected pictogram elements are computed and then the update feature is invoked.
But my update feature returns false if asked whether an update is needed.
I thought the tooltip is handled by the behavior provider??

On the other hand I couldn't find on which path the breakpoint could be reached.
At some point along this path something must fail.

Or do I have to handle the tooltip also by the update feature? And how can I access it?
Comment 9 Matthias Gorning CLA 2011-05-27 05:55:13 EDT
Since there is no change in the domain model which leads to a diagram refresh the tooltips must be refreshed manually.

There is a new method refresh(PictogramElement pe) in IDiagramEditor which can be used. 

You can simply call this method e.g. with ConnectionDecorator's.

BR,
Matthias
Comment 10 Michael Wenz CLA 2011-06-24 08:50:30 EDT
Part of Graphiti Indigo 0.8.0