Community
Participate
Working Groups
One of the my taskflow model property breakpoint is implemented as an readonly property on the model: @Type( base = BreakpointState.class ) @ReadOnly @DerivedValue(service = BreakpointDerivedValueService.class ) @DefaultValue( text = "NONE" ) ValueProperty PROP_BREAKPOINT = new ValueProperty( TYPE, "Breakpoint" ); Value<BreakpointState> getBreakpoint(); BreakpointDerivedValueService would retrive value from a separate debug model, so the taskflow model is touched in TaskFlow model when user toggle from UI. But the digram UI is marker dirty, when I set the debug model and refresh taskflow model.
Shenxue, I remember seeing some code in the graphiti renderer where Sapphire actions are exposed where it dirties the editor post action handler execution. Maybe try commenting out that line of code? The model writes through to the source editor which will dirty the editor on its own. You should only need to dirty the editor in response to geometry changes.
Graphiti has some issues with when the editor is marked as dirty. So the workaround in Graphiti is to override hasDoneChanges() in custom features. The default impl in Graphiti's custom action is always return "true". I did something similar in Sapphire diagram action handlers. Danny, you can override the hasDoneModelChanges() method. Take a look at NewJSPActionHandler class. If the New JSP wizard is cancelled, it won't mark the editor dirty.
I see. Danny, if you can confirm that overriding SapphireDiagramActionHandler.hasDoneModelChanges does resolve this issue for you, this bug can move to 0.4 release. We will resolve this issue as part of ripping out Graphitti.
I did override the SapphireDiagramActionHandler.hasDoneModelChanges() and return false. But the method was not being called after action executed. I saw the NewJSPActionHandler.hasDoneModelChanges() was called though, by SapphireDoubleClickNodeFeature.hasDoneChanges() Is it handled only in doubleClick only?
(In reply to comment #4) > I did override the SapphireDiagramActionHandler.hasDoneModelChanges() > and return false. But the method was not being called after action executed. > > I saw the NewJSPActionHandler.hasDoneModelChanges() was called though, > by SapphireDoubleClickNodeFeature.hasDoneChanges() > > Is it handled only in doubleClick only? You're right that SapphireDiagramActionHandler.hasDoneModelChanges() wasn't called at all. SapphireDiagramActionHandler should not dirty the editor itself. Try "show in source" action on a node, it doesn't dirty the editor. I wonder whether the @ReadOnly in context of @DerivedValue isn't functioning correctly?
> I wonder whether the @ReadOnly in context of @DerivedValue isn't functioning > correctly? @ReadOnly in context of @DerivedValue doesn't do anything. The read-only state is implied. Note that derived properties do trigger events when their value changes. If there is some generic code somewhere that listens on the entire model and dirties the editor on any property change, then it would trip up in this scenario. Such code would need to be coded to ignore derived properties.
(In reply to comment #6) > > I wonder whether the @ReadOnly in context of @DerivedValue isn't functioning > > correctly? > > @ReadOnly in context of @DerivedValue doesn't do anything. The read-only state > is implied. Note that derived properties do trigger events when their value > changes. If there is some generic code somewhere that listens on the entire > model and dirties the editor on any property change, then it would trip up in > this scenario. Such code would need to be coded to ignore derived properties. Ah right. When toggle break point action is executed, the graphical representation of the node is changed. An image decorator(blue round dot) is added or removed from the node. Therefore, Graphiti thinks the editor is dirty since the pictogram models have changed. I'm not sure whether I can trick Graphiti in thinking it doesn't need to to mark the editor dirty. My gut feeling is it's pretty hard. I'll dig a little more into it...
After more digging, it doesn't seem possible to fix this issue. The Graphiti editor asks the emf workspace command stack whether the editor should be marked dirty. Since toggle break point action adds/removes image decorator to the node, emf model for the node is changed therefore the emf layer thinks the editor should be marked dirty. Although we don't rely on emf model for our diagram persistence, but that's what Graphiti uses for their diagram model and persistence. I'm moving this bug to 0.4...
> The Graphiti editor asks the emf workspace command stack whether the editor > should be marked dirty. Have you looked at disabling/overriding this completely (as opposed to selectively)? We really don't care what Graphiti or EMF might think about editor's dirty state. The impact on the taskflow editor breakpoint toggle is pretty severe. Since no other editor goes into dirty state after breakpoint toggle, the users will be left quite confused. I am ok with spending a bit more time trying to find a workaround.
I'll take another look into this...
Should be fixed now.
*** Bug 355282 has been marked as a duplicate of this bug. ***
I am very glad you found a solution for this! It will be a big improvement.
verified with 0.3.1.201109221708
Closing based on Raj's verification