Bug 17385

Summary: [EditorMgmt] Write openEditor in terms of IStorage instead of
Product: [Eclipse Project] Platform Reporter: Darin Wright <darin.eclipse>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WONTFIX QA Contact: Boris Bokowski <bokowski>
Severity: enhancement    
Priority: P4 CC: david_williams
Version: 2.0Keywords: investigate
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Darin Wright CLA 2002-05-23 12:11:24 EDT
I tried to open "package.html" which was in a jar 
(org.elcipse.core.boot/boot.jar). I got the following:

!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 May 23, 2002 11:18:46.71
!MESSAGE org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput
!STACK 0
java.lang.ClassCastException: 
org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput
	at org.eclipse.ui.internal.EditorManager.openEditor
(EditorManager.java:383)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor
(WorkbenchPage.java:1701)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor
(WorkbenchPage.java:1669)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor
(EditorUtility.java:137)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor
(EditorUtility.java:108)
	at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open
(OpenActionUtil.java:52)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:167)
	at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:156)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun
(SelectionDispatchAction.java:178)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run
(SelectionDispatchAction.java:156)
	at 
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen
(PackageExplorerActionGroup.java:321)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$5.open
(PackageExplorerPart.java:297)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen
(StructuredViewer.java:320)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen
(StructuredViewer.java:494)
	at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen
(StructuredViewer.java:581)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent
(OpenStrategy.java:198)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:195)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:222)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1085)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1068)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:739)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:200)
	at org.eclipse.core.launcher.Main.run(Main.java:643)
	at org.eclipse.core.launcher.Main.main(Main.java:476)
Comment 1 Erich Gamma CLA 2002-05-25 09:13:17 EDT
Opening editors on jar entries (IStorageEditorInputs) works OK when there is a 
registered editor that can handle IStorageEditor input. It works 
for .properties files, for example. When There is no registered editor and the 
system editor is used then the workbench assumes that it is a IFileEditor input 
since external editors can only be opened on files. This hard cast is 
questionable. Possible solutions:
a) the code should checks wheter the editor is an IFileEditorInput and throws a 
PartInitException.
b) the code is generalized so that it can also handle IStorageInput, i.e., the 
StorageInput's contents is copied into a tmp file and an editor is opened on 
the temp file.
I suggest that at least a) is done.

Moving to Platform UI for comment.
Comment 2 Nick Edgar CLA 2002-05-28 19:48:47 EDT
(Although it looks like this stack dump is in JDT, it is not).

The openEditor methods should not make assumptions about type of input.
Should just throw PartInitException in this case.
Comment 3 Eduardo Pereira CLA 2002-05-29 11:24:18 EDT
Released changes in EditorManager to throw PartInitException.
Resolving as LATER, so we can write openEditor in terms of IStorage instead of 
IFile?
Comment 4 Randy Giffen CLA 2002-08-01 16:50:23 EDT
Reopened for investigation
Comment 5 Michael Van Meekeren CLA 2006-04-21 13:58:36 EDT
Moving Dougs bugs
Comment 6 Susan McCourt CLA 2009-07-09 19:01:52 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 7 Boris Bokowski CLA 2009-07-10 10:51:18 EDT
Closing for lack of activity.