Community
Participate
Working Groups
Open Eclipse with a non-CVS project in your workspace. Expand the project, and select a file, then exit Eclipse. Restart Eclipse (the file should still be selected, yet the Share Project menu item is enabled), and without touching the Navigator View, goto Project > Share Project... You should be greeted with a NullPointerException dialog.
I've debugged this a bit (because someone is chopping off the stack). Here's the cause of the NPE: Thread [main] (Suspended (exception NullPointerException)) ConfigureProjectAction(TeamAction).getSelectedResources() line: 154 ConfigureProjectAction(TeamAction).getSelectedProjects() line: 124 ConfigureProjectAction$1.run(IProgressMonitor) line: 50 TeamAction$2.run() line: 234 BusyIndicator.showWhile(Display, Runnable) line: 69 ConfigureProjectAction(TeamAction).run(IRunnableWithProgress, String, int) line: 231 ConfigureProjectAction.run(IAction) line: 47 ConfigureProjectAction(ActionDelegate).runWithEvent(IAction, Event) line: 70 WWinPluginAction(PluginAction).runWithEvent(Event) line: 241 WWinPluginAction.runWithEvent(Event) line: 223 PluginActionContributionItem(ActionContributionItem).handleWidgetSelection(Event, boolean) line: 538 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 488 ActionContributionItem$5.handleEvent(Event) line: 400 EventTable.sendEvent(Event) line: 66 MenuItem(Widget).sendEvent(Event) line: 1412 MenuItem(Widget).sendEvent(int, Event, boolean) line: 1436 MenuItem(Widget).sendEvent(int, Event) line: 1421 MenuItem(Widget).notifyListeners(int, Event) line: 1251 Display.runDeferredEvents() line: 3118 Display.readAndDispatch() line: 2766 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1755 Workbench.runUI() line: 1719 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 368 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143 IDEApplication.run(Object) line: 106 PlatformActivator$1.run(Object) line: 226 EclipseStarter.run(Object) line: 377 EclipseStarter.run(String[], Runnable) line: 164 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 585 Main.invokeFramework(String[], URL[]) line: 338 Main.basicRun(String[]) line: 282 Main.run(String[]) line: 977 Main.main(String[]) line: 952 Passing to team.
Fix released to HEAD
Bogdan, please verify during 3.2 M3 test pass
Verified in I20051101-0010
We were resolving bugs in our bug system and I thought this bug was fixed because I could no longer reproduce it. However, one of our other developers could reliably reproduce it. After some further head bashing we found out that this bug still exists iff you have an editor open when you exit Eclipse. So - to reproduce: 1) Open Eclipse with at least one *non-CVS* project in your workspace. 2) Close all editors. 3) Open any file so you have one editor open. 4) Select any "file" in any *non-CVS* project in the navigator view. 5) Close the workbench. 6) Restart Eclipse. 7) Without touching *anything*, goto Project > Share Project... The file will be selected, and the menu item will be enabled and you will get a very weird exception dialog.
I'm able to reproduce this one. Here is the stack trace: java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.team.internal.ui.actions.ConfigureProjectAction$1.run(ConfigureProjectAction.java:48) at org.eclipse.team.internal.ui.actions.TeamAction$2.run(TeamAction.java:237) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:234) at org.eclipse.team.internal.ui.actions.ConfigureProjectAction.execute(ConfigureProjectAction.java:45) at org.eclipse.team.internal.ui.actions.TeamAction.run(TeamAction.java:477) at org.eclipse.team.internal.ui.actions.TeamAction.runWithEvent(TeamAction.java:511) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169) at org.eclipse.equinox.launcher.Main.main(Main.java:1144) As you can see the NPE is caused because there is actually no Project selected. I can see at least two solutions for the problem: 1. Make sure that "Share Project" entry in the main menu is disabled for all non-project resources (the entry in the popup menu is disabled like it should be). 2. Modify the TeamAction#getSelectedProjects() method so it will return a project even when there is a file/folder selected. We can look for the project of a given resource.
The question is why is the menu enabled in the first place. The ConfigureProjectAction#isEnabled() method clearly only returns true if a single project is selected. It appears that, on startup, there is a scenario where the isEnabled is not being called before the operation is run. This may be a bug in the workbench so we should track it down (i.e. try and debug it and confirm that isEnabled is not being called and, if confirmed, forward the bug to Platform/UI). Having said that, we should also add a check to the execute to exit if there isn't a selected project.
Yes. I have had similar issues in the past with some of my actions being enabled when they were clearly not *supposed* to be and I never did track them down. It was driving me nuts. Eventually I just decided it was a feature. ;) Although I never made the connection to an editor being open...
Created attachment 73312 [details] Fix The check for proper selection added to the execute method. After some debugging done I can confirm that the isEnabled test is not called for the Project > Share Project... as well as for other Team Actions located in the main toolbar menu. First, I though about disabling the menu entry (the action) after the check in the execute method fails. But I think that after forwarding the bug to Platform/UI they will find a better way to handle this case.
I have released the patch to HEAD. Now that we've fixed the problem in Team, it would be good if we could create a simple example plug-in that shows the failure. We can then create a separate bug against Platform/UI and attach the example. Tomek, can you do this please.
Done. The bug with a simple plug-in is here: bug 195879.
Thanks. Marking the Team specific issue fixed.
Verified in build I20070807-0010