Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347528 - [RCP] [Coolbar] Cannot switch perspective in a RCP application without Coolbars, causes NPE (again)
Summary: [RCP] [Coolbar] Cannot switch perspective in a RCP application without Coolba...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-27 18:04 EDT by David Henderson CLA
Modified: 2019-11-27 07:01 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.