Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » MessageBox with no shell
MessageBox with no shell [message #765504] Wed, 14 December 2011 08:03 Go to next message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 81
Registered: December 2011
Member
Hi,

I have to show a MessageBox (to signal an error when the app starts) before the window is created (in WorkbenchAdvisor).

When I run app inside Eclipse, no problem bit when I run app as a product, the shell is null and I get an exception (null pointer) because the shell is null.

Solution ?

Thanks

JPL
Re: MessageBox with no shell [message #767899 is a reply to message #765504] Mon, 19 December 2011 07:13 Go to previous message
Jean-Pascal Laux is currently offline Jean-Pascal LauxFriend
Messages: 81
Registered: December 2011
Member
HI,

I have found the solution :

Shell shell=null;
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window!=null)
shell=window.getShell();
else
shell=PlatformUI.getWorkbench().getDisplay().getActiveShell();

MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
Previous Topic:How to create extension point using existing eclipse extension point
Next Topic:short cut key to navigate to the starting of the loop or an if-else condition
Goto Forum:
  


Current Time: Thu Apr 25 13:50:44 GMT 2024

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

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

Back to the top