Tharaka Deshan
Tharaka Deshan

Reputation: 1396

How to get eclipse Tag List Programmatically using a plugin

I am a noob to the Eclipse Plugin Development , and I am doing my 1st project.

I need to get the list of tag messages (TODO,FIXME, ... etc) in PRE_BUILD event. I went through the org.eclipse.ui.views.tasklist package, but I wasn't able find a way to do this.

Upvotes: 1

Views: 120

Answers (1)

greg-449
greg-449

Reputation: 111218

These are IMarker objects, in particular markers with the type IMarker.TASK for TODO...

Markers belong to IResource objects (IFile, IFolder, ...)

You can use the IResource

public IMarker[] findMarkers(String type, boolean includeSubtypes, int depth)

method to find all markers on a resource.

So, for example, if you have an IProject you can use

IMarker[] markers = project.findMarkers(IMarker.TASK, true, IResource.DEPTH_INFINITE);

to get all the task markers for resources in the project.

Upvotes: 2

Related Questions