eclipse.platform.ui icon indicating copy to clipboard operation
eclipse.platform.ui copied to clipboard

Adding new MarkerField via markerSupport extension point to problems view seems impossible

Open travkin79 opened this issue 1 year ago • 7 comments

I tried adding a new MarkerField to the problems view using the markerSupport extension point. That seems not to be possible with the latest org.eclipse.ui.ide bundle. I was not able to select the new MarkerField in the problems (or markers) view's "Configure Columns..." dialog.

Using the markerSupport extension point I added a new markerContentGenerator and a markerContentGeneratorExtension for the problem view's marker content generator (id=org.eclipse.ui.ide.problemsGenerator). While debugging the code, I found out that my marker content generator was initialized and used the new MarkerField, but the ContentGeneratorDescriptor did not pick up the new MarkerField.

I guess, the method ContentGeneratorDescriptor#getAllFields() is not correct. I think, the ContentGeneratorDescriptor has to collect all MarkerFields provided by the corresponding marker content generator as well as MarkerFields provided by the marker content generator extensions. Instead, ContentGeneratorDescriptor#getAllFields() ignores the registered extensions. It seems, the only place, where marker content generator extensions are considered, is the method ContentGeneratorDescriptor#getFilterReferences().

Did I misunderstand something or do we have to handle marker content generator extensions in most of the ContentGeneratorDescriptor's methods?

Details

My marker support extension looked like that:

   <extension
         point="org.eclipse.ui.ide.markerSupport">
      <markerField
            class="org.eclipse.lsp4e.ui.CustomMarkerField"
            id="org.eclipse.lsp4e.markerField.custom"
            name="Custom">
      </markerField>
      <markerContentGeneratorExtension
            generatorId="org.eclipse.ui.ide.problemsGenerator"
            id="org.eclipse.lsp4e.markerContentGenerator">
      </markerContentGeneratorExtension>
      <markerContentGenerator
            id="org.eclipse.lsp4e.markerContentGenerator"
            name="LSP4E MarkerContentGenerator">
         <markerFieldReference
               id="org.eclipse.lsp4e.markerField.custom">
         </markerFieldReference>
         <markerTypeReference
               id="diagnostic">
         </markerTypeReference>
      </markerContentGenerator>
   </extension>

Community

  • [x] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.

travkin79 avatar Aug 14 '24 21:08 travkin79

Feel free to suggest a PR including a testcase showing the benefit.

jukzi avatar Aug 15 '24 05:08 jukzi

Hi @jukzi, I'm working on it, but I have a few problems with compiling the unmodified bundles from master branch.

It seems, one compile error is related to one of your last commits. In my environment the method IFile#readNBytes() is not found. What do I have to change in my environment? Is there a target definition file, I can use? Does the dependency to org.eclipse.core.resources bundle use an obsolete version? My environment has version 3.20.200.v20240513-1323, while the MANIFEST.MF in org.eclipse.search.core demands version [3.1.4.0, 4.0.0).

I have a similar issue with the bundle org.eclipse.ui.workbench where Display#isRescalingAtRuntime() is not found (relates to another commit).

travkin79 avatar Aug 16 '24 10:08 travkin79

It's generally easiest to use the automated Oomph setup:

https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#creating-an-eclipse-development-environment

It clones a lot more repos than you need, but it's less error prone than try to set up a single repository.

Minimally you should use the installer's advanced mode and choose the Platform's own SDK product:

image

And select the Platform UI project:

image


My build had an error like this when I tested my own instructions above:

image

But it seems to have recovered from that:

image

merks avatar Aug 16 '24 11:08 merks

Thank you very much, @merks. That helps a lot. I had the same NPE during Oomph installation, but now the projects compile and I can go on.

travkin79 avatar Aug 16 '24 12:08 travkin79

please create an issue at https://github.com/eclipse-jdt/eclipse.jdt.core/issues with the stacktrace in text form

jukzi avatar Aug 16 '24 12:08 jukzi

please create an issue at https://github.com/eclipse-jdt/eclipse.jdt.core/issues with the stacktrace in text form

Done: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2828

travkin79 avatar Aug 16 '24 13:08 travkin79

I prepared a pull request for this issue: PR #2207.

travkin79 avatar Aug 19 '24 09:08 travkin79