Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337484

Summary: Using new Shell#getToolBar() leads to NPEs on startup
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, skovatch
Version: 3.7   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Patch to work around NPEs on startup none

Description Brian de Alwis CLA 2011-02-17 15:09:20 EST
Created attachment 189223 [details]
Patch to work around NPEs on startup

BuildId: Eclipse 3.7M5

I was experimenting with e4 to use the native shell toolbar on MacOS X.  I'd get NPEs in Control#forceFocus(NSView) and ToolItem#setFocus() as view.window() would return null.

The attached patches at least avoid the issue.
Comment 1 Felipe Heidrich CLA 2011-02-17 15:16:23 EST
Please do not use this API, there is a change this API will most likely be removed. 

We are working on an alternative API.
Comment 2 Scott Kovatch CLA 2011-02-17 16:10:58 EST
Actually, these are good patches for SWT_AWT. There are situations in the new Plugin2 on the Mac where the applet isn't attached to any NSWindow.

I won't reopen the bug; I need a new one for that work.
Comment 3 Brian de Alwis CLA 2011-02-18 09:52:36 EST
(In reply to comment #1)
> Please do not use this API, there is a change this API will most likely be
> removed. 
> 
> We are working on an alternative API.

Is there a bug tracking this alternative API?
Comment 4 Felipe Heidrich CLA 2011-02-18 11:58:51 EST
(In reply to comment #3)
> (In reply to comment #1)
> > Please do not use this API, there is a change this API will most likely be
> > removed. 
> > 
> > We are working on an alternative API.
> 
> Is there a bug tracking this alternative API?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=222859#c135
[note: we are still playing with the idea]
Comment 5 Scott Kovatch CLA 2011-02-18 12:15:00 EST
(In reply to comment #3)
> (In reply to comment #1)
> > Please do not use this API, there is a change this API will most likely be
> > removed. 
> > 
> > We are working on an alternative API.
> 
> Is there a bug tracking this alternative API?

Also see bug 325795. That one talks about Aero Glass shells but it's related.