Bug 228426

Summary: Selection not updated when viewer's contents changed
Product: [Tools] GEF Reporter: Pratik Shah <ppshah>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, hudsonr
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Pratik Shah CLA 2008-04-23 10:12:34 EDT
If you call setContents(EditPart) on a graphical viewer, it should fire selection changed.  I saw a bug where the actions hold on to the previous selection since not selection change event is fired.
Comment 1 Pratik Shah CLA 2008-04-23 10:51:42 EDT
Patch for the project.

Index: src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.gef/src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java,v
retrieving revision 1.51
diff -u -r1.51 AbstractEditPartViewer.java
--- src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java	18 Jun 2007 16:01:43 -0000	1.51
+++ src/org/eclipse/gef/ui/parts/AbstractEditPartViewer.java	23 Apr 2008 14:47:16 -0000
@@ -599,6 +599,7 @@
  */
 public void setContents(EditPart editpart) {
 	getRootEditPart().setContents(editpart);
+	fireSelectionChanged();
 }
 
 /**
Comment 2 Randy Hudson CLA 2008-04-24 09:50:39 EDT
Pratik, can you make a patch where the SelectionManager is told about the viewer's contents changing and then it fires the selection changed instead?
Comment 3 Anthony Hunter CLA 2008-04-24 10:09:07 EDT
Can you review the patch in Bug 227687 as we since it also applies to SelectionManager ? 
Comment 4 Alexander Nyßen CLA 2013-10-17 09:44:24 EDT
Unset target milestone as the specified one is already passed.