eclipse plugin: Add the multiple-wesnoth installation...

...code support for the WMLValidator aswell
This commit is contained in:
Timotei Dolean 2011-07-05 08:53:01 +00:00
parent ae5ee164af
commit 68a96588ed
2 changed files with 14 additions and 3 deletions

View file

@ -20,7 +20,9 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.xtext.junit;bundle-version="1.0.0",
org.wesnoth;bundle-version="1.0.0",
org.eclipse.osgi.util;bundle-version="3.2.100",
org.eclipse.osgi;bundle-version="3.6.0"
org.eclipse.osgi;bundle-version="3.6.0",
org.eclipse.core.resources;bundle-version="3.6.1",
org.eclipse.core.runtime;bundle-version="3.6.0"
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.wesnoth,

View file

@ -8,11 +8,16 @@
*******************************************************************************/
package org.wesnoth.validation;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.parsetree.CompositeNode;
import org.eclipse.xtext.parsetree.LeafNode;
import org.eclipse.xtext.parsetree.NodeUtil;
import org.eclipse.xtext.validation.Check;
import org.eclipse.xtext.validation.CheckType;
import org.wesnoth.installs.WesnothInstallsUtils;
import org.wesnoth.schema.SchemaParser;
import org.wesnoth.schema.Tag;
import org.wesnoth.wml.WMLKey;
@ -56,8 +61,12 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
searchName = "root"; //$NON-NLS-1$
}
//TODO: get the editor based on this validator??
Tag schemaTag = SchemaParser.getInstance( null ).getTags().get(searchName);
Resource resource = getCurrentObject( ).eResource( );
IResource file = ResourcesPlugin.getWorkspace( ).getRoot( ).
getFile( new Path( resource.getURI( ).toPlatformString( true ) ) );
Tag schemaTag = SchemaParser.getInstance(
WesnothInstallsUtils.getInstallNameForResource( file ) ).getTags().get(searchName);
if ( schemaTag != null )
{