Re: [Pydev-code] Getting bookmarks to display without closing/re-opening file
Brought to you by:
fabioz
From: Fabio Z. <fa...@gm...> - 2006-05-26 10:28:14
|
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 http://pydev.cvs.sourceforge.net/pydev/org.python.pydev/src/org/python/pyde= v/builder/todo/PyTodoVisitor.java?view=3Dmarkup 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()) Cheers, Fabio On 5/26/06, Don Taylor <nos...@gm...> 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 =3D PySelection(editor) > line =3D selection.getCursorLine() > > resource =3D editor.getIFile() > if not resource: > log("Did not get a file resource") > return # Give up. > > marker =3D 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 i= n > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat= =3D121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > |