How can I show the problem marker correctly? It does not display a text editor and view problems

I got a lot of ideas from the previous question ( How to display an error sign in a Package when the package has incorrect information? )

But the problem marker is not displayed.

The resource that interests me is the XML file.

So, I added a listener for PRE_BUILD using the following code:

addResourceChangedListener(xxx, IResourceChangeEvent.PRE_BUILD)

It works great. Now I'm trying to add a problem marker.

IMarker marker = file.createMarker(PROBLEM_ID);
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
marker.setAttribute(IMarker.MESSAGE, "Error Message");
marker.setAttribute(IMarker.CHAR_START, 5);
marker.setAttribute(IMarker.CHAR_END, 6);
marker.setAttribute(IMarker.LINE_NUMBER, 5);

Runs on code. But the problem marker does not appear in the Editor and Problem views. How can I show the problem marker correctly?

+3
source share
1 answer

IResourceChangeEvent.PRE_BUILD, , , - , , , . IResourceChangeEvent.POST_BUILD.

, ? createMarker(PROBLEM_ID), createMarker(IMarker.PROBLEM).

+2

Source: https://habr.com/ru/post/1753677/


All Articles