Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336068

Summary: Opening file via Windows Explorer > Open With uses wrong Eclipse instance
Product: [Eclipse Project] Equinox Reporter: Markus Keller <markus.kell.r>
Component: LauncherAssignee: Project Inbox <equinox.launcher-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, daniel_megert, eclipse.felipe, prakash, pwebster, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Markus Keller CLA 2011-02-02 09:11:25 EST
I had Eclipse 3.6.2 (M20110119-0834) and 3.7 (I20110201-0800) running, both launched via eclipse.exe. In the Windows Explorer, I selected a text file, chose Open With, and selected the eclipse.exe from 3.7

Was: File opened in the 3.6.2 workspace.
Expected: File should be opened with the eclipse.exe I selected, not with any other running version.

Please move to Equinox if this turns out to be a bug in the launcher.
Comment 1 Prakash Rangaraj CLA 2011-02-04 02:01:39 EST
I guess this goes the Equinox
Comment 2 Andrew Niefer CLA 2011-02-04 10:46:05 EST
This is a bit of a limitation in the current design.

Only one running eclipse can be the target of a file open.
On linux, this would be the eclipse that was started last, see bug 316821 where this is a problem.

On Windows, we are doing a win32 FindWindow, which I think finds the one at the top of the z-order.  However, the window we are looking for is a hidden window SWT_Window_<title> that SWT created for us.  

Felipe, do you know if this hidden window would come to the top with the rest of Eclipse when switching between two eclipse instance?  If it does, the we choose the instance that was used last by the user, otherwise the one that was started last.
Comment 3 Felipe Heidrich CLA 2011-02-04 11:49:52 EST
> Felipe, do you know if this hidden window would come to the top with the rest
> of Eclipse when switching between two eclipse instance?  

It should not.
Comment 4 Markus Keller CLA 2011-02-04 11:50:14 EST
(In reply to comment #2)
Thanks. I take this as a description of the current design, and not as a solution for this bug.

As a user I'd expect this strategy:

1. Try to find a running instance of the same executable. The implementation could append the exe's path to the app name.

2. If multiple instances are found, use the one that was first launched. This is fully predictable and also works in self-hosting scenarios where the runtime instance uses the same executable.
The patch in bug 316821 looks like an implementation shortcut could be to only register the first instance (skip when launching more instances of the same executable). Drawback of that approach is that instance B cannot be found any more in this scenario: Launch A, launch B, exit A.
Comment 5 Lars Vogel CLA 2019-09-24 13:57:17 EDT
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.
Comment 6 Eclipse Genie CLA 2021-09-14 14:12:38 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.