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

Bug 366468

Summary: CCE in org.eclipse.ui.part.PageBookView: violation of contract by casting ISelecitonProvider to PageBookView$SelectionProvider
Product: [Eclipse Project] Platform Reporter: Andrey Loskutov <loskutov>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED INVALID QA Contact:
Severity: major    
Priority: P3 CC: john, pwebster, remy.suen, ReubenGarrett
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Andrey Loskutov CLA 2011-12-12 17:32:31 EST
Build Identifier: 3.8 M4

After upgrading to 3.8 M4 from 3.7.1 any attempt to use history view with mercurialEclipse plugin fails because PageBookView now expects that getSite().getSelectionProvider() must be always PageBookView$SelecitonProvider which is obviously just plain wrong - it can be ANY ISelecitonProvider.

So all history page providers having they own selection provider set will be broken.
Currently each seleciton in the Mercurial history view leads to two errors shown to the user.

Reproducible: Always

Steps to Reproduce:
Stack:
java.lang.ClassCastException: com.vectrace.MercurialEclipse.history.GraphLogTableViewer cannot be cast to org.eclipse.ui.part.PageBookView$SelectionProvider
	at org.eclipse.ui.part.PageBookView.postSelectionChanged(PageBookView.java:907)
	at org.eclipse.ui.part.PageBookView.access$3(PageBookView.java:905)
	at org.eclipse.ui.part.PageBookView$3.selectionChanged(PageBookView.java:172)
	at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:888)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:886)
	at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1226)
	at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1251)
	at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:262)
	at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:256)
	at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:433)
Comment 1 Andrey Loskutov CLA 2011-12-12 18:07:06 EST
Please ignore my ignorant bug report. I shouldn't write anyone anymore after
23:00. The code in question did some weird global selection provider hacks and
now Eclipse just strikes back.

mercurialeclipse/plugin/src/com/vectrace/MercurialEclipse/history/MercurialHistoryPage.java:

// it looks crazy, but the fact is that the page site doesn't set global
// selection provider, so we must have it set properly to support Properties
view
getSite().getPage().findView(IHistoryView.VIEW_ID).getSite().setSelectionProvider(provider);

Sorry for the noise.
Comment 2 Paul Webster CLA 2011-12-12 18:58:11 EST
(In reply to comment #1)
> Sorry for the noise.

We still don't mind the reports, just in case we have broken stuff in 4.2 or 3.8.  Better to be safe than sorry.

PW
Comment 3 Remy Suen CLA 2012-01-08 07:37:36 EST
*** Bug 368058 has been marked as a duplicate of this bug. ***