Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null
why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null [message #1818154] Mon, 09 December 2019 00:17 Go to next message
Eclipse UserFriend
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 00:21] by Moderator

Re: why PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null [message #1818155 is a reply to message #1818154] Mon, 09 December 2019 01:23 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 23:12:49 EDT 2025

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

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

Back to the top