Community
Participate
Working Groups
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
Created attachment 186708 [details] stacktrace
I was not able to reproduce it.Could you try it on latest build?
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
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.
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.
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.