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: 19
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: 32936
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:

The debugger will help you figure out why you're hitting that case.

Ed Merks
Professional Support:
Previous Topic:how to get an open file's project name inside Eclipse
Next Topic:workspaceRoot.getFile() does not return
Goto Forum:

Current Time: Fri Sep 22 15:43:37 GMT 2023

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

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

Back to the top