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

Bug 103491

Summary: WSDL and XSD editors throw exception opening external file
Product: [WebTools] WTP Webservices Reporter: Dave Carlson <dcarlson>
Component: wst.wsdlAssignee: Nitin Dahyabhai <thatnitind>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2 CC: a_markevich, david_williams
Version: 0.7   
Target Milestone: 1.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dave Carlson CLA 2005-07-12 10:43:33 EDT
The wsdl.ui editor throws a class cast exception when user attempts to open a 
file external to the workspace.  See partial stack trace below.

The SSE documentation for WTP states that external files are supported (in 
general).  I am testing the WTP editors with several end users, and the first 
thing one of my testers did was try to open an external WSDL file for 
GoogleSearch.wsdl.  Of course, in his opinion, the editor was "broken".  I 
think this is critical to fix before 0.7.

java.lang.ClassCastException: 
org.eclipse.ui.internal.editors.text.JavaFileEditorInput
	at org.eclipse.wst.wsdl.ui.internal.WSDLEditor.addSourcePage
(WSDLEditor.java:266)
	at org.eclipse.wst.wsdl.ui.internal.WSDLEditor.createPages
(WSDLEditor.java:186)
	at org.eclipse.ui.part.MultiPageEditorPart.createPartControl
(MultiPageEditorPart.java:241)
Comment 1 David Williams CLA 2005-07-12 15:44:24 EDT
Nitin, you are familiar with these issues, will you please make sure WSDL Editor
is as graceful as it can be for external files (and those from IStorageInput,
such as CVS). 

Thanks,
Comment 2 Nitin Dahyabhai CLA 2005-07-12 16:40:32 EDT
The editor class was using the old setModel(IFileEditorInput) call on
StructuredTextEditor inside of its addSourcePage() method.  Removing it makes it
all work fine as far as I can tell, both from CVS and as an external file--the
source page already receives and handles the IEditorInput when the page is
created just like any other editor.
Comment 3 David Williams CLA 2005-07-12 18:10:54 EDT
released for RC1
Comment 4 David Williams CLA 2006-09-22 21:07:15 EDT
This bug is being moved to the "closed" state since it has been in the fixed state for a so long it is being assumed fixed, without explicit verification from the originator. If there is still a problem, in the most recent 1.5.x builds, please reopen or open another bug.
Comment 5 Ben Rohlfs CLA 2006-12-01 09:49:14 EST
Bug is NOT fixed in wtp-all-in-one-sdk-R-1.5.2-200610261841-win32.zip:

java.lang.ClassCastException: org.eclipse.ui.internal.editors.text.JavaFileEditorInput org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor.buildAndSetModel(ASDMultiPageEditor.java:172) org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor.createPages(ASDMultiPageEditor.java:148)
org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor.createPages(InternalWSDLMultiPageEditor.java:383)
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:276)
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
Comment 6 Alexey Markevich CLA 2007-11-20 11:15:58 EST
2 ways to reproduce this exception:

1) wsdl-based format, described as follows:
   <extension point="org.eclipse.core.runtime.contentTypes">
      <content-type priority="high"
                    name="sdx"
                    id="sdx"
                    base-type="org.eclipse.wst.wsdl.wsdlsource"
                    default-charset="UTF-8"
                    file-extensions="sdx" />
   </extension>

2) Extension of org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor:

	<!-- editor -->
	<extension point="org.eclipse.ui.editors">
		<editor
			name="%opdxEditorName"
			icon="icons/opdx.gif"
			contributorClass="org.eclipse.wst.wsdl.ui.internal.WSDLActionBarContributor"
			class="org.eclipse.stp.policy.wtp.editor.OperationPolicyMultiPageEditor"
			id="org.eclipse.stp.policy.wtp.editor.OperationPolicyMultiPageEditor"
		>
			<contentTypeBinding
				contentTypeId="org.eclipse.stp.policy" />
		</editor>
	</extension>

	<!-- content type -->
	<extension point="org.eclipse.core.runtime.contentTypes">
		<content-type
			name="%opdxFileContentType.name"
			id="org.eclipse.stp.policy"
			base-type="org.eclipse.core.runtime.xml"
			default-charset="UTF-8"
			file-extensions="opdx"
		/>
	</extension>
Comment 7 Alexey Markevich CLA 2007-11-21 09:08:20 EST
Workaround for both cases like WSDL editor - open external files using XML editor:

1)
	<extension point="org.eclipse.core.runtime.contentTypes">
		<content-type
			name="sdx"
			id="sdx"
			base-type="org.eclipse.wst.wsdl.wsdlsource"
			default-charset="UTF-8"
			file-extensions="sdx"
			priority="high"
		/>
		<file-association
			content-type="org.eclipse.core.runtime.xml"
			file-extensions="sdx"
		/>
	</extension>

2)
	<!-- editor -->
	<extension point="org.eclipse.ui.editors">
		<editor
			name="%opdxEditorName"
			icon="icons/opdx.gif"
			contributorClass="org.eclipse.wst.wsdl.ui.internal.WSDLActionBarContributor"
			class="org.eclipse.stp.policy.wtp.editor.OperationPolicyMultiPageEditor"
			id="org.eclipse.stp.policy.wtp.editor.OperationPolicyMultiPageEditor"
			default="true"
		>
			<contentTypeBinding
				contentTypeId="org.eclipse.stp.policy" />
		</editor>
	</extension>

	<!-- content type -->
	<extension point="org.eclipse.core.runtime.contentTypes">
		<content-type
			name="%opdxFileContentType.name"
			id="org.eclipse.stp.policy"
			base-type="org.eclipse.core.runtime.xml"
			default-charset="UTF-8"
			file-extensions="opdx"
			priority="high"
		/>
		<file-association
			content-type="org.eclipse.core.runtime.xml"
			file-extensions="opdx"
		/>
	</extension>