Author: timotei
Date: Sat Jul 30 09:57:52 2011
New Revision: 50476
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50476&view=rev
Log:
eclipse plugin: In case the file doesn't contain any
WML code, the resource won't contain any nodes.
In this case, just return an empty root.
Modified:
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/ResourceUtils.java
Modified:
trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/ResourceUtils.java
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/ResourceUtils.java?rev=50476&r1=50475&r2=50476&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/ResourceUtils.java
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/utils/ResourceUtils.java
Sat Jul 30 09:57:52 2011
@@ -58,6 +58,7 @@
import org.wesnoth.wml.SimpleWMLParser;
import org.wesnoth.wml.WMLMacroCall;
import org.wesnoth.wml.WMLRoot;
+import org.wesnoth.wml.WmlFactory2;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -559,8 +560,9 @@
ResourceSet resourceSet = new ResourceSetImpl( );
Resource resource = resourceSet.getResource( uri, true );
if ( resource == null ||
- resource.getContents( ).isEmpty( ) )
- return null;
+ resource.getContents( ).isEmpty( ) ) {
+ return WmlFactory2.eINSTANCE.createWMLRoot( );
+ }
EObject result = resource.getContents( ).get( 0 );
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits