Project: Eclipse_Platform_UI
Bug 254936 [Coolbar] Cannot switch perspective in a RCP application without Coolbars
Reported: 2008-11-11 14:12:00 | Status: verified fixed

Build ID: I20080617-2000 Steps To Reproduce: 1. Create a RCP application, in the ApplicationWorkbenchWindowAdvisor createWindowContents method, call getWindowConfigurer().createCoolbarControl(newShell); 2. Create an action to open perspective 3. Run the above RCP application. Everything works fine. 4. Remove the call to createCoolbarControl, and in the preWindowOpen method, call configurer.setShowCoolBar(false) 5. Run again, and notice you get a NullPointerException when the openPerspective method is called More information: It appears that setPerspective in WorkbenchPage always assume the coolbar to be present: Stack Trace: Caused by : java.lang.NullPointerException org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:3672) org.eclipse.ui.internal.Workbench.showPerspective(Workbench.java:2556) com.businessobjects.crystalreports.designer.startingpage.ui.StartingPageView$WorkbenchPartListener.partOpened(StartingPageView.java:313) org.eclipse.ui.internal.PartListenerList2$5.run(PartListenerList2.java:128) org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) org.eclipse.core.runtime.Platform.run(Platform.java:880) org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:53) org.eclipse.ui.internal.PartListenerList2.firePartOpened(PartListenerList2.java:126) org.eclipse.ui.internal.PartService.firePartOpened(PartService.java:279) org.eclipse.ui.internal.WorkbenchPagePartList.firePartOpened(WorkbenchPagePartList.java:34) org.eclipse.ui.internal.PartList.partOpened(PartList.java:227) org.eclipse.ui.internal.PartList.addPart(PartList.java:87) org.eclipse.ui.internal.WorkbenchPage.partAdded(WorkbenchPage.java:1664) org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:210) org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:779) org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:678) org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:639) org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2817) org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729) org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721) org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673) org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668) org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652) org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2635) com.businessobjects.crystalreports.designer.startingpage.ui.actiongroups.commands.BlankReportCommandHandler.execute(BlankReportCommandHandler.java:57) org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:281) org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) com.businessobjects.crystalreports.designer.startingpage.ui.actiongroups.internal.ButtonActionGroupProvider$1.widgetSelected(ButtonActionGroupProvider.java:135) com.businessobjects.ui.controls.basic.buttons.AbstractButton.fireLeftButtonClick(AbstractButton.java:199) com.businessobjects.ui.controls.basic.buttons.AbstractButton.onMouseUp(AbstractButton.java:83) com.businessobjects.ui.controls.common.AbstractCanvas$1.handleEvent(AbstractCanvas.java:39) org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823) org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422) org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) com.bobj.crystalreports.designer.Application.run(Application.java:44) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574) org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:195) org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) org.eclipse.equinox.launcher.Main.run(Main.java:1236) org.eclipse.equinox.launcher.Main.main(Main.java:1212)

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java