Bug 320996 - [misc] "Unsupported content type in editor" when opening XML files with XML editor
Summary: [misc] "Unsupported content type in editor" when opening XML files with XML e...
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major with 6 votes (vote)
Target Milestone: Future   Edit
Assignee: wst.xml-triaged CLA
QA Contact: Nick Sandonato CLA
URL: http://wiki.eclipse.org/WTP_FAQ#How_d...
Whiteboard:
Keywords:
: 327016 328210 333304 367696 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-27 07:27 EDT by Bruno Medeiros CLA
Modified: 2015-10-29 00:47 EDT (History)
14 users (show)

See Also:


Attachments
Screen shot showing the workaround isn't working in 3.8 (82.78 KB, image/png)
2013-03-22 11:01 EDT, Eric Rizzo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Medeiros CLA 2010-07-27 07:27:47 EDT
Build Identifier: I20100608-0911

As of Eclipse 3.6, whenever I try to open with the WTP XML editor any file whose extension or filename does not match the XML content type, I get the error:
"Unsupported content type in editor. To associate file extension with a supported
content type, please see Content Type Preference Page" and then just a basic text editor is opened.
Note that this happens even with some of child content type of the XML content type, such as the "Feature Manifest File" or "Product Configuration File" content types. 
Fresh Eclipse install and workspace.

Reproducible: Always

