Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding markers synchronously to file
Adding markers synchronously to file [message #1359919] Fri, 16 May 2014 15:18
Christine Gerpheide is currently offline Christine GerpheideFriend
Messages: 21
Registered: January 2014
Location: Netherlands
Junior Member

Hello!

I am trying to figure out how to add two sets of annotation markers to file in a synchronous way. Specifically I'm adding annotation markers which show up like text highlighting (imagine a code coverage tool with red and green highlighting for touched/untouched code).

The problem is that my sets of markers (say red and green) sometimes overlap. I want to make sure the red ones are added last, so they appear on top of the green ones. Is it possible to make overlapping markers work properly? The loops adding the markers are running in the UI thread (but apparently the underlying way Eclipse adds the markers is still asynchronous).

In pseudecode:

for(Node n : toBeGreen) {
  IMarker m = file.createMarker(markerType);
  m.setAttribute(IMarker.CHAR_START, n.start);
  m.setAttribute(IMarker.CHAR_END, n.end);
}
for(Node n : toBeRed) {
  IMarker m = file.createMarker(markerType);
  m.setAttribute(IMarker.CHAR_START, n.start);
  m.setAttribute(IMarker.CHAR_END, n.end);
}


The result is that the individual green and red markers just get added sporadically over a couple seconds (there are lots of nodes), sometimes with red on top sometimes green. I also tried putting these loops inside Display.syncExec functions, but that didn't make a difference (which is logical, since this is already UI thread).

Any ideas? Thanks for any help!
Chris
Previous Topic:Eclipse automated method search from plugin
Next Topic:Eclipse 4 editor tab position
Goto Forum:
  


Current Time: Fri Apr 26 01:05:51 GMT 2024

Powered by FUDForum. Page generated in 0.03619 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top