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

Bug 205518

Summary: refactor rename context menu item does not follow selection very well in source editor
Product: [WebTools] WTP Source Editing Reporter: Amy Wu <for.work.things>
Component: wst.xsdAssignee: wst.xsd-triaged <wst.xsd-triaged>
Status: CLOSED FIXED QA Contact: Valentin Baciu <valentinbaciu>
Severity: normal    
Priority: P3 CC: gindik, valentinbaciu
Version: 2.0.1   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Amy Wu CLA 2007-10-04 16:52:36 EDT
using wtp 2.0.2 oct 4 build

if you select text in the source editor of the schema editor, the refactor context menu item will enable/disable properly and show the right text in the rename dialog.  but if you just move the cursor around without selecting text, the refactor context menu item seems to only remember the last selected text
Comment 1 Valentin Baciu CLA 2008-12-05 13:26:13 EST
*** Bug 247056 has been marked as a duplicate of this bug. ***
Comment 2 Valentin Baciu CLA 2009-03-03 19:25:36 EST
Still a problem with 3.1. Here's some more info.

The Refactor action delegate is contributed as a viewerContribution and expects to be called with the current (DOM) selection to update its children's enabled/disabled state.

I have noticed that the source editor (and potentially even the text editor) does not send selection change events when the user simply clicks around on the text. In one scenario the cursor is moved from inside an attribute's value to another's in a different element, with no text selected. Instead of selection changed events, the editor sends post selection change events, and our refactor action delegate is not listening to those (the source viewer is not adding it to the post selection listeners list).

The selection change event is fired if I select some text and then move away to another attribute or element. Basically any real change in the text selection seems to trigger the correct selection change event, and properly enable/disable our action (I had to make a minor change in our code to convert from an attribute to its parent element).

This is unlike the Java editor where the user can simply click on a method name and refactor/rename it, without having to select the entire name, or any part of the name for that matter. It seems we need a little help from the source editor to get this working properly. Until such time, please use the graphical view.
Comment 3 Valentin Baciu CLA 2010-05-06 16:10:56 EDT
It seems we've fixed this indirectly when implementing bug 253264. This works fine with WTP 3.2 M6 and newer.
Comment 4 Valentin Baciu CLA 2010-05-06 16:11:12 EDT
Closing.