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

Bug 358446

Summary: text range issues when saving from JPA Details view
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: JPAAssignee: Brian Vosburgh <brian.vosburgh>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 3.1   
Target Milestone: 3.2   
Hardware: PC   
OS: Windows XP   
Whiteboard: wtp4x

Description Karen Butzke CLA 2011-09-21 11:29:33 EDT
Using Eclipse 4.2 platform, follow these steps:
1. Make sure the Project Explorer has the 'Link with Editor' button selected. This just makes it possible to use ctrl->s from the JPA Details view. Otherwise use ctrl->shift->s to save.
2. Edit a Java entity through the JPA Details view and add a named query setting only the name. Select the java editor and save. There should be a validation error with the text range on the query name.
3. Now return to the JPA Details view and edit the query name making it longer. Save using ctrl->s without returning to the java editor. Notice that the text range for the validation error is the length of the original query name instead of the new name.

This is a minor issue, but one that could become more problematic as we continue to change to caching textRanges instead of building them on demand during validation. This is related to the focus listener we setup in JptJpaUiPlugin where we stop listening to java events when the JPA details view has focus. Using Eclipse platform 3.x when you save using ctrl-s in the details view, the focus goes to the editor momentarily and then goes back to the jpa details view. This causes us to resync with the java model and rebuild that text range. This does not happen on Eclipse platform 4.x. I am not sure whether the 3.x platform functionality is a feature or a bug, they might not be doing this on purpose.
Comment 1 Brian Vosburgh CLA 2012-02-16 18:03:20 EST
Fixed alongside major changes to the JpaProjectManager and checked into HEAD.