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

Bug 264800

Summary: Issue with editPart.setFocus(boolean) method?
Product: [Tools] GEF Reporter: Madhu Samuel <madhusamuel>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: ahunter.eclipse, christian.pontesegger, madhusamuel, nyssen
Version: 3.4   
Target Milestone: 3.6.1 (Helios SR1)   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Code snippet to reproduce the bug. none

Description Madhu Samuel CLA 2009-02-12 22:27:25 EST
Build ID: Eclipse 3.4

Steps To Reproduce:
I am using the Eclipse 3.4, GEF 3.4 environment.

When I invoke the editPart.setFocus(true) I expect to see a dashed line around my figure associated with the editPart. This dashed line denotes that the focus is over it.  But the dashed line does not appear. 


More information:
A workaround to enable the dashed line. The below code snippet gives me the dashed line.
editPart.setSelected(1);
editPart.setFocus(true);
editPart.setSelected(0);

That means, the focus is drawn correctly if I invoke the setFocus() after the setSelected() method.

I even tried editPart.refresh() soon after invoking the setFocus(true), but still it does not draw the dashed line.

But editPart.setFocus(true) works correctly in Eclipse 3.2, GEF 3.2.1 environment.
Comment 1 Anthony Hunter CLA 2009-02-13 16:28:56 EST
Can we get a more substantial example? Like the rest of the snippet?
Comment 2 Madhu Samuel CLA 2009-03-11 07:29:41 EDT
Created attachment 128363 [details]
Code snippet to reproduce the bug.

I will write the steps to reproduce as a comment.
Comment 3 Madhu Samuel CLA 2009-03-11 07:31:29 EDT
(In reply to comment #1)
> Can we get a more substantial example? Like the rest of the snippet?
> 

Oops! I missed your reply! Somehow I did not get a mail when you commented on this bug.

I am attaching a zip file. It contain a plugin which consists of the sample code. 

Steps to reproduce the bug.

1. Unzip and place the plugin "gef.example.helloworld3" to your plugins folder of your Eclipse 3.4 environment.
2. Execute your eclipse instance.
3. In the navigator view, create a file named "test.focus". This should open the editor which consists of three gef figures.
4. Now if you press ALT or TAB key, focus (dashed lines) is drawn over the rectangle figures.

Execute the above steps in Eclipse 3.2 environment. In step 3 itself, you will be able to see the focus (dashed lines) over the rectangle figures.

To see the source, open the class HelloEditPart. Go to the method createFigure(). You will be able to see the code 'this.setFocus(true)' which sets the focus over the rectangle figures.

Even the work around I mentioned in the previous post is not functioning.
Comment 4 Madhu Samuel CLA 2009-03-11 07:32:10 EDT
Changing severity to Major.
Comment 5 Alexander Nyßen CLA 2010-11-21 15:38:45 EST
Using GEF 3.6 this is not reproducible under MacOSX. Using the snippet and performing the steps to reproduce I can observe that focus rectangles are correctly displayed around the three "Hello World" widgets after opening the editor. 

Can you please verify whether this is still an issue using GEF 3.6.1 on Windows XP?
Comment 6 Alexander Nyßen CLA 2010-12-17 16:18:40 EST
(In reply to comment #5)
> Using GEF 3.6 this is not reproducible under MacOSX. Using the snippet and
> performing the steps to reproduce I can observe that focus rectangles are
> correctly displayed around the three "Hello World" widgets after opening the
> editor. 
> 
> Can you please verify whether this is still an issue using GEF 3.6.1 on Windows
> XP?

Problem does not seem to be reproducible on Windows XP as well, so resolving as fixed in 3.6.1.