Steps to Reproduce:
1. Get some xml file. Rename the extension to .xxx or anything else that does not associate to the XML content type
2. Open context menu on file > "Open With" > XML editor
Comment 1 Rakesh CLA 2010-07-27 11:32:04 EDT
XML Editor is associated with contentTypes, and those contentTypes are further associated with fileextensions.If your fileextension doesn't match with any of the above assocaited fileextensions, then it will not be opened in XMLEditor.
Comment 2 Bruno Medeiros CLA 2010-07-28 07:24:49 EDT
(In reply to comment #1)
> XML Editor is associated with contentTypes, and those contentTypes are further
> associated with fileextensions.If your fileextension doesn't match with any of
> the above assocaited fileextensions, then it will not be opened in XMLEditor.

Is this really the intended behavior for the editor? Any other Eclipse editor i've tried before (including the XML Editor before Eclipse 3.6) allows opening files that do not match the editor content type. Why would the XML Editor be different? (Especially considering one is much more likely to encounter a file with XML content but with a filename that do not match the XML content type, than for example a Java file with a filename that does not end in ".java".)
Comment 3 Rakesh CLA 2010-07-28 07:49:23 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > XML Editor is associated with contentTypes, and those contentTypes are further
> > associated with fileextensions.If your fileextension doesn't match with any of
> > the above assocaited fileextensions, then it will not be opened in XMLEditor.
> 
> Is this really the intended behavior for the editor? Any other Eclipse editor
> i've tried before (including the XML Editor before Eclipse 3.6) allows opening
> files that do not match the editor content type. Why would the XML Editor be
> different? (Especially considering one is much more likely to encounter a file
> with XML content but with a filename that do not match the XML content type,
> than for example a Java file with a filename that does not end in ".java".)

Ok , you when you get "Unsupported content type in editor. To associate file extension with a
supported
content type, please see Content Type Preference Page" 

Click on Content Type Preference Page , content type preference dialog will pop up.Expand text node, under that click on xml node.You can add your file extension here( *.xxx etc) .Now you will be able to open it with no problem.
Comment 4 Nitin Dahyabhai CLA 2010-07-28 09:47:23 EDT
(In reply to comment #2)
> Is this really the intended behavior for the editor? Any other Eclipse editor
> i've tried before (including the XML Editor before Eclipse 3.6) allows opening
> files that do not match the editor content type. Why would the XML Editor be
> different? (Especially considering one is much more likely to encounter a file
> with XML content but with a filename that do not match the XML content type,
> than for example a Java file with a filename that does not end in ".java".)

It's an architectural limitation of the editor and its frameworks, one we'll be looking at removing over the next year.
Comment 5 Nick Sandonato CLA 2010-10-20 08:26:03 EDT
*** Bug 328210 has been marked as a duplicate of this bug. ***
Comment 6 Nitin Dahyabhai CLA 2011-02-01 19:02:42 EST
*** Bug 333304 has been marked as a duplicate of this bug. ***
Comment 7 Nick Sandonato CLA 2011-03-31 14:02:29 EDT
As Nitin mentioned, this is one we're going to be exploring.
Comment 8 Nick Sandonato CLA 2011-10-11 17:32:34 EDT
*** Bug 327016 has been marked as a duplicate of this bug. ***
Comment 9 Nick Sandonato CLA 2012-02-22 17:14:01 EST
*** Bug 367696 has been marked as a duplicate of this bug. ***
Comment 10 Vasia Pupking CLA 2012-02-27 07:07:05 EST
Is any workaround for this issue? It is very hardly to use eclipse without having this feature, as there are a lot of xml-files with any extension. For example, I could have erb-template in xml-format, but I definitely  can't change its default mime-type association as erb-template could be any mime-type, actually.
Comment 11 Eric Rizzo CLA 2012-03-30 11:58:17 EDT
No update from the team in over 18 months? This change broke functionality that users relied upon, to be so silent on this issue leaves a bad impression of the WTP team.
Comment 12 Nitin Dahyabhai CLA 2012-03-30 17:56:43 EDT
(In reply to comment #10)
> Is any workaround for this issue? It is very hardly to use eclipse without
> having this feature, as there are a lot of xml-files with any extension. For
> example, I could have erb-template in xml-format, but I definitely  can't
> change its default mime-type association as erb-template could be any
> mime-type, actually.

The workaround has been in our FAQ for years at this point.  I've placed its URL in the URL field to make it easier for you to find.  I'm having a little trouble parsing the second sentence.


(In reply to comment #11)
> No update from the team in over 18 months? This change broke functionality that users relied upon...

That's incorrect.  This has been an architectural issue dating back to the creation of WTP because of our pervasive use of the Platform Content Type system. It can always be handled better, and it's already been improved compared to WTP 0.7, but there's always the question of priorities with insufficient resources to do EVERYTHING we want to accomplish.

In the case of comment 0, this is a matter of our IDocument implementation not yet passing _all_ of the platform's text tests and causing them to, understandably, not want to use our (required) implementation with their manifest editors.  When we pass those tests or rearchitect things so we no longer require our own implementation (as we'd hoped to when I mentioned it in comment 4), that particular situation will be resolved--and possible this entire defect.
Comment 13 Eric Rizzo CLA 2013-03-22 11:01:50 EDT
Created attachment 228921 [details]
Screen shot showing the workaround isn't working in 3.8

In Eclipse 3.8 the workaround is no longer working for me. This screenshot shows that *.target has been added to the XML content type in Preferences, but when choosing Open with... > XML Editor I still get the Unsupported Content Type message. Same happens for some other XML files with non-xml extensions, such as .product and .launch
Comment 14 Andrey Loskutov CLA 2015-10-20 08:09:43 EDT
I was not aware about this bug (but was very well affected by the strange behavior) until recent discussion on the cross project mailing list.

Can we please have an assessment how much effort is needed to simply open the editor with given file, independently if its content type registered as "xml" or not?

(In reply to Rakesh from comment #1)
> XML Editor is associated with contentTypes, and those contentTypes are
> further associated with fileextensions.If your fileextension doesn't match
> with any of the above assocaited fileextensions, then it will not be opened
> in XMLEditor.

WHY??? Just assume a default xml content type for "unknown" file extensions and if this is not working, report "Failed to parse xml on line <XYZ>" error.

There are so many "custom" file extensions for xml files so that this "Unsupported content type in editor." error is not of any help for users. I'm not going to register 10+ possible file extensions each time I create a new workspace. The tooling should just try to parse whatever user gives and see if it works or not.
Comment 15 Nitin Dahyabhai CLA 2015-10-29 00:47:03 EDT
(In reply to Andrey Loskutov from comment #14)
> I was not aware about this bug (but was very well affected by the strange
> behavior) until recent discussion on the cross project mailing list.
> 
> Can we please have an assessment how much effort is needed to simply open
> the editor with given file, independently if its content type registered as
> "xml" or not?

We've required our own implementation of IDocument since the beginning, and have registered a document factory for the supported content types in that time. As I mentioned in comment 12, our implementation isn't 100% API compliant, so the platform has declared its own document factories for its various manifest file content types and *.target, and they're in the right on that one. I've pushed a smoother version of the workaround to master, but it doesn't change any of these fundamentals. Long term, we have to be able to operate properly off of whatever IDocument implementation the editor is given. It's a huge amount of work, and largely only applies to letting you open files in the XML Editor that already have editors of their own, and the case in bug 434610.