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

Bug 347528

Summary: [RCP] [Coolbar] Cannot switch perspective in a RCP application without Coolbars, causes NPE (again)
Product: [Eclipse Project] Platform Reporter: David Henderson <dash.alpha>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: dean3514, dylan.mcreynolds, prakash, pwebster, remy.suen
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description David Henderson CLA 2011-05-27 18:04:32 EDT
Build Identifier: 20110218-0911

See bug 254936.  This issue is very similar, except the NPE now occurs due to "mgr.getControl2()" returning null (mgr was not null).

java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3721)
	at org.eclipse.ui.handlers.ShowPerspectiveHandler.openPerspective(ShowPerspectiveHandler.java:146)
	...

Reproducible: Always

Steps to Reproduce:
See steps to reproduce in bug 254936, my setup is the same.
Comment 1 Dylan McReynolds CLA 2011-06-21 16:45:57 EDT
I found a workaround, but it is very kludgy.

I assume that the reason I ran into this bug is because I am not using the menu bar, choosing instead something with a multi-level bar.

Within my extension of WorkbenchWindowAdvisor.preWindowOpen(), I call  

   configurer.setShowCoolBar(false);

But this isn't good enough. At some point, a coolbar manager is created, and then this NPE comes up when it's asked about its control.

So, within my override of createWindowContents(), I added one line:

  configurer.createCoolBarControl(shell);

This doesn't make me comfortable, but seems to get through my issue.

If configurer.setShowCoolBar(false) is set, shouldn't a coolbarManager not get created?
Comment 2 dean3514 CLA 2011-08-24 01:31:42 EDT
Thank you very much!!!!!!! Thank you... Thank you...

because of your reply, I can solve my problem.

Wow... your are my hero. T T
Comment 3 Lars Vogel CLA 2019-11-27 07:01:37 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.