You should try to create the markers with the Pydev marker utils:

from org.python.pydev.builder import PydevMarkerUtils

with the method:

createMarker(IResource resource, IDocument doc, String message, int lineNumber, String markerType, int severity, boolean userEditable, boolean istransient, List<IMarker> existingMarkers)

You can see an example that uses it at

If that does fail, you can try doing a refreshLocal (but I don't really think it should be needed):

from org.eclipse.core.resources import IResource
from org.eclipse.core.runtime import NullProgressMonitor
resource.refreshLocal(IResource.DEPTH_ZERO, NullProgressMonitor())



On 5/26/06, Don Taylor <> wrote:
Hi Fabio:

I am trying to write an extension to bookmark all occurrences of a
selection but I am having trouble getting the bookmark icons to show up
unless the file is closed and re-opened again.

I have the following code:

     class BookmarkOccurrences(Action):
         def run(self):
             selection = PySelection(editor)
             line = selection.getCursorLine()

             resource = editor.getIFile()
             if not resource:
                 log("Did not get a file resource")
                 return # Give up.

             marker = resource.createMarker(IMarker.BOOKMARK)
             if not marker:
                 log("Did not get a marker")
                 return # Give up

             marker.setAttribute(IMarker.MESSAGE, "This is my marker")
             marker.setAttribute(IMarker.LINE_NUMBER, line)

When this code is executed in a Pydev extension the bookmark shows up
immediately in the bookmark view, but the little symbol does not show up
until the file is closed and re-opened.

As far as I can tell the file is synchonized, and I have tried touching
the file to make sure that it is up to date.

             if resource.isSynchronized(IResource.DEPTH_INFINITE):
log("Resource is synchonized")

Any suggestions?



All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
pydev-code mailing list