Community
Participate
Working Groups
If you bookmark a .class file (which has no visible contents) and then double click on the bookmark from the bookmarks view you get a Class Cast Exception STEPS 1) Open a .class file (one of the ones in rt.jar is fine) 2) Select Add a Bookmark 3) Open the Bookmarks view 4) Double click on the bookmark 4 org.eclipse.ui 0 org.eclipse.core.internal.resources.Project java.lang.ClassCastException: org.eclipse.core.internal.resources.Project at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:968) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:959) at org.eclipse.ui.views.bookmarkexplorer.OpenBookmarkAction.run(OpenBookmarkAction.java:30) at org.eclipse.ui.views.bookmarkexplorer.BookmarkNavigator$2.doubleClick(BookmarkNavigator.java:109) at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:269) at org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:409) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetDefaultSelected(AbstractTreeViewer.java:626) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:622) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:963) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:637) at org.eclipse.ui.internal.Workbench.run(Workbench.java:620) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:815) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:126) at org.eclipse.core.launcher.Main.run(Main.java:408) at org.eclipse.core.launcher.Main.main(Main.java:281) NOTES: DS (6/12/01 12:01:36 PM) Here is the offending code .. public IEditorPart openEditor(IMarker marker, boolean activate) throws PartInitException { // Get the resource. IFile file = (IFile)marker.getResource(); <------ according to exception .. } Problem 1: I suspect this exception occurs because the result of getResource is an IProject, not an IFile. The marker target is a class file in an external jar. There is no underlying resource for the class file, so I would guess that the java team is hanging the marker on the project itself. Thus, getResource returns an IProject rather than an IFile. If the getResource result is not an IFile there is no way for the workbench to determine the editor input. IMarker does not provide API to support the scenario. Solution: check type of getResource result. If not IFile show error dialog and return. Problem 2: The marker shouldn't even exist. As stated above, IMarker doesn't provide API to get the real marker target. Our own AddBookmarkAction does not support the creation of bookmarks on non-IFiles, so the java team must be defining another bookmark action to bookmark class files. This is an error. The packages view should not allow bookmarking on class files. EG (6/12/2001 7:09:23 AM) the real problem is described here 1G8SCA9: ITPUI:ALL - Cannot open breakpoint on external jar This problem will not be fixable so we have to investigate in workarounds. Changing the Add book mark action in the packages view is no problem. However, it isn't enough we can also create book marks in the Class File editor. Tasks will have the same problem, need to verify. ARCH (6/12/01 3:21:05 PM) Defer - Erich is doing separate workaround fix.
PRODUCT VERSION: 122
Add Bookmark is now disabled for entries with no text.