Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null
why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null [message #1818154] Mon, 09 December 2019 05:17 Go to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 7
Registered: December 2019
Junior Member
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

I have this line in my Eclipse plugin. Then I have an Editor opened and right-click the editor I have a pop-up menu and one item action in the menu will run the above line.

[Updated on: Mon, 09 December 2019 05:21]

Report message to a moderator

Re: why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null [message #1818155 is a reply to message #1818154] Mon, 09 December 2019 06:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30892
Registered: July 2009
Senior Member
The debugger can probably help answer this question. Looking at the code, there appear to be a number of reasons why this method might return null:

https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.workbench/Eclipse%20UI/org/eclipse/ui/internal/Workbench.java#n1457

The debugger will help you figure out why you're hitting that case.
Previous Topic:how to get an open file's project name inside Eclipse
Next Topic:workspaceRoot.getFile() does not return
Goto Forum:
  


Current Time: Thu Feb 20 15:33:14 GMT 2020

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

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

Back to the top