Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 93482 - xml editor error with UML2 installed
Summary: xml editor error with UML2 installed
Status: CLOSED DUPLICATE of bug 89195
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 0.7   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: wst.xml CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-03 02:58 EDT by Gabriel Forro CLA
Modified: 2005-08-26 05:57 EDT (History)
3 users (show)

See Also:


Attachments
log file with stack traces (15.05 KB, text/plain)
2005-05-12 04:58 EDT, Nicolas Cabanis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Forro CLA 2005-05-03 02:58:57 EDT
If You try to open an xml document, where the root tag is <project>, the
java.lang.InstantiationException is thrown in the
org.eclipse.wst.sse.ui.internal.StructuredTextViewer.

For example create the next xml document:
<project>
  <name>hello</name>
</project>

Save it as an xml file (hello.xml), close it and try to open it again with the
xml editor.
The result is:
1. java.lang.InstantiationException is thrown
2. there is the following message in the desing tab of the xml editor:
"The document is empty"
3. there is no xml syntax highligting in the source tab of the xml editor.

This bug has been reported in the 78340 bug as Additional Comment #4.
Comment 1 Nitin Dahyabhai CLA 2005-05-04 15:48:02 EDT
Similar to bug 89195?
Comment 2 David Williams CLA 2005-05-09 12:17:41 EDT
Exactly same as 89195 as far as I can tell. 
This has been fixed in ant.core in M7 stream, but 
realize that doesn't help you right now with WTP M4
(since its based on M6). 

You can "work around" this bug in WTP M4 by disabling ant.core plugin, 
or, if you'd prefer, go into the ant.core plugin and comment out the 
ant contenttype contribution. This, of course, messes up some ant functions, 
but ... depending on what you need, it might get you by until the next milestone. 


*** This bug has been marked as a duplicate of 89195 ***
Comment 3 Nicolas Cabanis CLA 2005-05-10 05:48:25 EDT
(In reply to comment #2)

Commenting out the ant contenttype contribution does not work for me. 
The "java.lang.InstantiationException: 
org.eclipse.wst.sse.ui.internal.StructuredTextViewer" still gets thrown...

Additionally, I have another file that does not work and does not have the 
project tag. It's a UML2 model file. The problems seems to exist for each UML2 
model file.

I don't think this bug is resolved. (Or I'm doing something wrong...)

Comment 4 David Williams CLA 2005-05-10 08:22:29 EDT
To double check, when you comment out the ant contenttype contribution, you
might have to restart Eclipse with the -clean option for it to know to pick up
this change and flush any cached content type calculations. If that doesn't
work, please re-open. 

And, actually, would be fair to re-open based on your comment about UML files
... please attach a sample one. (and/or, you might try with UML2 plugins
disabled, to help us diagnose, but sounds like something we should definitily
try to reproduce). 
Comment 5 Nicolas Cabanis CLA 2005-05-11 07:14:54 EDT
(In reply to comment #4)
> To double check, when you comment out the ant contenttype contribution, you
> might have to restart Eclipse with the -clean option for it to know to pick up
> this change and flush any cached content type calculations. If that doesn't
> work, please re-open. 
You are right, with the "-clean" option it works for the sample file with 
the "project" tag.

> And, actually, would be fair to re-open based on your comment about UML files
> ... please attach a sample one. (and/or, you might try with UML2 plugins
> disabled, to help us diagnose, but sounds like something we should definitily
> try to reproduce).
This problem persists with the UML2 plugin disabled (if I did it correctly, 
using the configuration manager). It is enough to create a new model file and 
open that with the XML Editor to get the exception. 

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 
xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML" name="sample"/>
Comment 6 David Williams CLA 2005-05-11 09:02:12 EDT
I was not able to reproduce the UML2 mentioned problem, even with UML2 installed,
using the small sample provided. I tried with the 1.1 I200505051002 version of
UML2. 

Not sure what to recommend, unless its to be sure to check the .metadata/.log
file for any tell-tell clues. 

Thanks. 
Comment 7 Nicolas Cabanis CLA 2005-05-12 04:58:07 EDT
Created attachment 21030 [details]
log file with stack traces
Comment 8 Nicolas Cabanis CLA 2005-05-12 05:00:02 EDT
(In reply to comment #6)

> I was not able to reproduce the UML2 mentioned problem, even with UML2 
> installed, using the small sample provided. I tried with the 1.1 
> I200505051002 version of UML2. 

I just found out, the file must have the "uml2" extension for the exception to 
raise. Otherwise ("xml" extension), no exception is raised.

> Not sure what to recommend, unless its to be sure to check the .metadata/.log
> file for any tell-tell clues. 

I have uploaded the log file. Maybe this helps.
Comment 9 David Williams CLA 2005-05-12 08:48:24 EDT
This was helpful. 
I still could not replicate exception, per se, but admit, was testing on
slightly different version. 

But, the basic problem, I'm 99% sure, is that you have to tell Eclipse that uml2
is a type of XML content. See "contentTypes" in
http://www.eclipse.org/webtools/wst/components/sse/M4/news/sse-m4.html
for detailed steps, if needed. 

I suspect that will "get you going", but if you can think of ways to improve
error messages, etc., feel free to open feature requests for those. 
Comment 10 Nitin Dahyabhai CLA 2005-05-16 10:39:06 EDT
Incidentally, I just found the cause of the InstantiationException. 
org.eclipse.wst.sse.ui was incorrectly specifying the "StructuredTextViewer"
class as the fall-back text viewer configuration for StructuredTextEditors.  The
text viewer configurations are usually associated by content type and we define
them for the supported cases, but there is a "fall-back" defined as well to
prevent larger errors.  When an unsupported (or over-defined) content type comes
along, the fall-back is what gets used--in this case, erroneously specified as
the viewer class and not the viewer configuration class.  The plugin.xml file
must not have been updated correctly during one of the many refactorings that
have happened in the M3/M4 timeframe.

Checking the corrected plugin.xml into HEAD.
Comment 11 Nicolas Cabanis CLA 2005-05-17 05:02:36 EDT
I replaced the plugin.xml with the new one from CVS and now, I don't get the 
exception, but still a warning "StructuredTextEditor being used without 
StructuredDocument". Syntax-Highlighting and Outline are missing. If I rename 
the file from ".uml2" to ".uml2.xml" everything works fine.
Comment 12 David Williams CLA 2005-06-15 01:32:32 EDT
Changed Version field given new release numbering.
Comment 13 David Williams CLA 2005-07-25 11:43:39 EDT
Marking as verified as I know this issue is fixed (or correctly categorized).
If, as originator, you disagree or still see, please re-open, or open a new bug. 

Thanks very much for reporting and helping make WTP better. 
Comment 14 Nitin Dahyabhai CLA 2005-08-26 05:57:55 EDT
Closing