eclipse-platform / eclipse.platform.text

8 stars 45 forks source link

File search match for Java file in nested project results in wrong editor sometimes #141

Closed jjohnstn closed 1 year ago

jjohnstn commented 1 year ago

I have a generic project that has two Java projects nested within it.

I do an import that looks for nested projects.

In one of the nested projects (project3), I have a file: A.java:

package project3;

public class A {

    public void foo() {
        int a = 3;
    }
}

If I do a File Search for "a = 3", I get two matches, one from the generic project and one from the Java project.

image

If I click on the first match, I get the Java file A.java opened by the Java editor. If I click on the same match again, the editor switches to a generic Java editor which gives errors if I attempt to do completion (compilation unit is not on build path of Java project). If I instead open the Java project match second, it keeps the Java editor open. If I go back and click the original match, it switches back to the generic editor and there is only the generic editor open for the file in my editor list.

jjohnstn commented 1 year ago

@mickaelistria This is the issue I was referring to in my duplicates patch.

mickaelistria commented 1 year ago

So I could reproduce an issue, which I believe is the same one as yours (if I understood correctly):

  1. search for a match that is in nested
  2. in outer project, double-click on the match EXPECTED: file opens as if it were open from inner nested project GOT: file opens as if it were open from inner nested project ✓
  3. Double-click on the file of the match EXPECTED: file remains opens as if it were open from inner nested project GOT: editor remains open but the editor input seem to have changed to be the "external" resource ❌

Does it seem like your isssue?

jjohnstn commented 1 year ago

Hi @mickaelistria Yes, that is the issue and your fix works well.