Project: Eclipse_Platform_UI
Bug 238157 [CommonNavigator] CNF invoke CommonActionProvider.fillActionBars twice at startup
Reported: 2008-06-23 13:40:53 | Status: resolved fixed

Build ID: I20080609-1311 Steps To Reproduce: 1.create class extends CommonActionProvider and override fillActionBars method. @Override public void fillActionBars(IActionBars actionBars) { new Exception().printStackTrace(); System.err.println("fillActionBars: " + Arrays.toString(actionBars.getToolBarManager().getItems()));} 2.declare in plugin.xml <extension point="org.eclipse.ui.navigator.navigatorContent"> <actionProvider class="cnf.test.actions.TestActionProvider" id="test.TestAction"> <enablement> <instanceof value="java.lang.Object"> </instanceof> </enablement> </actionProvider> </extension> <extension point="org.eclipse.ui.navigator.viewer"> <viewerActionBinding viewerId="test.view"> <includes> <actionExtension pattern="test.TestAction"> </actionExtension> </includes> </viewerActionBinding> </extension> 3.run, get this result. the stack tell us, the fillActionBars called twice. should once, right? More information: init: org.eclipse.ui.internal.navigator.extensions.CommonActionExtensionSite@1734b48 java.lang.Exception at cnf.test.actions.TestActionProvider.fillActionBars(TestActionProvider.java:41) at org.eclipse.ui.navigator.NavigatorActionService.initialize(NavigatorActionService.java:353) at org.eclipse.ui.navigator.NavigatorActionService.getActionProviderInstance(NavigatorActionService.java:333) at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:236) at org.eclipse.ui.internal.navigator.CommonNavigatorManager$2.run(CommonNavigatorManager.java:104) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.ui.internal.navigator.CommonNavigatorManager$UpdateActionBarsJob.runInUIThread(CommonNavigatorManager.java:94) at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at com.argaprict.workflow.ide.application.internal.application.IDEApplication$1.run(IDEApplication.java:31) at com.argaprict.workflow.ide.application.internal.application.IDEApplication$1.run(IDEApplication.java:1) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at com.argaprict.workflow.ide.application.internal.application.IDEApplication.start(IDEApplication.java:25) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) fillActionBars: [org.eclipse.jface.action.ActionContributionItem(id=null), org.eclipse.jface.action.ActionContributionItem(id=null)] java.lang.Exception at cnf.test.actions.TestActionProvider.fillActionBars(TestActionProvider.java:41) at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:239) at org.eclipse.ui.internal.navigator.CommonNavigatorManager$2.run(CommonNavigatorManager.java:104) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.ui.internal.navigator.CommonNavigatorManager$UpdateActionBarsJob.runInUIThread(CommonNavigatorManager.java:94) at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at com.argaprict.workflow.ide.application.internal.application.IDEApplication$1.run(IDEApplication.java:31) at com.argaprict.workflow.ide.application.internal.application.IDEApplication$1.run(IDEApplication.java:1) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at com.argaprict.workflow.ide.application.internal.application.IDEApplication.start(IDEApplication.java:25) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) fillActionBars: [org.eclipse.jface.action.ActionContributionItem(id=null), org.eclipse.jface.action.ActionContributionItem(id=null), org.eclipse.jface.action.ActionContributionItem(id=test1)] updateActionBars: dispose privder

Files changed in fix:
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/navigator/NavigatorActionService.java