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

Bug 357593

Summary: [Table] Table takes focus after each refresh
Product: z_Archived Reporter: Vincent Lorenzo <vincent.lorenzo>
Component: EMF-FacetAssignee: Nicolas Bros <nicolas.bros>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: eclipse-bugzilla, emft.facet-inbox, gdupe, nicolas.bros
Version: unspecifiedFlags: gdupe: indigo+
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 355880    

Description Vincent Lorenzo CLA 2011-09-14 03:12:46 EDT
Comes from the Papyrus bug bug 355880, but I can reproduce this bug using only EMF-Facet Nattable (as described below).
The table take the focus after each refresh. I think this problem comes from the method NatTableWidget.setInput() because this method finishs with this.natTable.setFocus(); If I comment this last step I don't have the problem.

Step to reproduce : 
	1/ Create a new Ecore model
	2/ Edit an element of this model in a TableEditor
	3/Share your screen between the Ecore Editor and the TableEditor
	4/ Modify your model in the Ecore Editor (add an element, or rename an element in the property view
	-> The table is refreshed (OK) and take the focus, whenever it shouldn't.

+ As noticed in the bug 355880, the table is refresh even if an element which is not in the table is modified.
Comment 1 Nicolas Bros CLA 2011-10-10 04:16:10 EDT
Fixed in revision 957 in trunk and revision 958 in branch 0_1.
I have modified the setInput method of NatTableWidget so that the table control only retakes focus if it had it before the table was "refreshed" (i.e. recreated) or the first time it is created.
Comment 2 Nicolas Bros CLA 2011-10-10 04:22:44 EDT
Note: I have found the setFocus() call is useful when manipulating the table using the keyboard :
- hit F2 on an editable cell
- modify the contents
- hit Enter
- move to another cell using the arrow keys

Without the call to setFocus() in setInput(), this last step does not work because the table control has lost focus when it was destroyed and then recreated.
Comment 3 Gregoire Dupe CLA 2011-10-10 07:30:23 EDT
(In reply to comment #2)
> Without the call to setFocus() in setInput(), this last step does not work
> because the table control has lost focus when it was destroyed and then
> recreated.

Then, this be can't be considered has fixed.
Comment 4 Gregoire Dupe CLA 2011-10-10 07:54:51 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > Without the call to setFocus() in setInput(), this last step does not work
> > because the table control has lost focus when it was destroyed and then
> > recreated.
> 
> Then, this be can't be considered has fixed.

Ok, so after an off line explanation this is not a regression.
Comment 5 Gregoire Dupe CLA 2012-05-23 08:44:02 EDT
Hello Vincent,

Please, can you close this bug, if your problem has been solved ?

Regards,
Grégoire
Comment 6 Vincent Lorenzo CLA 2012-10-09 10:26:28 EDT
This bug can be marked as closed fixed.