Community
Participate
Working Groups
I know this feature sounds small, and like there is a way around it with the current bookmarking feature in Eclipse, but it is actually probably the only reason why I stick with my current editor (Forte) instead of switching to Eclipse (even though Eclipse is admittedly far supperior in almost all other areas). In Forte, you can go to any line in a file put the cursor there and press ctrl-F2 (although the actual key combination is irrelevant) and it will highlight the row and add a bookmark without prompting for a name. These bookmarks are removed by placing the cursor back on the highlighted line and pressing the same key combination cntrl-F2 (so you can toggle the bookmark on and off with the same key combination). You can add as many or few of these bookmarks to a file as you want. Then by pressing F2, you loop through the file from one bookmark to the next. This makes editing very fast, and it makes it possible to edit in one place, mark it and then quickly get back there (which is quite common when programming in Object Oriented languages) without having to go through the process of naming a bookmark and then remembering the name and selecting it to get back to where you were (however, the current naming bookmark mechanism in Eclipse does work well for moving between different files whereas this one I have explained above does not - so I think that they are both useful). Also, after a file is closed the bookmarks disappear. I guess it might be nice if they stayed, but that probably ups the complexity of implementaion and overhead way more than it is worth. Thanks, Matt Wheeler
Moving to UI for consideration. There is no problem from core's point of view to create a bookmark with an empty message. Alternatively, the message could be automatically set to something like "Line N", so that it would be uniquely identifiable in the bookmark view.
One feature we would like to add for 2.1 is an editor navigation history. For example, if you jump to another declaration using F3, then you could get back to where you came from using Navigate / Back, which would also have an accelerator key (probably Alt+Left Arrow like web browsers, and may get back mouse button support for free). This will work whether F3 jumps you to a different file or elsewhere in the same file. This would also work for other kinds of selection changes. See bug 12066. Would this meet your needs? One advantage of it is that you don't need to manually set bookmarks at all. If not, it would be helpful to know where it breaks down.
If I understand correctly, you are saying that you do some key sequence to mark where you are and then you can use a back or forward sequence to go to the places you have been (and marked with the key sequence)in a file or group of files. I think that this would work ok. The only place that this is not the same as with unnamed bookmarks is that if you just want to loop through where you have been in that file you cannot (because it will take you back to wherever you have been including other files). For instance, in my editor, I will mark say 5 spots in the file and then I can jump to them by looping though. Then I will open go to another file where I have marked a few more spots for that file and I can loop through those independantly. So the mechanism you are proposing takes you back to where you have been while this unnamed bookmark deal just marks places in a particular file. I would assume that what you are proposing would probably work fine. However, would there be a way to remove a location from the trail that you have previously marked so that you don't return to it? Thanks, Matt Wheeler
Not exactly. You will not need to use a special key sequence to manage the editor navigation history, it would be created automatically as you navigate around (e.g. using F3 to jump to declarations in JDT). The more I think about it, the feature you are proposing seems orthogonal to editor navigation history. Both would be useful.
I'm also very interseted in having quick bookmarks. I could live with both, the Forte style (F2, Ctrl-F2, Shift-F2) or the JBuilder style (Shift-Ctrl-X un/sets, Ctrl-X jumps, where X is 0-9). I would try to implement that as a custom extension, if I can get a hint, where to start (as I'm totally new to Eclipse). Feel free to mail me some hints to get me started. Thanks Georg
It's always nice to have offers of help from the community. Here are some pointers. Read the "your first plugin" and "contributing actions" articles to learn about plugins and action sets (note that you may need to go to Window / Customize Perspective / Other to turn on your action set initially). Should also peruse the Platform Plug-in Developer's Guide under Help / Help Contents. Create an action set that defines menu items and/or toolbar items for the actions you want. You can use the accelerator= tag to associate an accelerator key (see the doc for the org.eclipse.ui.actionSets extension point under eclipse/plugins/org.eclipse.ui/doc or in the developer's guide). You can determine the current editor's file using: IWorkbenchWindow window; // obtained from IWorkbenchWindowActionDelegate IPage page = window.getActivePage(); if (page != null) { IEditorPart editor = page.getActiveEditor(); if (editor != null) { IEditorInput input = editor.getEditorInput(); IFile file = (IFile) input.getAdaptable(IFile.class); if (file != null) { // do stuff } } } You can add and remove bookmarks using: IMarker bookmark = file.createMarker(IMarker.BOOKMARK); bookmark.setAttribute(IMarker.CHAR_START, charStart); bookmark.setAttribute(IMarker.CHAR_END, charEnd); You can get the current selection range using: if (editor instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor) editor; ITextSelection selection = (ITextSelection) textEditor.getSelectionProvider ().getSelection(); int charStart = selection.getOffset(); int charEnd = selection.getOffset() + selection.getLength(); } You can jump to a bookmark using: page.openEditor(bookmark); You can delete a bookmark using: bookmark.delete() If you want to properly enable/disable the actions when switching editors, you can track editor activation using the part service: page.addPartListener(...); Good luck, and keep us posted of your progress.
Thanks for the kick off, Nick. Actually, I accelerated a little bit too much on my own and kicked myself into trouble with org.eclipse.ui.acceleratorSets etc. Now back to just what you told me (accelerator attribute) there is one big problem remaining: - when some quick bookmarks are set, then lines before them are inserted/removed, the following bookmarks (just standard ones) ain't updated in there attributes LINE_START, CHAR_START and CHAR_END. As my code is tied to LINE_START (and I tested with CHAR_START too) this leads to misbehaviour, because I compare the actual selection start in the resource with the bookmark attributes. I'm in trouble here and wonder, how the bookmarks View is able to move to/delete the right bookmark (so I know, there MUST be a solution, but was unable yet, to find it). Anybody able and willing to help me out? Thanks in advance and I'll release a Beta of my QuickMarks, when this issue is solved Georg
Hi listeners, nobody was able, willing or (that is!) had the time to help me out, so I had to resolve the issue with non updating bookmarks on my own ... hmmm, not really, I had several looks at the (hopefully) right places in the Eclipse code base (especially some implementors of ITextEditor.gotoMarker(IMarker)) and now: I am proud to make 'QuickMarks version 1.0 beta1' available to the community at: http://privat.schlund.de/O/OSG-eV/other/de.re.quickmarks_1.0_beta1.zip Please download, read the readme.txt, install and use it, then tell me what you think. have a nice day Georg PS: If I introduced no new bugs, then this bug's status could be changed to 'FIXED'
Hi, please accept Quickmarks 1.0 beta2 at: http://privat.schlund.de/O/OSG-eV/other/de.re.quickmarks_1.0_beta2.zip The big change is the introduction of a new Quickmark, derived from 'problemmarker' with severity INFO and an update of markers every time some Quickmark action is requested. In the UI the Quickmarks no longer show up in (and clutter) the Bookmarks View, but instead are managable via the Tasks View, including suppressing them altogether. regards Georg PS: someone please change this bug to be FIXED
Changing to FIXED as requested.