eclipse plugin: Compute the current parsed file location...
...in the constructor since we know there the information for sure.
This commit is contained in:
parent
f8ec31942f
commit
f71951adb8
2 changed files with 17 additions and 14 deletions
|
@ -4,8 +4,14 @@ Bundle-Name: Wesnoth UMC Dev tests
|
|||
Bundle-SymbolicName: org.wesnoth.tests
|
||||
Bundle-Version: 1.0.4
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.wesnoth;bundle-version="1.0.3",
|
||||
org.wesnoth.ui;bundle-version="1.0.3",
|
||||
org.eclipse.xtext.junit;bundle-version="2.0.0",
|
||||
org.eclipse.xtext;bundle-version="2.0.0"
|
||||
Export-Package: org.wesnoth.tests
|
||||
Require-Bundle: org.eclipse.xtext.junit;bundle-version="2.0.0",
|
||||
org.eclipse.xtext;bundle-version="2.0.0",
|
||||
org.wesnoth;bundle-version="2.0.0",
|
||||
org.wesnoth.ui;bundle-version="2.0.0"
|
||||
Export-Package: org.wesnoth.tests;
|
||||
uses:="org.eclipse.xtext,
|
||||
org.wesnoth.services,
|
||||
org.eclipse.xtext.parser,
|
||||
org.eclipse.xtext.junit,
|
||||
org.antlr.runtime,
|
||||
org.eclipse.xtext.parser.antlr"
|
||||
|
|
|
@ -36,6 +36,7 @@ public class SimpleWMLParser
|
|||
protected WMLRoot root_;
|
||||
protected ProjectCache projectCache_;
|
||||
protected int dependencyIndex_;
|
||||
private String currentFileLocation_;
|
||||
|
||||
/**
|
||||
* Creates a new parser for the specified file
|
||||
|
@ -68,6 +69,8 @@ public class SimpleWMLParser
|
|||
projectCache_ = projCache;
|
||||
|
||||
dependencyIndex_ = ResourceUtils.getDependencyIndex( file );
|
||||
|
||||
currentFileLocation_ = file.getLocation( ).toOSString( );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,6 +91,8 @@ public class SimpleWMLParser
|
|||
root_ = ( WMLRoot ) result.getRootASTElement( );
|
||||
|
||||
config_ = new WMLConfig( file.getAbsolutePath( ) );
|
||||
|
||||
currentFileLocation_ = file.getAbsolutePath( ).toString( );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,13 +114,6 @@ public class SimpleWMLParser
|
|||
return;
|
||||
}
|
||||
|
||||
String currentFileLocation = root_.eResource( ).getURI( )
|
||||
.toFileString( );
|
||||
if( currentFileLocation == null ) {
|
||||
currentFileLocation = root_.eResource( ).getURI( )
|
||||
.toPlatformString( true );
|
||||
}
|
||||
|
||||
while( itor.hasNext( ) ) {
|
||||
EObject object = itor.next( );
|
||||
|
||||
|
@ -183,8 +181,7 @@ public class SimpleWMLParser
|
|||
}
|
||||
else if( object instanceof WMLLuaCode ) {
|
||||
SimpleLuaParser luaParser = new SimpleLuaParser(
|
||||
currentFileLocation,
|
||||
( ( WMLLuaCode ) object ).getValue( ) );
|
||||
currentFileLocation_, ( ( WMLLuaCode ) object ).getValue( ) );
|
||||
luaParser.parse( );
|
||||
|
||||
config_.getWMLTags( ).putAll( luaParser.getTags( ) );
|
||||
|
|
Loading…
Add table
Reference in a new issue