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.


-------------------------------------------------------
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
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to