How can I show the Problem Marker properly? It is not displayed Text Editor and Problem View

I got many ideas from previous question (How to display an error sign on the Package when the Package has wrong information?)

But the Problem Marker is not displayed.

The resource I'm interested in, is an XML file.

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

addResourceChangedListener(xxx, IResourceChangeEvent.PRE_BUILD)

It works fine. 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);

Above code is executed. But the Problem Marker is not displayed on the Editor and Problem views. How can I show the Problem Marker properly?

Answers


If you add your marker upon IResourceChangeEvent.PRE_BUILD I could imagine the problem is that before a build, all markers are cleared - so perhaps your new markers are cleared immediately so you don't even see them. I'd give it a try with IResourceChangeEvent.POST_BUILD.

Also, are you using the correct problem ID when creating the marker? Because in your code you use createMarker(PROBLEM_ID), not createMarker(IMarker.PROBLEM).


Need Your Help

Lexers/tokenizers and character sets

c character-encoding tokenize lexical-analysis

When constructing a lexer/tokenizer is it a mistake to rely on functions (in C) such as isdigit/isalpha/...? They are dependent on locale as far as I know. Should I pick a character set and concent...

HTML fields json encoded as deep nested objects

java javascript html json gson

I have some Java REST ws handling POST data from a simple HTML form.