Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329105

Summary: Do not add "show in source" node action when same model element as parent
Product: z_Archived Reporter: Konstantin Komissarchik <konstantin>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ling.hao
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Konstantin Komissarchik CLA 2010-10-29 16:22:46 EDT
Opened by Ling Hao:
-------------------

For nodes that has the same element as the parent, do not add "Show in source" action.

Also...

Action regression: "Show in source" should always be there (but
enabled/disabled depending on context)

1. sapphire-gallery.xml (empty)
2. Right click on Integer node and notice no actions
3. Modify simple field and save and close
4. reopen sapphire-gallery.xml and right click on Integer node and notice
there is "Show in source" action
Comment 1 Konstantin Komissarchik CLA 2010-11-04 18:22:26 EDT
Fixed both of the problems. The "show in source" action now appears only if the node's model element is not the same as parent's model element. This is simpler to understand that the old approach. The action is then enabled if the model element is currently associated with a DOM node. The action's enablement state is actively managed as model element's properties are changed and the DOM element comes and goes.
Comment 2 Konstantin Komissarchik CLA 2010-11-16 12:19:35 EST
Marking as fixed.
Comment 3 Ling Hao CLA 2011-01-04 18:26:12 EST
Found one minor issue:
1. Integer -> Simple -> enter any number
2. Show in source
3. In source view delete the entire <integer></integer> block
4. Go back to view, right click on Integer node, and "Show in source" is still enabled. When selected, it switches to the source view and the entire source is selected.
Comment 4 Konstantin Komissarchik CLA 2011-01-04 19:43:28 EST
The issue described in Comment #3 doesn't reproduce as described. I was able to finally reproduce it, but you have to replace step 3 with the following:

3. Delete just <simple></simple> block or clear Simple property. The show in source action on Integer node should still be enabled.

4. Now delete <integer></integer> block. The show in source action remains enabled. 

This appears to be related to be an issue in XML change listening.
Comment 5 Konstantin Komissarchik CLA 2011-01-04 20:00:43 EST
I have opened Bug 333524 to track the problem described in Comment #3 and Comment #4. That issue sufficiently separate from the original problem described in this bug, that I am re-resolving this one as fixed.
Comment 6 Ling Hao CLA 2011-01-05 19:09:17 EST
Verified.