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

Bug 334222

Summary: Add svg filename extension to XML content type
Product: [WebTools] WTP Source Editing Reporter: Andrey Rodionov <dernasherbrezon>
Component: wst.xmlAssignee: wst.xml <wst.xml-inbox>
Status: NEW --- QA Contact: Nitin Dahyabhai <thatnitind>
Severity: enhancement    
Priority: P3 CC: nsand.dev, rakes123, thatnitind
Version: 3.2.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: needs evaluation
Attachments:
Description Flags
stacktrace none

Description Andrey Rodionov CLA 2011-01-13 03:00:35 EST
Build Identifier: 20100218-1602

While formatting .svg file.

java.lang.NullPointerException
at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.doOperation(StructuredTextViewer.java:525)

Reproducible: Always

Steps to Reproduce:
1. Open the following .svg file with XML editor:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
</svg>

2. Hit "ctrl-shift-f"
3. NPE with the attached stacktrace
Comment 1 Andrey Rodionov CLA 2011-01-13 03:01:41 EST
Created attachment 186708 [details]
stacktrace
Comment 2 Rakesh CLA 2011-01-13 04:21:58 EST
I was not able to reproduce it.Could you try it on latest build?
Comment 3 Andrey Rodionov CLA 2011-01-13 13:08:43 EST
Able to reproduce using:


Eclipse configuration:

Build Identifier: 20100917-0705

eclipse.buildId=M20100909-0800
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=ru_RU
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product

WTP configuration:

Eclipse XML Editors and Tools

Version: 3.2.2.v201008170029-7H7AFUQDxumQGOpBqffOY2f1qxDZ
Build id: 20100915173744
Comment 4 Nitin Dahyabhai CLA 2011-01-13 15:50:43 EST
The viewer must not have a content formatter...which is surprising since I thought all of our viewer configurations returned one.  Still, its not checked for being null.
Comment 5 Nick Sandonato CLA 2011-01-13 16:04:20 EST
This looks like a case where Open With... is used to open the SVG file with the XML editor. If that's the case, you could associate the .svg extension with the XML content type to avoid this problem. In the menu, choose Window > Preferences, then in the tree expand General and pick Content Types. In the Content Types tree, expand Text and select XML. Click the Add... button and enter *.svg then press OK. Press OK to save the settings. The next time you open your .svg file, you should be able to format correctly.
Comment 6 Andrey Rodionov CLA 2011-01-14 02:00:44 EST
Thanks!

It helps. You were right about "Open with..."

I think it is more natural and fast to open using "Open with.." rather than using content types. 

So I have two suggestions:

1) Is it possible to make both variances work the same way?
2) It would be nice to add *.svg by default to preferences since SVG is a common XML file.