开发者

Eclipse PluginDevelopment: How to set ProblemMarker for IFolder?

When developing an Eclipse Plugin, what is the best way to set a ProblemMarker for empty IFolders? What I am trying to achieve is the following: Im using an own project type, and I want certain Folders in the Package Explorer to be marked and decorated with a warning when they are empty.

What I can do is to add markers when opening eclipse. But I dont know how to update the markers when changes occur.

I tried it this way:

using method : public void resourceChanged(IResourceChangeEvent event) (is called whenever something in workspace is changed)

I was checking the folders if they are empty (works)

then adding a ProblemMarker on the IFile instances. (does not work, because adding a ProblemMarker is locked while being in method resourceChanged) This is because changing markers fires a resourceChanged event.

So what is the usual way to solve the problem? I guess there is one because in eclipse when开发者_运维技巧ever you change something in the package explorer the decorators are updated instantly.


You could try to create a Builder which checks for problems and creates the markers as needed.

This article could help you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