diff --git a/utils/java/org.wesnoth.wml/META-INF/MANIFEST.MF b/utils/java/org.wesnoth.wml/META-INF/MANIFEST.MF index 562485293d5..97f7d22ab0a 100644 --- a/utils/java/org.wesnoth.wml/META-INF/MANIFEST.MF +++ b/utils/java/org.wesnoth.wml/META-INF/MANIFEST.MF @@ -18,7 +18,9 @@ Require-Bundle: org.eclipse.xtext, org.eclipse.emf.common, org.antlr.runtime, org.eclipse.xtext.junit;bundle-version="1.0.0", - org.wesnoth;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" Import-Package: org.apache.log4j Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.wesnoth, diff --git a/utils/java/org.wesnoth.wml/src/org/wesnoth/messages.properties b/utils/java/org.wesnoth.wml/src/org/wesnoth/messages.properties new file mode 100644 index 00000000000..02c01414cb8 --- /dev/null +++ b/utils/java/org.wesnoth.wml/src/org/wesnoth/messages.properties @@ -0,0 +1,3 @@ +WMLJavaValidator.0=Incorrect closing tag name. +WMLJavaValidator.2=There is no such wml tag name. +WMLJavaValidator.3=triggered wmlkey expensive validation. diff --git a/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTests.java b/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTests.java index 406ddff7ea3..e1898178a5c 100644 --- a/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTests.java +++ b/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTests.java @@ -127,7 +127,7 @@ public abstract class WMLTests extends AbstractXtextTests protected void checkKeyword(String input) { // the rule name for a keyword is usually // the keyword enclosed in single quotes - String rule = new StringBuilder("'").append(input).append("'") + String rule = new StringBuilder("'").append(input).append("'") //$NON-NLS-1$ //$NON-NLS-2$ .toString(); checkTokenisation(input, rule); } diff --git a/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTestsImpl.java b/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTestsImpl.java index b9f4576f2cc..04e622c7ea1 100644 --- a/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTestsImpl.java +++ b/utils/java/org.wesnoth.wml/src/org/wesnoth/tests/WMLTestsImpl.java @@ -14,36 +14,36 @@ public class WMLTestsImpl extends WMLTests //rule names in your grammar //the names of terminal rules will be capitalised //and "RULE_" will be appended to the front - private static final String ID="RULE_ID"; - private static final String INT="RULE_INT"; - private static final String WS="RULE_WS"; - private static final String SL_COMMENT="RULE_SL_COMMENT"; + private static final String ID="RULE_ID"; //$NON-NLS-1$ + private static final String INT="RULE_INT"; //$NON-NLS-1$ + private static final String WS="RULE_WS"; //$NON-NLS-1$ + private static final String SL_COMMENT="RULE_SL_COMMENT"; //$NON-NLS-1$ public void testINT() { - checkTokenisation("1", INT); + checkTokenisation("1", INT); //$NON-NLS-1$ } public void testID(){ - checkTokenisation("a", ID); - checkTokenisation("abc", ID); - checkTokenisation("abc123", ID); - checkTokenisation("abc_123", ID); + checkTokenisation("a", ID); //$NON-NLS-1$ + checkTokenisation("abc", ID); //$NON-NLS-1$ + checkTokenisation("abc123", ID); //$NON-NLS-1$ + checkTokenisation("abc_123", ID); //$NON-NLS-1$ } public void testSLCOMMENT(){ - checkTokenisation("#comment", SL_COMMENT); - checkTokenisation("#comment\n", SL_COMMENT); - checkTokenisation("# comment \t\t comment\r\n", SL_COMMENT); + checkTokenisation("#comment", SL_COMMENT); //$NON-NLS-1$ + checkTokenisation("#comment\n", SL_COMMENT); //$NON-NLS-1$ + checkTokenisation("# comment \t\t comment\r\n", SL_COMMENT); //$NON-NLS-1$ } public void testTokenSequences(){ - showTokenisation("amount=+$random\n"); - checkParsing("amount=+$random", "WMLKey"); + showTokenisation("amount=+$random\n"); //$NON-NLS-1$ + checkParsing("amount=+$random", "WMLKey"); //$NON-NLS-1$ //$NON-NLS-2$ - checkTokenisation("123 abc", ID, WS, ID); - checkTokenisation("123 \t#comment\n abc", ID, WS, SL_COMMENT,WS,ID); + checkTokenisation("123 abc", ID, WS, ID); //$NON-NLS-1$ + checkTokenisation("123 \t#comment\n abc", ID, WS, SL_COMMENT,WS,ID); //$NON-NLS-1$ //note that no white space is necessary! - checkTokenisation("123abc", ID); + checkTokenisation("123abc", ID); //$NON-NLS-1$ } } \ No newline at end of file diff --git a/utils/java/org.wesnoth.wml/src/org/wesnoth/validation/WMLJavaValidator.java b/utils/java/org.wesnoth.wml/src/org/wesnoth/validation/WMLJavaValidator.java index af38bd45ba4..44c68085975 100644 --- a/utils/java/org.wesnoth.wml/src/org/wesnoth/validation/WMLJavaValidator.java +++ b/utils/java/org.wesnoth.wml/src/org/wesnoth/validation/WMLJavaValidator.java @@ -13,6 +13,7 @@ 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.Messages; import org.wesnoth.schema.SchemaParser; import org.wesnoth.schema.Tag; import org.wesnoth.wML.WMLKey; @@ -37,7 +38,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator public void checkFastTagName(WMLTag tag) { if (!tag.getName().equals(tag.getEndName())) - warning("Incorrect closing tag name.", WMLPackage.WML_TAG__END_NAME); + warning(Messages.getString("WMLJavaValidator.0"), WMLPackage.WML_TAG__END_NAME); //$NON-NLS-1$ } // @Check(CheckType.NORMAL) @@ -54,7 +55,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator String searchName = parentNode.getText(); if (node.getParent().eContainer() == null) // root node { - searchName = "root"; + searchName = "root"; //$NON-NLS-1$ } if (SchemaParser.getInstance().getTags().get(searchName) != null) { @@ -68,7 +69,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator } } if (found == false) - warning("There is no such wml tag name.", WMLPackage.WML_TAG__NAME); + warning(Messages.getString("WMLJavaValidator.2"), WMLPackage.WML_TAG__NAME); //$NON-NLS-1$ } } } @@ -77,7 +78,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator public void checkExpensiveKeyValue(WMLKey key) { //TODO: add regex checking here - System.out.println("triggered wmlkey expensive validation."); + System.out.println(Messages.getString("WMLJavaValidator.3")); //$NON-NLS-1$ } @Check(CheckType.NORMAL)