Joe
Joe

Reputation: 4514

Invisible Marker in Eclipse

I've got an unusual error and I might be missing something - I've written a test plugin that should simply show an error marker on the first line of a file. I'm using this code, triggered from a button press

public void createMarkerForResource(IResource resource) throws CoreException {
        HashMap map = new HashMap();
        MarkerUtilities.setLineNumber(map, 1);
        MarkerUtilities.setMessage(map, "HAZARD");
        map.put(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
        MarkerUtilities.createMarker(resource, map, IMarker.TEXT);
    }

The code appeared not to work - but on closer inspection something is happening. There is now a 'clickable' area on the ruler, but no icon...

Before: enter image description here

After: enter image description here

Any ideas?

(I'm aware there's a similar question - but it was self-solved and as we are using different approaches and getting different responses I thought it was worth opening this one up.)

Upvotes: 1

Views: 206

Answers (1)

Tonny Madsen
Tonny Madsen

Reputation: 12718

As far as I can see, you define a org.eclipse.core.resources.textmarker. But I cannot find a org.eclipse.ui.ide.markerImageProviders with an image for the marker type. So I simply believe, there are no image for this type.

Try using a different type of marker type, define your own marker type or define your own image for the textmarker marker type (not recommended).

Upvotes: 2

Related Questions