Bug 563516 - When selecting multi projects, Middle-click should close all of those projects
Summary: When selecting multi projects, Middle-click should close all of those projects
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.15   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 549894
Blocks:
  Show dependency tree
 
Reported: 2020-05-24 09:50 EDT by Gao Hao CLA
Modified: 2020-07-01 00:58 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gao Hao CLA 2020-05-24 09:50:06 EDT
Now middle-click only close one project which the mouse is over.
Comment 1 Christoph Laeubrich CLA 2020-06-16 02:33:14 EDT
@Gao Hao I can't get my eclipse to *close* project (but maybe my mouse does not over a real "middle" button?), just *open* by doubleclick
Comment 2 Eclipse Genie CLA 2020-06-16 02:34:21 EDT
New Gerrit change created: https://git.eclipse.org/r/164956
Comment 3 Gao Hao CLA 2020-06-16 03:05:35 EDT
In Project Explorer, projects can be closed via middle-click.
See: https://www.eclipse.org/eclipse/news/4.13/platform.php#close-project-via-middle-click
Comment 4 Karsten Thoms CLA 2020-06-30 16:56:33 EDT
In my dev env I get this NPE when mid-clicking on a project:

!ENTRY org.eclipse.ui.navigator.resources 4 2 2020-06-30 22:54:17.906
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.navigator.resources".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.actions.CloseResourceAction.run(CloseResourceAction.java:202)
	at org.eclipse.ui.navigator.resources.ProjectExplorer$1.handleMiddleClick(ProjectExplorer.java:398)
	at org.eclipse.ui.navigator.resources.ProjectExplorer$1.lambda$0(ProjectExplorer.java:383)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.navigator.resources.ProjectExplorer$1.mouseUp(ProjectExplorer.java:382)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:224)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4385)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3789)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1420)
Comment 5 Karsten Thoms CLA 2020-06-30 17:50:25 EDT
The CloseResourceAction is created with a IShellProvider that always provides null. This is causing the NPE.

While I'm on it I think the middle-click could not just close one project, but all selected. And it could open the projects if all selected projects are closed. To be in synch, closing projects on multi-selection should only be done when all are closed. Or what would be the default when there are mixed opened and closed projects? Close/Open/Toggle?

I'm providing a patch now that would perform the resource action only when all have the same state.
Comment 6 Eclipse Genie CLA 2020-06-30 19:01:52 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/165636
Comment 7 Karsten Thoms CLA 2020-06-30 19:06:46 EDT
NPE was introduced with the middle-click feature introduction via bug#549894
Comment 8 Christoph Laeubrich CLA 2020-07-01 00:58:19 EDT
@Karsten Thoms thanks for taking care!