Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problem in setFocus in editor.
Problem in setFocus in editor. [message #514470] Mon, 15 February 2010 12:25 Go to next message
jay is currently offline jayFriend
Messages: 5
Registered: July 2009
Junior Member
Hi all,

I have created some swt text controls in eclipse RCP forms in an editor.When
i save the contents in the editor , if there is an error in some entered
value in texts controls then an error code is returned depending upon type
of error. Each error code corresponds to specific text control.I show a info
dialog box showing description of the error and then depending upon error
code i want to set the focus to appropriate text control.

When i save the editor , editor saves its state ie.control on which last
focus is.After saving the editor ,the editor state is restored ie.focus is
set again on the control which has last focus.When i use setFocus() method
to my control it doesnt work returns false.Editor sets its focus again
to last focus control.

How do i manually set focus to a control so that editor won't set it to last
focus control??
Re: Problem in setFocus in editor. [message #557839 is a reply to message #514470] Thu, 09 September 2010 07:28 Go to previous message
Joachim is currently offline JoachimFriend
Messages: 1
Registered: September 2010
Junior Member
Hi jay,

I had the same problem as you.
I think the problem is that your text control runs in a different thread than your validation method. Probably you try to set the focus from within that validation method. So if you try to change the state of the control you access a different thread.

To set the focus as desired you should do the following to "enter" the thread of the Control:

final Text txtCtrlWithInvalidContent = get...
if (txtCtrlWithInvalidContent != null)
txtCtrlWithInvalidContent.getDisplay().asyncExec(new Runnable()
public void run()

Best wishes
Previous Topic:Diff utility for Text Files
Next Topic:Windows 7 64bits RCP Error in Galileo
Goto Forum:

Current Time: Fri May 25 17:02:08 GMT 2018

Powered by FUDForum. Page generated in 0.01866 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top