Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How can I check if a part is active and has the focus?
How can I check if a part is active and has the focus? [message #984182] Wed, 14 November 2012 13:28 Go to next message
Renso Lohuis is currently offline Renso LohuisFriend
Messages: 44
Registered: July 2012
Member
I would like to check if the part is active and has the focus or that a dialog above it has the focus.

This is what I have so far:
	@Inject
	protected MPart part;
	@Inject
	protected EPartService partService;

	public boolean isActiveAndHasFocus() {
		return part == partService.getActivePart();
	}


But I don't see any difference if there is a dialog above it (the part will still be active when a dialog shown above it.)

Is there a way to check if the part is active without any dialog above it?


Re: How can I check if a part is active and has the focus? [message #985284 is a reply to message #984182] Thu, 15 November 2012 09:26 Go to previous messageGo to next message
Eclipse UserFriend
What about getting the swt composite of the part MPart#getWidget() and seeing if it has SWT focus?
Re: How can I check if a part is active and has the focus? [message #986001 is a reply to message #985284] Sat, 17 November 2012 10:52 Go to previous message
Eclipse UserFriend
Check if the window is active. We might set some a tag on the window to indicate this but otherwise you can test the widget (a shell).

Brian.
Previous Topic:Add menu item to menu at runtime
Next Topic:Theme for Eclipse Juno - Images
Goto Forum:
  


Current Time: Tue Apr 16 07:06:22 GMT 2024

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

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

Back to the top