Bug 110616

Summary: Palette stack is removed if active tool gets removed after capability is disabled.
Product: [Modeling] GMF-Runtime Reporter: Cherie Revells <crevells>
Component: GeneralAssignee: Cherie Revells <crevells>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 Keywords: contributed
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
PaletteService and PaletteServiceTest patches none

Description Cherie Revells CLA 2005-09-26 11:31:41 EDT
Steps to reproduce:
1. Create a palette provider that contributes a new palette tool to an existing 
palette stack.  Match this provider to a capability.  
2. Enable the capability and set this palette tool as the active one on the 
stack.
3. Disable the capability.
RESULT: The entire palette stack disappears.  Only the palette tool that was 
added should have disappeared.  The palette stack reappears when the diagram is 
reopened.
Comment 1 Steven R. Shaw CLA 2005-10-06 14:35:45 EDT
Changing component to "Runtime Diagram"
Comment 2 Cherie Revells CLA 2005-10-13 10:50:59 EDT
I am transfering this to GEF.  The GMF layer is adding/removing entries from 
the palette depending on whether a capability is enabled or disabled.  The GMF 
layer is basically updating the list of children of a palette container 
(adding/removing palette entries), by calling setChildren() on the palette 
container with the new list of children.  There is an issue in the application 
when the active entry is one that was removed in the call to setChildren().  
This could be fixed if setChildren() was overridden in PaletteStack to call 
checkActiveEntry() after the new children were set.
Comment 3 Randy Hudson CLA 2005-10-13 11:29:17 EDT
1) The "on top" entry should get updated whenever remove or setChildren gets 
called, or when the on-top entry becomes hidden. If setChildren is called, I 
think it is valid to just reset the on top entry to be the first child. To 
avoid this behavior clients should just remove the items individually.

2) In general, we should verify that removing or hiding the active entry 
results in the default entry being selected (or null if no default).
Comment 4 Cherie Revells CLA 2005-10-13 12:43:43 EDT
In my case, the "on top" entry may still be in the list of children being set 
in which case I want it to remain as the "on top" entry.  I only want the "on 
top" entry to change to the first entry if the previous "on top" entry is not 
in the list of new children.  However, now that I think about it more, I should 
probably be using the add(index, entry) and remove API instead recreating the 
children list myself.  I think I will change this on my end afterall, but the 
first point made my Randy still stands.  I will confirm that removing that 
active entry (Randy's second point) works as it should (looking at the code I 
think it will).
Comment 5 Cherie Revells CLA 2005-10-14 15:18:48 EDT
Created attachment 28309 [details]
PaletteService and PaletteServiceTest patches

Contributed by: Cherie Mahoney
Comment 6 Cherie Revells CLA 2005-10-14 15:27:15 EDT
See attached patch.

Purpose: 
Bugzilla 110616 Palette stack is removed if active tool gets removed after 
capability is disabled.
- PaletteService.updatePaletteContainerEntries was replacing the list of 
children in a palette container with a new merged list that I was creating 
based on the new content and existing content.  The call to 
PaletteStack.setChildren() was not resetting the active entry.
- I changed the method so that setChildren() is no longer used.  Instead, I am 
adding and removing palette entries using the add/remove API.
- Added more test scenarios to PaletteServiceTests.

Activities: 
Bugzilla 110616 gmf_head sshaw 051014 Palette stack is removed if active tool 
gets removed after capability is disabled

Code Reviewed by:
Steve

How tested: 
JUnit Tests:  
diagram.ui: 65/65
Comment 7 Eclipse Webmaster CLA 2010-07-19 12:30:22 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug