eclipse plugin: Rework the 'getContainers' method...

...to adapt to the new grammar
This commit is contained in:
Timotei Dolean 2011-07-16 20:59:17 +00:00
parent 8d8f27b43f
commit ca1ac3fca1
2 changed files with 17 additions and 20 deletions

View file

@ -41,7 +41,7 @@ import org.wesnoth.utils.AntUtils;
import org.wesnoth.utils.ExternalToolInvoker;
import org.wesnoth.utils.ResourceUtils;
import org.wesnoth.utils.StringUtils;
import org.wesnoth.utils.WMLGrammarUtils;
import org.wesnoth.utils.WMLUtils;
import org.wesnoth.utils.WMLTools;
import org.wesnoth.utils.WorkspaceUtils;
import org.wesnoth.wml.WMLKey;
@ -142,7 +142,6 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
PreprocessorUtils.getInstance( ).clearTimestampsForPath( project_.getLocation( ).toOSString( ) );
projectCache_.getDependencyList( ).createDependencyList( true );
boolean foundCfg = false;
DependencyListNode node = null;
@ -341,9 +340,9 @@ public class WesnothProjectBuilder extends IncrementalProjectBuilder
if ( keyName.equals( "id" ) ) {
if ( currentTagName.equals( "scenario" ) )
config.ScenarioId = WMLGrammarUtils.getKeyValue( key.getValue( ) );
config.ScenarioId = WMLUtils.getKeyValue( key.getValue( ) );
else if ( currentTagName.equals( "campaign" ) )
config.CampaignId = WMLGrammarUtils.getKeyValue( key.getValue( ) );
config.CampaignId = WMLUtils.getKeyValue( key.getValue( ) );
}
}
}

View file

@ -579,8 +579,7 @@ public class ResourceUtils
Set<String> containersToAdd = new LinkedHashSet<String>( );
for ( WMLMacroCall macro : macroCalls ) {
String name = macro.getName( );
String text = WMLUtils.toString( macro );
/**
* To include a folder the macro should be the following
* forms:
@ -589,22 +588,21 @@ public class ResourceUtils
*
*/
//TODO: check for including a specific config file?
if ( !( text.startsWith( "{campaigns" ) ) && //$NON-NLS-1$
!( text.equals( "{~add-ons" ) ) ) //$NON-NLS-2$
continue;
if ( ( name.equals( "campaigns" ) || //$NON-NLS-1$
name.equals( "add-ons" ) ) && //$NON-NLS-1$
// the call should contain just string values
macro.getParameters( ).size( ) > 2 &&
macro.getParameters( ).get( 0 ).equals( "/" ) ) //$NON-NLS-1$
{
// check if the macro includes directories local
// to this project
String projectPath = project.getLocation( ).toOSString( );
// check if the macro includes directories local
// to this project
String projectPath = project.getLocation( ).toOSString( );
if ( projectPath.contains( macro.getParameters( ).get( 1 ).toString( ) ) ) {
containersToAdd.add(
ListUtils.concatenateList(
macro.getParameters( ).subList( 3, macro.getParameters( ).size( ) ), "" ) ); //$NON-NLS-1$
}
if ( projectPath.contains( WMLUtils.toString( macro.getParameters( ).get( 1 ) ) ) ) {
String subString = text
.replace( "}", "" )
.replaceFirst( "\\{campaigns/", "" )
.replaceFirst( "\\{~add-ons/", "" );
containersToAdd.add( subString.substring( subString.indexOf( '/' ) ) );
}
}