[Pydev-code] Getting bookmarks to display without closing/re-opening file
Brought to you by:
fabioz
|
From: Don T. <nos...@gm...> - 2006-05-26 03:20:57
|
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.
resource.touch(None)
if resource.isSynchronized(IResource.DEPTH_INFINITE):
log("Resource is synchonized")
Any suggestions?
Thanks,
Don.
|