Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Please see More Information for a discussion on how to reproduce - the fix is 1 line. 2. 3. More information: We register a Wizard with the importWizards extension point. When a user double clicks on the item in the import wizard tree 2 calls are made to showPage. This is general not an issue, however in our situation a lengthy calculation is performed before the first wizard page is displayed – which we allow the user to cancel, if cancelled we return the user to the import wizard. General to achieve cancellation we would use a IPageChangingListener, however in this case, as it is the first wizard page it is not possible as we do not gain access to the page Container to register the listener with, until it is too late – so instead within the pages setVisible method we register a IPageChangedListener if the operation is cancelled. Within its pageChanged method we call: getWizard().getContainer().showPage(getPreviousPage()); The above technique works fine if the user uses the Next button to advance to our wizard – however if the user instead double clicks on the item in the tree we find are setVisible method is called twice. I have tracked the reason down to the following code in org.eclipse.ui.internal.dialogs.ImportExportPage.java protected void treeDoubleClicked(DoubleClickEvent event) { 233: ISelection selection = event.getViewer().getSelection(); 234: IStructuredSelection ss = (IStructuredSelection) selection; 235: listSelectionChanged(ss); 236: 237: Object element = ss.getFirstElement(); 238: TreeViewer v = (TreeViewer) event.getViewer(); 239: if (v.isExpandable(element)) { 240: v.setExpandedState(element, !v.getExpandedState(element)); 241: } else if (element instanceof WorkbenchWizardElement) { 242: if (canFlipToNextPage()) { 243: getContainer().showPage(getNextPage()); 244: } 245: } 246: getContainer().showPage(getNextPage()); 247: } It seems line 243 is being invoked and then line 246 – both calling showPage The first few lines of showPage are public void showPage(IWizardPage page) { if (page == null || page == currentPage) { return; } Hence in the common case after the first call to showPage – currentPage is set and when the second call comes in page == currentPage and no action is taken. However, if the first call to showPage causes the page to reverted to the import wizard page, in the second call page != currentPage. A simple one line fix to the problem would be to add a return statement after line 243.
Created attachment 126435 [details] Patch
(In reply to comment #1) > Created an attachment (id=126435) [details] > Patch Released to HEAD for >20090223 David, when I20090224-0800 becomes available (probably on Wed :-) at http://download.eclipse.org/eclipse/downloads/ could you please test that this doesn't introduce any unusual behaviour in your usecase? Thanx, PW
Verified in I20090310-0100