Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 254550 - [IDE] NPE in SaveAsDialog when IDE not running
Summary: [IDE] NPE in SaveAsDialog when IDE not running
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Prakash Rangaraj CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-06 22:00 EST by Will Horn CLA
Modified: 2009-06-03 13:43 EDT (History)
3 users (show)

See Also:


Attachments
test case plug-in (rcp app) project (53.72 KB, application/octet-stream)
2008-11-06 22:01 EST, Will Horn CLA
no flags Details
stack trace (5.61 KB, text/plain)
2008-11-07 16:42 EST, Will Horn CLA
no flags Details
Patch v01 (1.55 KB, patch)
2009-01-16 11:31 EST, Prakash Rangaraj CLA
pwebster: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will Horn CLA 2008-11-06 22:00:03 EST
Build ID: 3.4.1 GA

Steps To Reproduce:
1. Launch attached RCP application
2. Ctrl+N (New wizard)
3. Select "Untitled Text File", press Finish
4. Add some text to the new "Untitled 1" text editor
5. Ctrl+S (Save)
6. "Saved Failed" java.lang.NullPointerException


More information:
SaveAsDialog uses an IDE internal image descriptor key that is only available when the IDE application is started.  Can that image be made public?  Or is there any other suggestion?
Comment 1 Will Horn CLA 2008-11-06 22:01:36 EST
Created attachment 117283 [details]
test case plug-in (rcp app) project
Comment 2 Paul Webster CLA 2008-11-07 09:28:46 EST
Could you please attach the full stack trace of the NPE?

PW
Comment 3 Will Horn CLA 2008-11-07 16:42:23 EST
Created attachment 117371 [details]
stack trace

This stack trace is from the .log file which should be reproducible as described above.
Comment 4 Paul Webster CLA 2008-11-10 09:02:24 EST
The short term workaround is for your WorkbenchAdvisor to register the same image using org.eclipse.ui.application.IWorkbenchConfigurer.declareImage(String, ImageDescriptor, boolean)

org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages.IMG_DLGBAN_SAVEAS_DLG is the constant to use, and the iamge can be found in org.eclipse.ui.ide at $nl$/icons/full/wizban/saveas_wiz.png

This is all internal, through, and not a long term solution.  As part of this bug we should at least protect against the NPE

PW
Comment 5 Prakash Rangaraj CLA 2008-11-11 05:05:39 EST
Paul,
	Declaring the images in the ide.application doesn't seem the right way to go. They cannot be used in RCP applications where the ide.application isn't running. Moving that to ide plugin will make sense?
Comment 6 Paul Webster CLA 2008-11-12 09:04:35 EST
They're actually in org.eclipse.ui.ide.

The difference seems to be that while the shared images of org.eclipse.ui.workbench are simply added when the plugin is started, the shared images of org.eclipse.ui.ide are added by the IDE workbench advisor.  So a different advisor (for an RCP app) doesn't have access to the correct information (unless they subclass the IDE workbench advisor, an internal class).

One solution would be to make org.eclipse.ui.ide register  the images on plugin start instead of using the advisor.

Nick, Boris, do you think this change in behaviour would cause downstream problems?

PW
Comment 7 Paul Webster CLA 2008-11-20 07:47:19 EST
(In reply to comment #6)
> Nick, Boris, do you think this change in behaviour would cause downstream
> problems?

I don't see a lot of problems, but I just thought I would ask.

PW
Comment 8 Paul Webster CLA 2008-12-30 11:41:20 EST
Let's protect against the NPE and then decide what to do about the registration.

PW
Comment 9 Prakash Rangaraj CLA 2009-01-16 11:31:23 EST
Created attachment 122819 [details]
Patch v01

(In reply to comment #8)
> Let's protect against the NPE and then decide what to do about the
> registration.
> 
> PW


Done.
Comment 10 Paul Webster CLA 2009-01-18 15:07:18 EST
Released to HEAD >20090118
PW
Comment 11 Prakash Rangaraj CLA 2009-01-27 13:03:55 EST
Verified in I20090126-1800
Comment 12 Will Horn CLA 2009-03-03 13:47:50 EST
Thanks for the workaround and the fix.  Is there a bug to track the registration issue?  I'd like to follow it so I can remove my use of internal constants.
Comment 13 Paul Webster CLA 2009-03-03 13:56:42 EST
(In reply to comment #12)
> Thanks for the workaround and the fix.  Is there a bug to track the
> registration issue?  I'd like to follow it so I can remove my use of internal
> constants.
> 

This is covered off by bug 186891 (still tryin' to decide what to do :-)

PW