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

Bug 304890

Summary: [Forms] FormEditor.getCurrentPage() doesn't work as explained in JavaDoc
Product: [RT] RAP Reporter: Michal Tkacz <Michal.Tkacz>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 1.3 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed patch that returns the IPageChangeProvider implementation in FormEditor none

Description Michal Tkacz CLA 2010-03-05 16:55:31 EST
Build Identifier: 20100201-1223

FormEditor.getCurrentPage() doesn't work as explained in JavaDoc. In particular during the page switch, this method is identical to FormEditor.getActivePage() i.e. it returns the NEW active page index. Note that RCP version works as expected.

Probably this can be fixed easily by changing FormEditor.pageChange(int) and moving this line:

this.currentPage = newPageIndex;

to the end of the method, after these lines:

if (newPage != null)
  firePageChanged(new PageChangedEvent(this, newPage));

Reproducible: Always

Steps to Reproduce:
1. Create a multi-page editor by subclassing FormEditor.
2. Use addPageChangedListener method to add a listener.
3. Use debugger to verify value of getCurrentPage() when PageChangedEvent is fired.
Comment 1 Ivan Furnadjiev CLA 2010-03-06 03:07:52 EST
Hi Michal, we recently adopted the Forms 3.6 code base ( see bug 303731 ) and now this.currentPage = newPageIndex; is called at the end of FormEditor.pageChange(int). Can you check if the bug is fixed with the RAP from CVS HEAD?
Comment 2 Michal Tkacz CLA 2010-03-06 09:48:56 EST
Actually addPageChangedListener method is no longer present in FormEditor or any of its superclasses in CVS HEAD. For RCP (checked with 3.6M4) it's available in MultiPageEditorPart. So I have no way to test if getCurrentPage() behaves correctly during the page switch.

Should I file another bug about addPageChangedListener method being missing?
Comment 3 Ivan Furnadjiev CLA 2010-03-06 12:14:25 EST
The implementation of IPageChangeProvider (add/removePageChangedListener) has been removed from the RCP FormEditor in 2008 ( see original FormEditor revision 1.39 ) and now, with the adoption of Forms 3.6 has been removed from RAP too. So, these methods have been remove intentionally. Please reopen this bug if the issue is still valid with CVS HEAD.
Comment 4 Ivan Furnadjiev CLA 2010-03-06 12:25:05 EST
OK... Now I see - the implementation of IPageChangeProvider (add/removePageChangedListener) has been moved from FormEditor to MultiPageEditorPart in Workbench 3.5, but RAP is still using Workbench 3.4. We need to find a solution for it.
Comment 5 Ivan Furnadjiev CLA 2010-03-06 13:04:33 EST
Created attachment 161226 [details]
Proposed patch that returns the IPageChangeProvider implementation in FormEditor
Comment 6 Michal Tkacz CLA 2010-03-06 13:36:48 EST
Thanks Ivan, this patch solves the problem for me. I hope it will make it into CVS before M6, right?
Comment 7 Ivan Furnadjiev CLA 2010-03-06 14:31:46 EST
Changes are in CVS HEAD.