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

Bug 371683

Summary: Editor flags "dirty" state change on outline click
Product: [ECD] Orion Reporter: Simon Kaegi <simon_kaegi>
Component: ClientAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon, Silenio_Quarti
Version: 0.4Flags: Silenio_Quarti: review+
Target Milestone: 0.4 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 371696    

Description Simon Kaegi CLA 2012-02-15 17:04:12 EST
Modify a file, click on an item in the outline view and you get the dirty page dialog. This is pretty bad.
Comment 1 Mark Macdonald CLA 2012-02-15 20:02:14 EST
There's a helper in setup.js that figures out if a given URI represents a different resource from the one you're editing. While it was supposed to take a URI, in fact it only worked correctly when passed a fragment with no '#'. This made it fail when called by the selection service (which the outliner uses). I changed it to expect the '#'. [1].

Fix is on branch bug371683:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=bug371683

Tested these cases, in both dirty and clean editors:
(a) Navigate to outline items
(b) Open the same resource using the Find Files dialog
(c) Open a different resource using the Find Files dialog
(d) Open a different resource by editing the address bar.

and verified:
 - Not prompted when navigating outline
 - Not prompted when leaving a clean editor
 - Not prompted when selecting the same resource from "Find Files" dialog
 - Prompted when leaving a dirty editor (there's a separate bug here regarding the repeated prompt, see 371696)
Comment 2 Silenio Quarti CLA 2012-02-16 15:18:10 EST
Changes are good.
Comment 3 Silenio Quarti CLA 2012-02-16 16:02:04 EST
There is problem with this patch. The call to setSelections() in hashChanged() needs to prepend "#" to dojo.hash().  Otherwise adding a line number parameter to the hash in the address bar does not work.  

Note that the patch from bug#371696 is doing that.
Comment 4 Mark Macdonald CLA 2012-02-16 16:16:18 EST
Updated the branch to fix the issue Silenio found.
Comment 5 Silenio Quarti CLA 2012-02-16 16:56:36 EST
The updated changes can released.