Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 407978 - CTRL+Q should jump to last known edited position in XML editor
Summary: CTRL+Q should jump to last known edited position in XML editor
Status: CLOSED DUPLICATE of bug 392414
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: wst.xml CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-14 04:38 EDT by Lars Vogel CLA
Modified: 2013-05-27 06:56 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2013-05-14 04:38:49 EDT
JDT has the great feature that if you press CTRL+Q it jumps to the last editor and the last edited position. 

Would be great if the XML editor would support the same feature.

I'm not sure how JDT implements this functionality, maybe it is easy to reuse that feature.
Comment 1 Lars Vogel CLA 2013-05-14 04:39:40 EDT
cc Dani, maybe he can share some infos about the jump to last edited position feature.
Comment 2 Dani Megert CLA 2013-05-14 10:12:07 EDT
This feature is in the platform and works out of the box for textual editors (AbstractTextEditor). It even works in the PDE editors (text pages only). If you're not using that infrastructure, you'll have a hard time to hook into this.
Comment 3 Nitin Dahyabhai CLA 2013-05-14 10:35:08 EDT
We are, but as a page of a MultiPageEditorPart
Comment 4 Dani Megert CLA 2013-05-14 10:38:58 EDT
(In reply to comment #3)
> We are, but as a page of a MultiPageEditorPart

Then it should probably just work, except maybe the action is not enabled. I suggest to start debugging around org.eclipse.ui.texteditor.GotoLastEditPositionAction.
Comment 5 Nick Sandonato CLA 2013-05-14 11:27:24 EDT
Using Eclipse 4.3.0 I20130430-2000 I have seen that I can navigate to the Last Edit Location from the PDE editors if the destination is not within a PDE editor. This is the same for the XML editor. There's a PartInitException thrown when the last edit position is within a text PDE editor or the XML editor.
Comment 6 Dani Megert CLA 2013-05-14 11:31:48 EDT
(In reply to comment #5)
> Using Eclipse 4.3.0 I20130430-2000 I have seen that I can navigate to the
> Last Edit Location from the PDE editors if the destination is not within a
> PDE editor.

Can you provide exact steps using the Plug-in Manifest Editor?


> This is the same for the XML editor. There's a PartInitException
> thrown when the last edit position is within a text PDE editor or the XML
> editor.

PartInitException sounds strange. Steps for that would also be good.
Comment 7 Nick Sandonato CLA 2013-05-14 13:00:46 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > Using Eclipse 4.3.0 I20130430-2000 I have seen that I can navigate to the
> > Last Edit Location from the PDE editors if the destination is not within a
> > PDE editor.
> 
> Can you provide exact steps using the Plug-in Manifest Editor?
> 
On the plugin.xml source tab, I added some spaces somewhere in the middle of the document. I then placed my cursor at the beginning of the document. I pressed Ctrl+Q, and the cursor stayed at the beginning of the document.

> 
> > This is the same for the XML editor. There's a PartInitException
> > thrown when the last edit position is within a text PDE editor or the XML
> > editor.
> 
> PartInitException sounds strange. Steps for that would also be good.

Following the steps I've provided, WorkbenchPage#busyOpenEditor() tries to find the editor matching editorId. For both the PDE and XML editors, a null EditorDescriptor is returned. Because it is null, a PartInitException is thrown. That exception is caught, and the GoToLastEditPosition action just returns at that point.
Comment 8 Dani Megert CLA 2013-05-27 06:53:14 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > Using Eclipse 4.3.0 I20130430-2000 I have seen that I can navigate to the
> > > Last Edit Location from the PDE editors if the destination is not within a
> > > PDE editor.
> > 
> > Can you provide exact steps using the Plug-in Manifest Editor?
> > 
> On the plugin.xml source tab, I added some spaces somewhere in the middle of
> the document. I then placed my cursor at the beginning of the document. I
> pressed Ctrl+Q, and the cursor stayed at the beginning of the document.

This works fine for me using 4.3 RC2:
http://download.eclipse.org/eclipse/downloads/drops4/S-4.3RC2-201305231400/


Note that there are issues when e.g. the editor gets closed, or the page changed. See bug 32214 for those issues.
Comment 9 Dani Megert CLA 2013-05-27 06:56:21 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > (In reply to comment #5)
> > > > Using Eclipse 4.3.0 I20130430-2000 I have seen that I can navigate to the
> > > > Last Edit Location from the PDE editors if the destination is not within a
> > > > PDE editor.
> > > 
> > > Can you provide exact steps using the Plug-in Manifest Editor?
> > > 
> > On the plugin.xml source tab, I added some spaces somewhere in the middle of
> > the document. I then placed my cursor at the beginning of the document. I
> > pressed Ctrl+Q, and the cursor stayed at the beginning of the document.
> 
> This works fine for me using 4.3 RC2:
> http://download.eclipse.org/eclipse/downloads/drops4/S-4.3RC2-201305231400/

Sorry, I was running on 3.8.2. It works there, but is broken in 4.x, see bug 392414.

*** This bug has been marked as a duplicate of bug 392414 ***