Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 413430

Summary: [navigation] Last edit position's editor id for multi-page editors is ""
Product: [Eclipse Project] Platform Reporter: Daniel Rolka <daniel.rolka>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, noopur_gupta, webredjo+eclipse
Version: 4.3Flags: noopur_gupta: review+
Target Milestone: 4.3.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 32214    

Description Daniel Rolka CLA 2013-07-22 06:30:26 EDT
To reproduce it the #392414 has to be fixed first

Steps to reproduce the issue:

Variant 1:

1) Open some resource using multipage editor and switch to some 'text' editor page (for instance plugin.xml file in the Manifest editor)
2) Edit some line, move cursor to different position and click the 'Last edit location' toolbar button. It should work properly
3) Switch to other 'text' page and click again the 'Last edit location' button. The cursor will be set using location from the previous page. 


Variant 2:

1) Open some resource using multipage editor and switch to some 'text' editor page (for instance plugin.xml file in the Manifest editor)
2) Open the same resource using other multipage editor and switch to some 'text' editor page (for instance XML editor from the WST package)
3) Using first editor edit some line and next switch to the second editor and use the 'Last edit location' button. The cursor will be set using the last edit position value from the first editor 

Probably the issue is connected to:
a) setting the last edit position in the following manner:
class org.eclipse.ui.texteditor.AbstractTextEditor.TextListener, line 638:
  TextEditorPlugin.getDefault().setLastEditPosition(new EditPosition(input, getEditorSite().getId(), fLocalLastEditPosition));

b) Not considering the internal editor page during setting the last edit position value
Comment 1 Dani Megert CLA 2013-07-22 10:51:31 EDT
(In reply to comment #0)
> To reproduce it the #392414 has to be fixed first

That "fix" is wrong and hence surfaces this issue here. Having said that, the last edit position's editor id is "" for multi-page editors. This should not be the case.
Comment 2 Dani Megert CLA 2013-07-22 10:53:40 EDT
Fixed with http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=a16b4fcfc9b70ad415eed9abf1f63e88d206af0f

This fixes the scenario from bug 392414 comment 2, but most likely not the XML editor case (bug 392414) which got broken in 4.x.
Comment 3 Dani Megert CLA 2013-07-25 06:26:12 EDT
We should backport this, since a (good) change in the Platform now surfaces this problem (see bug 392414).
Comment 4 Dani Megert CLA 2013-07-25 06:28:03 EDT
*** Bug 392414 has been marked as a duplicate of this bug. ***
Comment 5 Dani Megert CLA 2013-07-25 06:31:00 EDT
Noopur, please test and review the fix.
Comment 6 Noopur Gupta CLA 2013-07-29 08:37:38 EDT
The patch looks good. 
Tested using PDE and text editor for xml files.
Comment 8 Noopur Gupta CLA 2013-08-05 08:22:54 EDT
Verified in 4.4 using Build id: I20130804-2300 and verified for 4.3.1 using
Build id: M20130731-0800.