Community
Participate
Working Groups
Build Identifier: I20100531-1900 Get this exception: java.lang.ClassCastException: org.eclipse.jface.text.TextSelection cannot be cast to org.eclipse.jface.viewers.IStructuredSelection at org.eclipse.e4.tools.emf.editor3x.compat.IEclipseContextServiceFactory$1.selectionChanged(IEclipseContextServiceFactory.java:67) at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156) at org.eclipse.ui.internal.AbstractSelectionService$1.selectionChanged(AbstractSelectionService.java:62) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162) 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.Viewer.fireSelectionChanged(Viewer.java:160) at org.eclipse.jface.text.TextViewer.fireSelectionChanged(TextViewer.java:2728) at org.eclipse.jface.text.TextViewer.selectionChanged(TextViewer.java:2707) at org.eclipse.jface.text.TextViewer.setSelectedRange(TextViewer.java:2392) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEditor.java: In IEclipseContextServiceFactory line 67, the selection is cast to IStructuredSelection without checking its type. Turns out it's not always a IStructuredSelection. Also, when all the Workbench Model Editor parts are closed, the behavior goes on. Maybe the selection listener could be removed in some conditions (currently, the IEclipseContextServiceFactory is an internal class(!) so it can consider only the current bundle is using it). Reproducible: Always Steps to Reproduce: 1. Open Workbenchmodel editor in 3.6 2. Open Error Log 3. Select Console view
Created attachment 170766 [details] Git patch fixes the exception Here's a simple patch that prevent the exception from happening.
Created attachment 170772 [details] Improved fix, now adds the ISelection to the context instead of dropping it
fix released to head - thanks