summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpschonbac2009-01-09 19:59:01 (EST)
committerpschonbac2009-01-09 19:59:01 (EST)
commitb652f86b31c9d2facb70bdda51704ae1f95a7358 (patch)
tree059d4728f639b9d1d7b840227cc91ed5dc8bd768
parentd5312a4578669fe68e5f34fd672a395746089c8b (diff)
downloadorg.eclipse.xpand-b652f86b31c9d2facb70bdda51704ae1f95a7358.zip
org.eclipse.xpand-b652f86b31c9d2facb70bdda51704ae1f95a7358.tar.gz
org.eclipse.xpand-b652f86b31c9d2facb70bdda51704ae1f95a7358.tar.bz2
- Updated M2T Xpand to be in sync with version 4.3.1
- The previous step required some additions to the MWE core - Updated all license headers
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/GeneratorAdvice.java177
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/NoSuchTemplateException.java19
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandCompilerIssue.java17
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandExecutionContextImpl.java315
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandFacade.java87
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandUtil.java41
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractDefinition.java124
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractXpandVisitor.java139
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Advice.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Definition.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ErrorStatement.java46
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpandStatement.java5
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpressionStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/FileStatement.java129
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ForEachStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/IfStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ImportDeclaration.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/LetStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ProtectStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Statement.java87
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/StatementWithBody.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Template.java57
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/TextStatement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandAnalyzable.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandEvaluatable.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/ExpandProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/FastAnalyzer.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/KeywordProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/LazyVar.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/NamespaceProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StackElement.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StatementProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandPartition.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandTokens.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ExpandSpecial.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ForEachSpecial.java47
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/IfSpecial.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandElementAdapter.java16
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java20
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/AdvicedDefinition.java74
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/Procedure.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandAdvice.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandDefinition.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandResource.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandFactory.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLexer.java5
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLocationAddingParser.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParseFacade.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParser.java31
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegion.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolver.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolverImpl.java783
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionSyntaxException.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/BASE64.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/FSIO.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/GenericFileFilter.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/DefinitionType.java8
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/IteratorType.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandDefinitionImpl.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandIterator.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandTypesMetaModel.java39
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/Generator.java763
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/GeneratorAdvice.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/NoSuchTemplateException.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandCompilerIssue.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContext.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContextImpl.java468
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandFacade.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandUtil.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/BlankLineSkippingOutput.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandle.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandleImpl.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/JavaBeautifier.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/NoChangesVetoStrategy.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Outlet.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Output.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/OutputImpl.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/PostProcessor.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoException.java25
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy.java17
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy2.java29
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/XmlBeautifier.java4
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/package.html10
-rw-r--r--plugins/org.eclipse.xpand/src/org/eclipse/xpand2/package.html10
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionAnalyzationTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java79
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/Helper.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendComponentTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendFacadeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckAnalyzationTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckEvaluationTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckFastAnalyzerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/FeaturedCheckTest.java2
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/Helper.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/FastAnalyzerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/EvaluationExceptionTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ExecutionContextImplTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/PolymorphismTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java25
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type1.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type2.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type3.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/TypeNameUtilTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AType.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AnalyzationTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestMetaModel.java7
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestType.java18
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExpressionProposalComputerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExtensionImportProposalComputerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ReverseScannerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/TypeProposalComputerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ParserTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ScannerTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/ExtensionParserTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/CollectionFeaturesTest.java144
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/ObjectFeaturesTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/TypesComparatorTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/BooleanTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/CollectionTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/EnumTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/IntegerTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyClass.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyEnum.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/ObjectTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/RealTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/StringTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/TypeTypeTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/AllTests.java3
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorPluginTests.java6
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorStandaloneTests.java6
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/AllTests.java3
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/CachedExtensionTest.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/HelloPDE.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyEnum.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyMetaClass.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestFactory.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestPackage.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/MyMetaClassImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestFactoryImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestPackageImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageFactory.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageMetaClass.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackagePackage.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageFactoryImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageMetaClassImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackagePackageImpl.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageAdapterFactory.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageSwitch.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestAdapterFactory.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestSwitch.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/validation/MyMetaClassValidator.java12
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansMetaType.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansStrategyTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/MyMetaTypeInterface.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicMetaType.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicStrategyTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java8
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/InterfaceD.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/Mib.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/OAWTypeD.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeA.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeB.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeC.java4
-rw-r--r--plugins/org.eclipse.xtend.tests/src/test/Bean.java4
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EClassType.java311
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EDataTypeType.java14
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EEnumType.java5
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EObjectType.java8
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EcoreUtil2.java186
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java4
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java5
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Mapping.java4
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Setup.java6
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiReader.java239
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiWriter.java253
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java6
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckFileWithContext.java8
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java6
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java2
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xpand/util/stdlib/TracingOutput.java23
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CloningExtensions.java7
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CounterExtensions.java7
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinder.java5
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinderComponent.java41
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DuplicateHelper.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DynamicEcoreHelper.java5
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ElementPropertiesExtensions.java14
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/EmfUtils.java23
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ExtIssueReporter.java99
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/GlobalVarExtensions.java18
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/IOExtensions.java11
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/MessageLogger.java45
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PlatformHelper.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesExtension.java7
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesReader.java127
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotCopier.java107
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotListAdder.java136
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotPrinter.java130
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SystemCommand.java175
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/TraceComponent.java113
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/UIDHelper.java7
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/cloning.ext18
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/codetracing.ext8
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/collections.ext8
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/counter.ext44
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/crossref.ext19
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/elementprops.ext28
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/globalvar.ext54
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/io.ext52
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/issues.ext46
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/mixin.ext42
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/naming.ext56
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/platformhelper.ext8
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/properties.ext31
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/texttest/Failed.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/texttest/FileTestComponent.java51
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/texttest/Handle.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing.ext47
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/M2CTraceElement.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/M2MTraceElement.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/MapList.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/TraceElement.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/TraceStore.java4
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/templates/html.xpt8
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/tracing/templates/util.ext8
-rw-r--r--plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/uid.ext38
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/check/codeassist/CheckFastAnalyzer.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/check/codeassist/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/AbstractExpressionVisitor.java208
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/AbstractVisitor.java13
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/BooleanLiteral.java25
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/BooleanOperation.java9
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/Case.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/Cast.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/ChainExpression.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/CollectionExpression.java403
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/ConstructorCallExpression.java77
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/DeclaredParameter.java46
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/Expression.java57
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/FeatureCall.java10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/GlobalVarExpression.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/ISyntaxElement.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/Identifier.java28
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/IfExpression.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/IntegerLiteral.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/LetExpression.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/ListLiteral.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/Literal.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/NullLiteral.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/OperationCall.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/RealLiteral.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/StringLiteral.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/SwitchExpression.java166
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/SyntaxElement.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/TypeSelectExpression.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/CharacterScanner.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ExpressionProposalComputer.java161
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ExtensionImportProposalComputer.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/LazyVar.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/Proposal.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ProposalFactory.java21
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ProposalFactoryDefaultImpl.java33
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ProposalImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/ReverseScanner.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/TypeProposalComputer.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/codeassist/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/BaseSpecialTreatment.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/EvaluatedElementWrapper.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionElementAdapter.java40
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionModelPresentation.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/NoResourceSpecial.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/parser/ExpressionFactory.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/parser/SyntaxConstants.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/parser/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/BuiltinMetaModel.java151
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/FeatureImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/OperationImpl.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/PolymorphicResolver.java27
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/PropertyImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/StaticPropertyImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/TypesComparator.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/BooleanTypeImpl.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/BuiltinBaseType.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/CollectionTypeImpl.java606
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/FeatureTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/IntegerTypeImpl.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/ListTypeImpl.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/ObjectTypeImpl.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/OperationTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/PropertyTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/RealTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/SetTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/StaticPropertyTypeImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/StringTypeImpl.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/TypeTypeImpl.java7
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/VoidType.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/baseimpl/types/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaBeansMetaModel.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaMetaModel.java62
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaOperationImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaPropertyImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaStaticPropertyImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaTypeImpl.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/JavaTypeStrategy.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/TypeFinder.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/beans/JavaBeansStrategy.java79
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/beans/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/java/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/oawclassic/OAWClassicStrategy.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/type/impl/oawclassic/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/Cache.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/DoubleKeyCache.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/EncodingDetector.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/HigherOrder.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/Pair.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/ProfileCollector.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/StringHelper.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/TripleKeyCache.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/Triplet.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetDetector.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetMatch.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecog_2022.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecog_UTF8.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecog_Unicode.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecog_mbcs.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecog_sbcs.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/internal/icu/CharsetRecognizer.java8
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/util/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/XtendAdvice.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/XtendFile.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/XtendResourceParser.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/AbstractExtension.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/Around.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/Check.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/CreateExtensionStatement.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/ExpressionExtensionStatement.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/Extension.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/ExtensionFile.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/ImportStatement.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/ast/JavaExtensionStatement.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/codeassist/FastAnalyzer.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/codeassist/Partition.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/ErrorHandler.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/ExtensionFactory.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/GeneratorLauncher.java2
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/ParseException.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/ParseFacade.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/SyntaxError.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/XtendError.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/XtendLexer.java9
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/XtendLocationAddingParser.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/parser/XtendParser.java9
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/types/AdviceContext.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/types/AdviceContextType.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/xtend/types/XtendMetaModel.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/XtendComponent.java411
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/XtendFacade.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/XtendResourceParser.java23
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/check/CheckComponent.java236
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/check/CheckFacade.java13
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/check/CheckUtils.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/check/package.html11
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/AbstractExpressionsUsingWorkflowAdvice.java71
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/AbstractExpressionsUsingWorkflowComponent.java173
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/AnalysationIssue.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/Analyzable.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/Callback.java33
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/Evaluatable.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/EvaluationException.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ExceptionHandler.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ExceptionRaisingNullEvaluationHandler.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ExecutionContext.java6
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ExecutionContextImpl.java76
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ExpressionFacade.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/NullEvaluationHandler.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/Resource.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ResourceManager.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ResourceManagerDefaultImpl.java10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/ResourceParser.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/TypeNameUtil.java40
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/TypeSystem.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/TypeSystemImpl.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/Variable.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/expression/package.html10
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/AbstractTypeImpl.java5
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/Callable.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/Feature.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/MetaModel.java23
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/Operation.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/ParameterizedCallable.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/ParameterizedType.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/Property.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/StaticProperty.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/Type.java4
-rw-r--r--plugins/org.eclipse.xtend/src/org/eclipse/xtend/typesystem/package.html10
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/AllTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/GeneratorAdviceTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/GeneratorTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/analyze/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/analyze/StatementAnalyzationTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/codeassist/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/codeassist/FastAnalyzerTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/codeassist/KeywordProposalComputerTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/codeassist/StatementProposalComputerTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/evaluate/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/evaluate/AopFeatureTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/evaluate/OutputStringImpl.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/evaluate/ProtectedRegionsTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/evaluate/StatementEvaluatorTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/impl/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/impl/NameUtilTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/output/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/output/NoChangesVetoStrategyTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/output/OutputImplTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/parser/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/parser/StatementParserTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/parser/XpandLexerTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/pr/AllPackageTests.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/pr/ProtectedRegionResolverImplTest.java4
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/pr/util/GenericFileFilterTest.java8
-rw-r--r--tests/org.eclipse.xpand.tests/src/org/eclipse/xpand/internal/tests/util/InputStreamLogger.java4
452 files changed, 7571 insertions, 4175 deletions
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/GeneratorAdvice.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/GeneratorAdvice.java
new file mode 100644
index 0000000..3c46f67
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/GeneratorAdvice.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.mwe.core.WorkflowComponent;
+import org.eclipse.emf.mwe.core.issues.Issues;
+import org.eclipse.xpand2.Generator;
+import org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowAdvice;
+
+/**
+ * Weaves aspect templates into a generator component.
+ * <p>
+ * <h2>Parameters</h2>
+ * <table border="1">
+ * <tr>
+ * <th>Name</th>
+ * <th>Multiplicity</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * </tr>
+ *
+ * <tr>
+ * <td>adviceTarget</td>
+ * <td>1</td>
+ * <td>String</td>
+ * <td>The id of a {@link Generator} component</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>advices</td>
+ * <td>0..n</td>
+ * <td>String</td>
+ * <td>Comma seperated list of qualified aspect templates</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>advice</td>
+ * <td>0..n</td>
+ * <td>String</td>
+ * <td>Qualified name of an aspect template</td>
+ * </tr>
+ *
+ *
+ * <tr>
+ * <td>extensionAdvice</td>
+ * <td>0..n</td>
+ * <td>String</td>
+ * <td>Comma seperated list of qualified aspect extensions</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>metaModel</td>
+ * <td>0..n</td>
+ * <td>org.openarchitectureware.type.MetaModel</td>
+ * <td>Additional metamodels needed for the advices.</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>globalVarDef</td>
+ * <td>0..n</td>
+ * <td>GlobalVarDef</td>
+ * <td>Additional global vars needed for the advices.</td>
+ * </tr>
+ * </table>
+ */
+public class GeneratorAdvice extends AbstractExpressionsUsingWorkflowAdvice {
+
+ private static final String COMPONENT_NAME = "Xpand Generator Advice";
+
+ private List<String> advices = new ArrayList<String>();
+
+ private List<String> extensionAdvices = new ArrayList<String>();
+
+ private String fileEncoding;
+
+ /**
+ * @deprecated Use <code>addAdvice(String)</code> instead.
+ */
+ @Deprecated
+ public void addAdvices(String advices) {
+ this.advices.add(advices);
+ }
+
+ /**
+ * @deprecated Use <code>addExtensionAdvice(String)</code> instead.
+ */
+ @Deprecated
+ public void addExtensionAdvices(String extensionAdvices) {
+ addExtensionAdvice(extensionAdvices);
+ }
+
+ /**
+ * Adds an advice.
+ *
+ * @param advice
+ * the advice
+ */
+ public void addAdvice(String advice) {
+ this.advices.add(advice);
+ }
+
+ /**
+ * Adds an extension advice,
+ *
+ * @param extensionAdvice
+ * the extension advice
+ */
+ public void addExtensionAdvice(String extensionAdvice) {
+ this.extensionAdvices.add(extensionAdvice);
+ }
+
+ /**
+ * Sets the file encoding to use for the target generator.
+ *
+ * @param fileEncoding
+ * Encoding string, e.g. 'ISO-8859-1'
+ * @since 4.2
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=195042
+ */
+ public void setFileEncoding(String fileEncoding) {
+ this.fileEncoding = fileEncoding;
+ }
+
+ /**
+ * @see org.openarchitectureware.workflow.ao.AbstractWorkflowAdvice#checkConfiguration(org.openarchitectureware.workflow.issues.Issues)
+ */
+ @Override
+ public void checkConfiguration(Issues issues) {
+ super.checkConfiguration(issues);
+ if (advices.isEmpty() && extensionAdvices.isEmpty()) {
+ issues.addError("Neither 'advices' nor 'extensionAdvices' configured.");
+ }
+ }
+
+ /**
+ * @see org.openarchitectureware.expression.AbstractExpressionsUsingWorkflowAdvice#weave(org.openarchitectureware.workflow.WorkflowComponent,
+ * org.openarchitectureware.workflow.issues.Issues)
+ */
+ @Override
+ public void weave(WorkflowComponent c, Issues issues) {
+ super.weave(c, issues);
+ if (!(c instanceof Generator)) {
+ issues.addError(this, "advice target is not a Generator component.");
+ }
+ else {
+ Generator gen = (Generator) c;
+ for (String advice : advices) {
+ gen.addAdvice(advice);
+ }
+ for (String advice : extensionAdvices) {
+ gen.addExtensionAdvice(advice);
+ }
+ if (fileEncoding != null) {
+ gen.setFileEncoding(fileEncoding);
+ }
+ }
+ }
+
+ @Override
+ public String getLogMessage() {
+ return "extension-advices: " + buildList(extensionAdvices) + " template-advices: " + buildList(advices);
+ }
+
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/NoSuchTemplateException.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/NoSuchTemplateException.java
new file mode 100644
index 0000000..c611cf4
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/NoSuchTemplateException.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+public class NoSuchTemplateException extends RuntimeException {
+
+ private static final long serialVersionUID = -6939510590247142812L;
+
+ public NoSuchTemplateException(final String fullyQualifiedName) {
+ super("Couldn't find template : " + fullyQualifiedName);
+ }
+
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandCompilerIssue.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandCompilerIssue.java
new file mode 100644
index 0000000..3b81ce0
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandCompilerIssue.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+import org.eclipse.xtend.expression.AnalysationIssue.AnalysationIssueType;
+
+public interface XpandCompilerIssue {
+
+ public final static AnalysationIssueType DEFINITION_NOT_FOUND = new AnalysationIssueType("Definition not found");
+
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandExecutionContextImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandExecutionContextImpl.java
new file mode 100644
index 0000000..d0e8360
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandExecutionContextImpl.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+import org.eclipse.internal.xpand2.model.AdvicedDefinition;
+import org.eclipse.internal.xpand2.model.XpandAdvice;
+import org.eclipse.internal.xpand2.model.XpandDefinition;
+import org.eclipse.internal.xpand2.model.XpandResource;
+import org.eclipse.internal.xpand2.parser.XpandParseFacade;
+import org.eclipse.internal.xpand2.pr.ProtectedRegionResolver;
+import org.eclipse.internal.xpand2.type.XpandTypesMetaModel;
+import org.eclipse.internal.xtend.expression.parser.SyntaxConstants;
+import org.eclipse.internal.xtend.type.baseimpl.PolymorphicResolver;
+import org.eclipse.internal.xtend.xtend.ast.Around;
+import org.eclipse.internal.xtend.xtend.ast.Extension;
+import org.eclipse.xpand2.XpandExecutionContext;
+import org.eclipse.xpand2.output.Output;
+import org.eclipse.xtend.expression.Callback;
+import org.eclipse.xtend.expression.ExceptionHandler;
+import org.eclipse.xtend.expression.ExecutionContextImpl;
+import org.eclipse.xtend.expression.NullEvaluationHandler;
+import org.eclipse.xtend.expression.Resource;
+import org.eclipse.xtend.expression.ResourceManager;
+import org.eclipse.xtend.expression.ResourceParser;
+import org.eclipse.xtend.expression.TypeSystemImpl;
+import org.eclipse.xtend.expression.Variable;
+import org.eclipse.xtend.typesystem.Callable;
+import org.eclipse.xtend.typesystem.Operation;
+import org.eclipse.xtend.typesystem.Type;
+
+/**
+ * *
+ *
+ * @author Sven Efftinge (http://www.efftinge.de) *
+ */
+public class XpandExecutionContextImpl extends ExecutionContextImpl implements XpandExecutionContext {
+
+ private final Log log = LogFactory.getLog(getClass());
+
+ protected final Output output;
+
+ protected final ProtectedRegionResolver protectedRegionResolver;
+
+ private List<XpandAdvice> registeredAdvices = new ArrayList<XpandAdvice>();
+
+ public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs) {
+ this(output, prs, null, null, null);
+ }
+
+ public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs, Map<String, Variable> globalVars,
+ ExceptionHandler exceptionHandler, NullEvaluationHandler nullEvaluationHandler) {
+ this(new TypeSystemImpl(), output, prs, globalVars, exceptionHandler, nullEvaluationHandler);
+ }
+
+ protected XpandExecutionContextImpl(final TypeSystemImpl ts, Output output, ProtectedRegionResolver prs,
+ Map<String, Variable> globalVars, ExceptionHandler exceptionHandler,
+ NullEvaluationHandler nullEvaluationHandler) {
+ super(ts, globalVars);
+ registerMetaModel(new XpandTypesMetaModel(this));
+ registerParser(resourceManager);
+ this.output = output;
+ this.protectedRegionResolver = prs;
+ this.exceptionHandler = exceptionHandler;
+ this.nullEvaluationHandler = nullEvaluationHandler;
+ }
+
+ private void registerParser(ResourceManager resourceManager) {
+ resourceManager.registerParser(XpandUtil.TEMPLATE_EXTENSION, new ResourceParser() {
+
+ public Resource parse(Reader in, String fileName) {
+ return XpandParseFacade.file(in, fileName);
+ }
+ });
+ }
+
+ protected XpandExecutionContextImpl(ResourceManager resourceManager, Resource currentResource,
+ TypeSystemImpl typeSystem, Map<String, Variable> vars, Map<String, Variable> globalVars, Output output,
+ ProtectedRegionResolver protectedRegionResolver, ProgressMonitor monitor,
+ ExceptionHandler exceptionHandler, List<Around> advices, NullEvaluationHandler nullEvaluationHandler,
+ Map<Resource, Set<Extension>> allExtensionsPerResource, Callback callback) {
+ super(resourceManager, currentResource, typeSystem, vars, globalVars, monitor, exceptionHandler, advices,
+ nullEvaluationHandler, allExtensionsPerResource, callback);
+ registerMetaModel(new XpandTypesMetaModel(this));
+ this.output = output;
+ this.protectedRegionResolver = protectedRegionResolver;
+ this.exceptionHandler = exceptionHandler;
+ }
+
+ @Override
+ public XpandExecutionContextImpl cloneContext() {
+ final XpandExecutionContextImpl result = new XpandExecutionContextImpl(resourceManager, currentResource(),
+ typeSystem, getVisibleVariables(), getGlobalVariables(), output, protectedRegionResolver, getMonitor(),
+ exceptionHandler, registeredExtensionAdvices, nullEvaluationHandler, allExtensionsPerResource, callback);
+ result.registeredAdvices.addAll(registeredAdvices); // todo: [aha]
+ // before I
+ // refactored, there
+ // was an assignment
+ // in this place. Is
+ // this modification
+ // correct?
+ return result;
+ }
+
+ public List<XpandDefinition> getAllDefinitions() {
+ XpandResource tpl = null;
+ tpl = (XpandResource) currentResource();
+ if (tpl == null)
+ return null;
+
+ XpandDefinition[] localDefinitions = tpl.getDefinitions();
+
+ List<XpandDefinition> advicedDefinitions = new ArrayList<XpandDefinition>(localDefinitions.length);
+
+ for (int i = 0; i < localDefinitions.length; i++) {
+ XpandDefinition xpandDefinition = localDefinitions[i];
+ for (int x = registeredAdvices.size() - 1; x >= 0; x--) {
+ final XpandAdvice adv = registeredAdvices.get(x);
+ if (adv.matches(xpandDefinition, this)) {
+ xpandDefinition = new AdvicedDefinition(adv, xpandDefinition);
+ }
+ }
+ advicedDefinitions.add(xpandDefinition);
+ }
+
+ return advicedDefinitions;
+
+ }
+
+ public XpandDefinition findDefinition(final String name, final Type target, final Type[] paramTypes) {
+ XpandResource tpl = null;
+ if (name.indexOf(SyntaxConstants.NS_DELIM) != -1) { // local call
+ tpl = findTemplate(XpandUtil.withoutLastSegment(name));
+ }
+ else {
+ tpl = (XpandResource) currentResource();
+ }
+ if (tpl == null)
+ return null;
+ final XpandExecutionContext ctx = (XpandExecutionContext) cloneWithResource(tpl);
+ XpandDefinition def = findDefinition(tpl.getDefinitions(), name, target, paramTypes, ctx);
+ for (int x = registeredAdvices.size() - 1; x >= 0; x--) {
+ final XpandAdvice adv = registeredAdvices.get(x);
+ if (adv.matches(def, this)) {
+ def = new AdvicedDefinition(adv, def);
+ }
+ }
+ return def;
+ }
+
+ public void registerAdvices(final String fullyQualifiedName) {
+ final XpandResource tpl = findTemplate(fullyQualifiedName);
+ if (tpl == null)
+ throw new NoSuchTemplateException(fullyQualifiedName);
+ final XpandAdvice[] as = tpl.getAdvices();
+ for (int i = 0; i < as.length; i++) {
+ final XpandAdvice advice = as[i];
+ if (registeredAdvices.contains(advice)) {
+ log.warn("advice " + advice.toString() + " allready registered!");
+ }
+ else {
+ registeredAdvices.add(advice);
+ }
+ }
+ }
+
+ public ProtectedRegionResolver getProtectedRegionResolver() {
+ return protectedRegionResolver;
+ }
+
+ public Output getOutput() {
+ return output;
+ }
+
+ public XpandResource findTemplate(final String templateName) {
+ return findTemplate(templateName, getImportedNamespaces());
+ }
+
+ public XpandResource findTemplate(final String templateName, String[] importedNs) {
+ final List<?> possibleNames = typeSystem.getPossibleNames(templateName, importedNs);
+ for (final Iterator<?> iter = possibleNames.iterator(); iter.hasNext();) {
+ final String element = (String) iter.next();
+ final XpandResource tpl = (XpandResource) resourceManager.loadResource(element,
+ XpandUtil.TEMPLATE_EXTENSION);
+ if (tpl != null)
+ return tpl;
+ }
+ return null;
+ }
+
+ /**
+ * resolves the correct definition (using parametric polymorphism)
+ *
+ * @param definitions
+ * @param target
+ * @param paramTypes
+ * @return
+ */
+ private XpandDefinition findDefinition(final XpandDefinition[] definitions, final String name, final Type target,
+ Type[] paramTypes, final XpandExecutionContext ctx) {
+ if (paramTypes == null) {
+ paramTypes = new Type[0];
+ }
+ final Set<Callable> features = new HashSet<Callable>();
+ for (int i = 0; i < definitions.length; i++) {
+ final XpandDefinition def = definitions[i];
+ if (def.getParams().length == paramTypes.length) {
+ final List<Type> defsParamTypes = new ArrayList<Type>();
+ Type t = null;
+ boolean complete = true;
+ for (int j = 0; j < paramTypes.length && complete; j++) {
+ t = ctx.getTypeForName(def.getParams()[j].getType().getValue());
+ if (t == null) {
+ complete = false;
+ }
+ defsParamTypes.add(t);
+ }
+ t = ctx.getTypeForName(def.getTargetType());
+ if (t == null) {
+ complete = false;
+ }
+ if (complete) {
+ features.add(new DefinitionOperationAdapter(def, def.getName(), t, defsParamTypes));
+ }
+ }
+ }
+ final DefinitionOperationAdapter defAdapter = (DefinitionOperationAdapter) PolymorphicResolver.getOperation(
+ features, XpandUtil.getLastSegment(name), target, Arrays.asList(paramTypes));
+ if (defAdapter != null)
+ return defAdapter.def;
+ return null;
+ }
+
+ public class DefinitionOperationAdapter implements Operation {
+
+ private String name;
+
+ private Type owner;
+
+ private List<Type> paramTypes;
+
+ public XpandDefinition def;
+
+ public DefinitionOperationAdapter(final XpandDefinition def, final String name, final Type owner,
+ final List<Type> paramTypes) {
+ this.name = name;
+ this.owner = owner;
+ this.paramTypes = paramTypes;
+ this.def = def;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Type getReturnType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getOwner() {
+ return owner;
+ }
+
+ public List<Type> getParameterTypes() {
+ return paramTypes;
+ }
+
+ public Object evaluate(final Object target, final Object[] params) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDocumentation() {
+ return "Xpand definition " + getName() + " adapted in an Operation";
+ }
+
+ public Type getReturnType(final Type targetType, final Type[] paramTpes) {
+ return getReturnType();
+ }
+
+ }
+
+ @Override
+ public void setFileEncoding(final String fileEncoding) {
+ resourceManager.setFileEncoding(fileEncoding); // TODO: make this
+ // immutable - the
+ // entire context should
+ // be immutable!
+ }
+
+ public void setResourceManager(ResourceManager resourceManager) {
+ registerParser(resourceManager);
+ this.resourceManager = resourceManager;
+ }
+
+ public void setCallBack(Callback callback) {
+ this.callback = callback;
+ }
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandFacade.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandFacade.java
new file mode 100644
index 0000000..da2e165
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandFacade.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.internal.xpand2.model.XpandDefinition;
+import org.eclipse.internal.xpand2.model.XpandResource;
+import org.eclipse.xpand2.XpandExecutionContext;
+import org.eclipse.xtend.expression.AnalysationIssue;
+import org.eclipse.xtend.expression.EvaluationException;
+import org.eclipse.xtend.expression.ExecutionContext;
+import org.eclipse.xtend.expression.Variable;
+import org.eclipse.xtend.typesystem.Type;
+
+/**
+ * *
+ *
+ * @author Sven Efftinge (http://www.efftinge.de) *
+ */
+public class XpandFacade {
+ private XpandExecutionContext ctx = null;
+
+ /**
+ * @deprecated use XpandFacade.create instead
+ */
+ @Deprecated
+ public XpandFacade(final XpandExecutionContext ctx) {
+ this.ctx = ctx;
+ }
+
+ public void evaluate(final String definitionName, final Object targetObject, Object... params) {
+ params = params == null ? new Object[0] : params;
+ final Type targetType = ctx.getType(targetObject);
+ final Type[] paramTypes = new Type[params.length];
+ for (int i = 0; i < paramTypes.length; i++) {
+ paramTypes[i] = ctx.getType(params[i]);
+ }
+
+ final XpandDefinition def = ctx.findDefinition(definitionName, targetType, paramTypes);
+ if (def == null)
+ throw new EvaluationException("No Definition " + definitionName + getParamString(paramTypes) + " for "
+ + targetType.getName() + " could be found!", null, ctx);
+
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(ExecutionContext.IMPLICIT_VARIABLE,
+ targetObject));
+ for (int i = 0; i < params.length; i++) {
+ final Variable v = new Variable(def.getParams()[i].getName().getValue(), params[i]);
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(v);
+ }
+ ctx = (XpandExecutionContext) ctx.cloneWithResource(def.getOwner());
+ def.evaluate(ctx);
+ }
+
+ private String getParamString(final Type[] paramTypes) {
+ if (paramTypes.length == 0)
+ return "";
+ final StringBuffer buff = new StringBuffer("(");
+ for (int i = 0; i < paramTypes.length; i++) {
+ final Type t = paramTypes[i];
+ buff.append(t.getName());
+ if (i + 1 < paramTypes.length) {
+ buff.append(",");
+ }
+ }
+ buff.append(")");
+ return buff.toString();
+ }
+
+ public AnalysationIssue[] analyze(final String templateName) {
+ final Set<AnalysationIssue> issues = new HashSet<AnalysationIssue>();
+ final XpandResource tpl = ctx.findTemplate(templateName);
+ tpl.analyze(ctx, issues);
+ return issues.toArray(new AnalysationIssue[issues.size()]);
+ }
+
+ public static XpandFacade create(XpandExecutionContextImpl execCtx) {
+ return new XpandFacade(execCtx);
+ }
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandUtil.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandUtil.java
new file mode 100644
index 0000000..3ec00e7
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/XpandUtil.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2;
+
+import org.eclipse.internal.xtend.expression.parser.SyntaxConstants;
+
+/**
+ *
+ * @author Sven Efftinge (http://www.efftinge.de) *
+ */
+public class XpandUtil {
+
+ private static final String SLASH = "/";
+
+ public static final String NS_DELIM = SyntaxConstants.NS_DELIM;
+
+ public static final String TEMPLATE_EXTENSION = "xpt";
+
+ public final static String getJavaResourceName(final String fqn) {
+ return fqn.replaceAll(NS_DELIM, SLASH) + "." + TEMPLATE_EXTENSION;
+ }
+
+ public static String withoutLastSegment(final String fqn) {
+ if (fqn == null || fqn.lastIndexOf(SyntaxConstants.NS_DELIM) == -1)
+ return null;
+ return fqn.substring(0, fqn.lastIndexOf(SyntaxConstants.NS_DELIM));
+ }
+
+ public static String getLastSegment(final String fqn) {
+ if (fqn == null || fqn.lastIndexOf(SyntaxConstants.NS_DELIM) == -1)
+ return fqn;
+ return fqn.substring(fqn.lastIndexOf(SyntaxConstants.NS_DELIM) + SyntaxConstants.NS_DELIM.length());
+ }
+
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractDefinition.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractDefinition.java
index 3d8149f..ce6318d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractDefinition.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractDefinition.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
@@ -44,7 +42,8 @@ public abstract class AbstractDefinition extends SyntaxElement implements XpandD
protected boolean wildParams = false;
- public AbstractDefinition(final Identifier name, final Identifier type, final DeclaredParameter[] params, final Statement[] body) {
+ public AbstractDefinition(final Identifier name, final Identifier type, final DeclaredParameter[] params,
+ final Statement[] body) {
this.name = name;
this.type = type;
this.params = params;
@@ -99,8 +98,9 @@ public abstract class AbstractDefinition extends SyntaxElement implements XpandD
for (int i = 0; i < params.length; i++) {
final DeclaredParameter p = params[i];
buff.append(p.getType().getValue());
- if(!typesOnly)
+ if (!typesOnly) {
buff.append(" ").append(p.getName().getValue());
+ }
if (i + 1 < params.length) {
buff.append(",");
}
@@ -120,59 +120,101 @@ public abstract class AbstractDefinition extends SyntaxElement implements XpandD
}
public void analyze(XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
- if (getType()==null) {
- issues.add(new AnalysationIssue(AnalysationIssue.INTERNAL_ERROR, "Invalid definition: " + this.toString(), this));
- return;
- }
- final Type thisType = ctx.getTypeForName(getType().getValue());
- if (thisType == null) {
- issues.add(new AnalysationIssue(AnalysationIssue.TYPE_NOT_FOUND, "Couldn't find " + getType().getValue(), getType()));
- }
- ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(ExecutionContext.IMPLICIT_VARIABLE, thisType));
- for (int i = 0; i < params.length; i++) {
- final DeclaredParameter param = params[i];
- Type paramType = ctx.getTypeForName(param.getType().getValue());
- if (paramType == null) {
- issues.add(new AnalysationIssue(AnalysationIssue.TYPE_NOT_FOUND, "Couldn't find " + param.getType().getValue(), param.getType()));
- paramType = ctx.getObjectType();
+ try {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().pre(this, ctx);
+ }
+ final Type thisType = ctx.getTypeForName(getType().getValue());
+ if (thisType == null) {
+ issues.add(new AnalysationIssue(AnalysationIssue.TYPE_NOT_FOUND, "Couldn't find "
+ + getType().getValue(), getType()));
+ }
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(ExecutionContext.IMPLICIT_VARIABLE,
+ thisType));
+ for (int i = 0; i < params.length; i++) {
+ final DeclaredParameter param = params[i];
+ Type paramType = ctx.getTypeForName(param.getType().getValue());
+ if (paramType == null) {
+ issues.add(new AnalysationIssue(AnalysationIssue.TYPE_NOT_FOUND, "Couldn't find "
+ + param.getType().getValue(), param.getType()));
+ paramType = ctx.getObjectType();
+ }
+ final String name = param.getName().getValue();
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(name, paramType));
+ }
+ for (int i = 0; i < getBody().length; i++) {
+ Statement stmt = getBody()[i];
+ try {
+ stmt.analyze(ctx, issues);
+ }
+ catch (RuntimeException ex) {
+ Map<String, Object> info = new HashMap<String, Object>();
+ info.put("body", stmt);
+ ctx.handleRuntimeException(ex, this, info);
+ }
}
- final String name = param.getName().getValue();
- ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(name, paramType));
}
- for (int i = 0; i < getBody().length; i++) {
- Statement stmt = getBody()[i];
- try {
- stmt.analyze(ctx, issues);
- } catch (RuntimeException ex) {
- Map<String, Object> info = new HashMap<String, Object>();
- info.put("body", stmt);
- ctx.handleRuntimeException(ex, this, info);
+ finally {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().post(null);
}
}
}
public void evaluate(XpandExecutionContext ctx) {
- ctx = (XpandExecutionContext) ctx.cloneWithResource(getOwner());
- for (int i = 0; i < getBody().length; i++) {
- Statement stmt = getBody()[i];
- try {
- stmt.evaluate(ctx);
- } catch (RuntimeException ex) {
- Map<String, Object> info = new HashMap<String, Object>();
- info.put("body", stmt);
- ctx.handleRuntimeException(ex, this, info);
+ try {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().pre(this, ctx);
+ }
+ ctx = (XpandExecutionContext) ctx.cloneWithResource(getOwner());
+ for (int i = 0; i < getBody().length; i++) {
+ Statement stmt = getBody()[i];
+ try {
+ stmt.evaluate(ctx);
+ }
+ catch (RuntimeException ex) {
+ Map<String, Object> info = new HashMap<String, Object>();
+ info.put("body", stmt);
+ ctx.handleRuntimeException(ex, this, info);
+ }
+ }
+ }
+ finally {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().post(null);
}
}
}
@Override
public String toString() {
- String type = getType()!=null ? getType().getValue() : "null";
if (_stringRepresentation == null) {
- _stringRepresentation = name.getValue() + getParamString(false) + " : " + type;
+ _stringRepresentation = name.getValue() + getParamString(false) + " : " + getType().getValue();
}
return _stringRepresentation;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((toString() == null) ? 0 : toString().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (obj == null || toString() == null)
+ return false;
+
+ if (getClass() != obj.getClass())
+ return false;
+
+ AbstractDefinition other = (AbstractDefinition) obj;
+ return toString().equals(other.toString());
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractXpandVisitor.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractXpandVisitor.java
new file mode 100644
index 0000000..e5b45ff
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/AbstractXpandVisitor.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.internal.xpand2.ast;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.internal.xtend.expression.ast.AbstractVisitor;
+import org.eclipse.internal.xtend.expression.ast.ISyntaxElement;
+import org.eclipse.internal.xtend.expression.ast.SyntaxElement;
+
+public class AbstractXpandVisitor extends AbstractVisitor {
+
+ @Override
+ public final Object visit(final ISyntaxElement ele) {
+ Object result = null;
+
+ if (result == null && ele instanceof Advice) {
+ result = visitAdvice((Advice) ele);
+ }
+ if (result == null && ele instanceof Definition) {
+ result = visitDefinition((Definition) ele);
+ }
+ if (result == null && ele instanceof ErrorStatement) {
+ result = visitErrorStatement((ErrorStatement) ele);
+ }
+ if (result == null && ele instanceof ExpandStatement) {
+ result = visitExpandStatement((ExpandStatement) ele);
+ }
+ if (result == null && ele instanceof ExpressionStatement) {
+ result = visitExpressionStatement((ExpressionStatement) ele);
+ }
+ if (result == null && ele instanceof FileStatement) {
+ result = visitFileStatement((FileStatement) ele);
+ }
+ if (result == null && ele instanceof ForEachStatement) {
+ result = visitForEachStatement((ForEachStatement) ele);
+ }
+ if (result == null && ele instanceof IfStatement) {
+ result = visitIfStatement((IfStatement) ele);
+ }
+ if (result == null && ele instanceof ImportDeclaration) {
+ result = visitImportDeclaration((ImportDeclaration) ele);
+ }
+ if (result == null && ele instanceof LetStatement) {
+ result = visitLetStatement((LetStatement) ele);
+ }
+ if (result == null && ele instanceof ProtectStatement) {
+ result = visitProtectStatement((ProtectStatement) ele);
+ }
+ if (result == null && ele instanceof Template) {
+ result = visitTemplate((Template) ele);
+ }
+ if (result == null && ele instanceof TextStatement) {
+ result = visitTextStatement((TextStatement) ele);
+ }
+ return result;
+ }
+
+ protected void visitChild(final SyntaxElement child) {
+ if(child != null)
+ child.accept(this);
+ }
+
+ protected void visitChildren(final List<? extends SyntaxElement> children) {
+ if (children != null) {
+ for (SyntaxElement child : children) {
+ visitChild(child);
+ }
+ }
+ }
+
+ protected Object visitAdvice(Advice node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitDefinition(Definition node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitErrorStatement(ErrorStatement node) {
+ return node;
+ }
+
+ protected Object visitExpandStatement(ExpandStatement node) {
+ return node;
+ }
+
+ protected Object visitExpressionStatement(ExpressionStatement node) {
+ return node;
+ }
+
+ protected Object visitFileStatement(FileStatement node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitForEachStatement(ForEachStatement node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitIfStatement(IfStatement node) {
+ visitChildren(node.getBodyAsList());
+ visitChild(node.getElseIf());
+ return node;
+ }
+
+ protected Object visitImportDeclaration(ImportDeclaration node) {
+ return node;
+ }
+
+ protected Object visitLetStatement(LetStatement node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitProtectStatement(ProtectStatement node) {
+ visitChildren(node.getBodyAsList());
+ return node;
+ }
+
+ protected Object visitTemplate(Template node) {
+ visitChildren(Arrays.asList(node.getAllDefinitions()));
+ return node;
+ }
+
+ protected Object visitTextStatement(TextStatement node) {
+ return node;
+ }
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Advice.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Advice.java
index d48f094..8b52bfa 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Advice.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Advice.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Definition.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Definition.java
index d309bbc..6ac19e2 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Definition.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Definition.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ErrorStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ErrorStatement.java
index 8cefac5..c7e3b6d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ErrorStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ErrorStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
@@ -24,23 +22,29 @@ import org.eclipse.xtend.expression.AnalysationIssue;
*/
public class ErrorStatement extends Statement {
- private Expression message;
-
- public ErrorStatement( final Expression msg) {
- message = msg;
- }
-
- public Expression getMessage() {
- return message;
- }
-
- public void analyzeInternal(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
- message.analyze(ctx, issues);
- }
-
- @Override
- public void evaluateInternal(final XpandExecutionContext ctx) {
- System.err.println(message.evaluate(ctx));
- }
+ private final Expression message;
+
+ public ErrorStatement(final Expression msg) {
+ message = msg;
+ }
+
+ @Override
+ public void analyzeInternal(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
+ if (message != null) {
+ message.analyze(ctx, issues);
+ }
+ else {
+ issues.add(new AnalysationIssue(AnalysationIssue.SYNTAX_ERROR, "Error message required", this));
+ }
+ }
+
+ @Override
+ public void evaluateInternal(final XpandExecutionContext ctx) {
+ System.err.println(message.evaluate(ctx));
+ }
+
+ public Expression getMessage() {
+ return message;
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpandStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpandStatement.java
index b4d5dc4..930ce0f 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpandStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpandStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
@@ -80,7 +78,6 @@ public class ExpandStatement extends Statement {
return target;
}
- @Override
public void analyzeInternal(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
final Type[] paramTypes = new Type[getParameters().length];
for (int i = 0; i < getParameters().length; i++) {
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpressionStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpressionStatement.java
index 15ae2ea..b864ef2 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpressionStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ExpressionStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/FileStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/FileStatement.java
index a1a3de4..af727cd 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/FileStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/FileStatement.java
@@ -1,21 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.internal.xtend.expression.ast.Expression;
import org.eclipse.internal.xtend.expression.ast.Identifier;
import org.eclipse.xpand2.XpandExecutionContext;
+import org.eclipse.xpand2.output.VetoException;
import org.eclipse.xtend.expression.AnalysationIssue;
import org.eclipse.xtend.expression.EvaluationException;
import org.eclipse.xtend.expression.ExecutionContext;
@@ -28,66 +29,76 @@ import org.eclipse.xtend.typesystem.Type;
* @author Sven Efftinge (http://www.efftinge.de) *
*/
public class FileStatement extends StatementWithBody {
+ private static final Log LOG = LogFactory.getLog(FileStatement.class);
+
+ private Expression fileNameExpression;
+
+ private Identifier outletNameIdentifier;
+
+ public FileStatement(final Expression fileName, final Statement[] body, final Identifier mode) {
+ super(body);
+ this.fileNameExpression = fileName;
+ this.outletNameIdentifier = mode;
+ }
+
+ public Expression getTargetFileName() {
+ return fileNameExpression;
+ }
+
+ public Identifier getMode() {
+ return outletNameIdentifier;
+ }
+
+ public String getOutletName() {
+ if (outletNameIdentifier == null)
+ return null;
+ return outletNameIdentifier.getValue();
+ }
- private Expression fileNameExpression;
-
- private Identifier outletNameIdentifier;
-
- public FileStatement(final Expression fileName,
- final Statement[] body, final Identifier mode) {
- super(body);
- this.fileNameExpression = fileName;
- this.outletNameIdentifier = mode;
- }
-
- public Expression getTargetFileName() {
- return fileNameExpression;
- }
-
- public Identifier getMode() {
- return outletNameIdentifier;
- }
-
- public String getOutletName () {
- if (outletNameIdentifier == null)
- return null;
- return outletNameIdentifier.getValue();
- }
-
- @Override
- public void analyzeInternal(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
- final Type result = getTargetFileName().analyze(ctx, issues);
- if (!ctx.getStringType().isAssignableFrom(result)) {
- issues.add(new AnalysationIssue(AnalysationIssue.INCOMPATIBLE_TYPES, "String expected!",
- getTargetFileName()));
- }
- for (int i = 0; i < body.length; i++) {
- body[i].analyze(ctx, issues);
- }
- }
-
- @Override
- public void evaluateInternal(XpandExecutionContext ctx) {
- final Object result = getTargetFileName().evaluate(ctx);
- if (result == null)
- throw new EvaluationException("Nullevaluation", getTargetFileName(), ctx);
- final String fileName = result.toString();
- final String outletName = getOutletName();
-
- ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable("FILENAME", fileName));
- ctx.getOutput().openFile(fileName, outletName);
- for (int i = 0; i < body.length; i++) {
- body[i].evaluate(ctx);
- }
- ctx.getOutput().closeFile();
- }
-
@Override
- public String getNameString(ExecutionContext context) {
- return "FILE";
+ public void analyzeInternal(XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
+ final Type result = getTargetFileName().analyze(ctx, issues);
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable("FILENAME", result));
+ if (!ctx.getStringType().isAssignableFrom(result)) {
+ issues.add(new AnalysationIssue(AnalysationIssue.INCOMPATIBLE_TYPES, "String expected!",
+ getTargetFileName()));
+ }
+ for (int i = 0; i < body.length; i++) {
+ body[i].analyze(ctx, issues);
+ }
}
-}
+ @Override
+ public void evaluateInternal(XpandExecutionContext ctx) {
+ final Object result = getFilename(ctx);
+ String fileName = result.toString();
+ final String outletName = getOutletName();
+
+ ctx = (XpandExecutionContext) ctx.cloneWithVariable(new Variable("FILENAME", result));
+ try {
+ ctx.getOutput().openFile(fileName, outletName);
+ for (int i = 0; i < body.length; i++) {
+ body[i].evaluate(ctx);
+ }
+ ctx.getOutput().closeFile();
+ }
+ catch (VetoException e) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Generation of file '" + fileName + "' on outlet '" + outletName + "' skipped due to veto.");
+ }
+ }
+ }
+ @Override
+ public String getNameString(ExecutionContext context) {
+ return "FILE";
+ }
+ private Object getFilename(XpandExecutionContext ctx) {
+ final Object result = getTargetFileName().evaluate(ctx);
+ if (result == null)
+ throw new EvaluationException("Nullevaluation", getTargetFileName(), ctx);
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ForEachStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ForEachStatement.java
index 9763319..1566502 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ForEachStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ForEachStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/IfStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/IfStatement.java
index 657d070..ba98afd 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/IfStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/IfStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ImportDeclaration.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ImportDeclaration.java
index 4cab29f..2c1efde 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ImportDeclaration.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ImportDeclaration.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/LetStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/LetStatement.java
index abd81d6..db8d072 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/LetStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/LetStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ProtectStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ProtectStatement.java
index 525b44a..4c9e14d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ProtectStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/ProtectStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Statement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Statement.java
index e65600a..05e59db 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Statement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Statement.java
@@ -1,58 +1,85 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
import java.util.Set;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
import org.eclipse.internal.xtend.expression.ast.SyntaxElement;
import org.eclipse.xpand2.XpandExecutionContext;
import org.eclipse.xtend.expression.AnalysationIssue;
public abstract class Statement extends SyntaxElement implements XpandAnalyzable, XpandEvaluatable {
-
- protected AbstractDefinition containingDefinition;
-
- public Statement() {
- }
-
- public final void evaluate(final XpandExecutionContext ctx) {
- try {
- ctx.getOutput().pushStatement(this,ctx);
- ctx.preTask(this);
- evaluateInternal(ctx);
- ctx.postTask(this);
- ctx.getOutput().popStatement();
- } catch (RuntimeException exc) {
- ctx.handleRuntimeException(exc, this, null);
- }
- }
-
- public void analyze(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
+
+ protected AbstractDefinition containingDefinition;
+
+ public Statement() {
+ }
+
+ public final void evaluate(final XpandExecutionContext ctx) {
try {
+ ProgressMonitor monitor = ctx.getMonitor();
+ if (monitor != null && monitor.isCanceled())
+ return;
+
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().pre(this, ctx);
+ }
+ ctx.getOutput().pushStatement(this, ctx);
+ ctx.preTask(this);
+ evaluateInternal(ctx);
+ ctx.postTask(this);
+ ctx.getOutput().popStatement();
+ }
+ catch (final RuntimeException exc) {
+ ctx.handleRuntimeException(exc, this, null);
+ }
+ finally {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().post(null);
+ }
+ }
+ }
+
+ public void analyze(final XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
+ try {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().pre(this, ctx);
+ }
analyzeInternal(ctx, issues);
- } catch (RuntimeException ex) {
- ctx.handleRuntimeException(ex, this, null);
}
- }
-
- protected abstract void evaluateInternal(XpandExecutionContext ctx);
- protected abstract void analyzeInternal(XpandExecutionContext ctx, final Set<AnalysationIssue> issues);
+ catch (final RuntimeException ex) {
+ final String message = ex.getMessage();
+ if (message != null) {
+ issues.add(new AnalysationIssue(AnalysationIssue.INTERNAL_ERROR, ex.getMessage(), this));
+ }
+ else
+ throw ex;
+ }
+ finally {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().post(null);
+ }
+ }
+ }
+
+ protected abstract void evaluateInternal(XpandExecutionContext ctx);
+
+ protected abstract void analyzeInternal(XpandExecutionContext ctx, final Set<AnalysationIssue> issues);
public AbstractDefinition getContainingDefinition() {
return containingDefinition;
}
- public void setContainingDefinition(AbstractDefinition definition) {
+ public void setContainingDefinition(final AbstractDefinition definition) {
this.containingDefinition = definition;
}
-
+
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/StatementWithBody.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/StatementWithBody.java
index a66d594..3bfbb04 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/StatementWithBody.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/StatementWithBody.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Template.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Template.java
index 6c3fde7..da7cd66 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Template.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/Template.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
@@ -15,6 +13,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -62,8 +62,8 @@ public class Template extends SyntaxElement implements XpandResource {
this.fullyQualifiedName = fullyQualifiedName;
}
- public Template(final ImportDeclaration[] imports,
- final ImportDeclaration[] extensions, final Definition[] definitions, final Advice[] advices) {
+ public Template(final ImportDeclaration[] imports, final ImportDeclaration[] extensions,
+ final Definition[] definitions, final Advice[] advices) {
this.imports = imports;
this.extensions = extensions;
for (int i = 0; i < definitions.length; i++) {
@@ -93,7 +93,8 @@ public class Template extends SyntaxElement implements XpandResource {
public int compare(SyntaxElement o1, SyntaxElement o2) {
return new Integer(o1.getStart()).compareTo(o2.getStart());
- }});
+ }
+ });
return l.toArray(new AbstractDefinition[l.size()]);
}
@@ -110,16 +111,27 @@ public class Template extends SyntaxElement implements XpandResource {
public void analyze(XpandExecutionContext ctx, final Set<AnalysationIssue> issues) {
try {
ctx = (XpandExecutionContext) ctx.cloneWithResource(this);
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().pre(this, ctx);
+ }
+
+ checkDuplicateDefinitions(issues);
for (int i = 0; i < definitions.length; i++) {
definitions[i].analyze(ctx, issues);
}
for (int i = 0; i < advices.length; i++) {
advices[i].analyze(ctx, issues);
}
- } catch (RuntimeException ex) {
- ctx.handleRuntimeException(ex, this, null);
}
+ catch (RuntimeException ex) {
+ issues.add(new AnalysationIssue(AnalysationIssue.INTERNAL_ERROR, ex.getMessage(), this));
}
+ finally {
+ if (ctx.getCallback() != null) {
+ ctx.getCallback().post(null);
+ }
+ }
+ }
public XpandDefinition[] getDefinitionsByName(final String aName) {
final List<Definition> defs = new ArrayList<Definition>();
@@ -137,12 +149,15 @@ public class Template extends SyntaxElement implements XpandResource {
final List<String> l = new ArrayList<String>();
final String thisNs = XpandUtil.withoutLastSegment(getFullyQualifiedName());
- if (thisNs != null)
- l.add(thisNs);
for (int i = 0; i < getImports().length; i++) {
final ImportDeclaration anImport = getImports()[i];
l.add(anImport.getImportString().getValue());
}
+
+ if (thisNs != null) {
+ l.add(thisNs);
+ }
+
commonPrefixes = l.toArray(new String[l.size()]);
}
return commonPrefixes;
@@ -170,4 +185,26 @@ public class Template extends SyntaxElement implements XpandResource {
return advices;
}
+ private void checkDuplicateDefinitions(Set<AnalysationIssue> issues) {
+ Set<Definition> definitionSet = new HashSet<Definition>();
+ for (Definition def : definitions) {
+ if (!definitionSet.contains(def)) {
+ definitionSet.add(def);
+ }
+ else {
+ Definition origDef = null;
+ for (Iterator<Definition> it = definitionSet.iterator(); it.hasNext();) {
+ Definition d = it.next();
+ if (d.equals(def)) {
+ origDef = d;
+ break;
+ }
+ }
+ issues.add(new AnalysationIssue(AnalysationIssue.INTERNAL_ERROR, "Duplicate definition '"
+ + def.getName() + "'", def));
+ issues.add(new AnalysationIssue(AnalysationIssue.INTERNAL_ERROR, "Duplicate definition '"
+ + origDef.getName() + "'", origDef));
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/TextStatement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/TextStatement.java
index be92789..5ccb699 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/TextStatement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/TextStatement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandAnalyzable.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandAnalyzable.java
index 2bac245..c3aa13d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandAnalyzable.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandAnalyzable.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandEvaluatable.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandEvaluatable.java
index 69b4070..81aa4d9 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandEvaluatable.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/XpandEvaluatable.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.ast;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/package.html
new file mode 100644
index 0000000..41417b9
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/ast/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+AST of the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/ExpandProposalComputer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/ExpandProposalComputer.java
index c040243..ac7cc08 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/ExpandProposalComputer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/ExpandProposalComputer.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/FastAnalyzer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/FastAnalyzer.java
index a5775ee..5eddc22 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/FastAnalyzer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/FastAnalyzer.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/KeywordProposalComputer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/KeywordProposalComputer.java
index c9a4981..5f5eeab 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/KeywordProposalComputer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/KeywordProposalComputer.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/LazyVar.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/LazyVar.java
index 3d290ff..0e2312b 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/LazyVar.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/LazyVar.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/NamespaceProposalComputer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/NamespaceProposalComputer.java
index fe77581..944b16d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/NamespaceProposalComputer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/NamespaceProposalComputer.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StackElement.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StackElement.java
index 2316bf9..a49dd68 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StackElement.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StackElement.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StatementProposalComputer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StatementProposalComputer.java
index 2487f3b..131b09d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StatementProposalComputer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/StatementProposalComputer.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandPartition.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandPartition.java
index 819f8a6..c3688cb 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandPartition.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandPartition.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandTokens.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandTokens.java
index 46a7217..b2d6015 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandTokens.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/XpandTokens.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.codeassist;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/package.html
new file mode 100644
index 0000000..2c5f475
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/codeassist/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Codeassist for the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ExpandSpecial.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ExpandSpecial.java
index 3b7d614..5b93eb8 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ExpandSpecial.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ExpandSpecial.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005 - 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.debug;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ForEachSpecial.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ForEachSpecial.java
index fb453fb..1614077 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ForEachSpecial.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/ForEachSpecial.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005 - 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.debug;
@@ -21,38 +19,52 @@ import org.eclipse.xtend.expression.ExecutionContext;
* Adapter to handle FOREACH statement special stuff.
*
* @author Clemens Kadura (zAJKa)
+ * @author Jan Köhnlein
*/
public class ForEachSpecial extends BaseSpecialTreatment {
- private ForEachStatement lastForEach;
-
- // -------------------------------------------------------------------------
+ private ForEachStatement lastForEachInAdaptSyntaxElementTO;
+ private ForEachStatement lastForEachInShallSuspend;
+ int iterationCounter;
/**
- * A ForEachStatement calls monitor.preTask() always twice. First time for the (outer) statement and 2nd time
- * for each loop. We disable suspension the first time.
+ * A ForEachStatement calls monitor.preTask() always twice. First time for
+ * the (outer) statement and 2nd time for each loop. We disable suspension
+ * the first time.
*
- * @see org.eclipse.internal.xtend.expression.debug.BaseSpecialTreatment#shallNotSuspend(java.lang.Object, int)
+ * @see org.eclipse.internal.xtend.expression.debug.BaseSpecialTreatment#shallNotSuspend(java.lang.Object,
+ * int)
*/
@Override
public boolean shallNotSuspend(Object element, int flag, ExecutionContext ctx) {
- // in the outer loop the iterator is null, so we don't suspend
- return element instanceof ForEachStatement; // && ((ForEachStatement) element).getIterator() == null;
+ if (element instanceof ForEachStatement) {
+ if (element.equals(lastForEachInShallSuspend))
+ return false;
+ lastForEachInShallSuspend = (ForEachStatement) element;
+ iterationCounter = 0;
+ return true;
+ }
+ return false;
}
/**
- * Don't show frame in Launch view, if the ForEachStatement is the 1st time in the stack.
+ * Don't show frame in Launch view, if the ForEachStatement is the 1st time
+ * in the stack.
*
* @see org.eclipse.internal.xtend.expression.debug.BaseSpecialTreatment#adaptSyntaxElement(org.eclipse.emf.mwe.core.debug.model.SyntaxElement,
* java.lang.Object)
*/
@Override
public void adaptSyntaxElement(SyntaxElement to, Object element) {
- if (element instanceof ForEachStatement)
- if (!element.equals(lastForEach)) {
+ if (element instanceof ForEachStatement) {
+ if (!element.equals(lastForEachInAdaptSyntaxElementTO)) {
to.visible = false;
- lastForEach = (ForEachStatement) element;
+ lastForEachInAdaptSyntaxElementTO = (ForEachStatement) element;
}
+ else {
+ to.elementName = to.elementName + " #" + (iterationCounter++);
+ }
+ }
}
@Override
@@ -60,9 +72,10 @@ public class ForEachSpecial extends BaseSpecialTreatment {
if (se instanceof ForEachStatement) {
String name = "FOREACH";
// add counter to the FOREACH name
- XpandIterator it = null; //((ForEachStatement) se).getIterator();
+ XpandIterator it = null; // ((ForEachStatement) se).getIterator();
if (it != null)
- // Hint: We can ignore it == null (the outer call), since it isn't visible anyway
+ // Hint: We can ignore it == null (the outer call), since it
+ // isn't visible anyway
return name + " " + it.counter1() + " of " + it.elements();
}
return "";
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/IfSpecial.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/IfSpecial.java
index 26e1a95..4cf1721 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/IfSpecial.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/IfSpecial.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005 - 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.debug;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandElementAdapter.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandElementAdapter.java
index d2a4925..0a2921f 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandElementAdapter.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandElementAdapter.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005 - 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.debug;
@@ -28,6 +26,7 @@ import org.eclipse.internal.xtend.expression.debug.NoResourceSpecial;
*/
public class XpandElementAdapter extends ExpressionElementAdapter {
+ @SuppressWarnings("hiding")
public static final String TYPE = "xpand";
// -------------------------------------------------------------------------
@@ -86,19 +85,18 @@ public class XpandElementAdapter extends ExpressionElementAdapter {
@Override
public List<NameValuePair> getVariables(Object element) {
-
+
// Beispiel wie inspect implementiert werden kann (hat hier nichts zu
// suchen, nur als Gedankenstütze CK)
// ExpressionFacade ef = new ExpressionFacade(getCtx());
// Object evaluate = ef.evaluate("");
// getAllPropertiesFor(getCtx().getType(evaluate), evaluate);
-
- if (element instanceof Statement) {
+
+ if (element instanceof Statement)
return getAllVisibleVariables();
- }
return super.getVariables(element);
}
-
+
@Override
public Object findElement(SyntaxElement se, Object actual, int flag) {
if (actual == null)
@@ -109,7 +107,7 @@ public class XpandElementAdapter extends ExpressionElementAdapter {
if (se.resource.endsWith(pres.getStringRep(op.getFileName())) && se.start == start)
return actual;
}
- return super.findElement(se,actual, flag);
+ return super.findElement(se, actual, flag);
}
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
index 3ed72ce..811f11d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005 - 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.debug;
@@ -32,7 +30,8 @@ import org.eclipse.internal.xtend.expression.debug.ExpressionModelPresentation;
import org.eclipse.xtend.expression.ExecutionContext;
/**
- * This class is responsible for all presentation topics for Xpand statements in the debugger views.
+ * This class is responsible for all presentation topics for Xpand statements in
+ * the debugger views.
*
* @author Clemens Kadura (zAJKa)
*/
@@ -97,7 +96,8 @@ public class XpandModelPresentation extends ExpressionModelPresentation {
to.resource = getResource(se);
to.start = getEndStartPosition(se);
to.end = se.getEnd();
- to.line = se.getLine();// TODO: Known issue: "last line" is not stored. How to calculate it?
+ to.line = se.getLine();// TODO: Known issue: "last line" is not stored.
+ // How to calculate it?
return to;
}
@@ -107,11 +107,17 @@ public class XpandModelPresentation extends ExpressionModelPresentation {
@Override
protected String getContainerName(ISyntaxElement se) {
XpandDefinition def;
- if (se instanceof XpandDefinition)
+ if (se instanceof XpandDefinition) {
def = (XpandDefinition) se;
- else
+ }
+ else {
def = ((Statement) se).getContainingDefinition();
+ }
+
+ if (def != null)
return getTemplateName(se) + "::" + getDefinitionName(def);
+
+ return "";
}
private String getDefinitionName(XpandDefinition def) {
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/package.html
new file mode 100644
index 0000000..34d0788
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Debug support for the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/AdvicedDefinition.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/AdvicedDefinition.java
index af79ea7..36c32ca 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/AdvicedDefinition.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/AdvicedDefinition.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.model;
@@ -14,6 +12,7 @@ import java.util.Set;
import org.eclipse.internal.xpand2.ast.Advice;
import org.eclipse.internal.xpand2.type.XpandDefinitionImpl;
+import org.eclipse.internal.xtend.expression.ast.AbstractVisitor;
import org.eclipse.internal.xtend.expression.ast.DeclaredParameter;
import org.eclipse.xpand2.XpandExecutionContext;
import org.eclipse.xtend.expression.AnalysationIssue;
@@ -22,30 +21,30 @@ import org.eclipse.xtend.expression.Variable;
public class AdvicedDefinition implements XpandDefinition {
- private XpandAdvice advice;
+ private XpandAdvice advice;
- private XpandDefinition definition;
+ private XpandDefinition definition;
- public AdvicedDefinition(final XpandAdvice adv, final XpandDefinition def) {
- advice = adv;
- definition = def;
- }
+ public AdvicedDefinition(final XpandAdvice adv, final XpandDefinition def) {
+ advice = adv;
+ definition = def;
+ }
- public XpandResource getOwner() {
- return definition.getOwner();
- }
+ public XpandResource getOwner() {
+ return definition.getOwner();
+ }
- public DeclaredParameter[] getParams() {
- return definition.getParams();
- }
+ public DeclaredParameter[] getParams() {
+ return definition.getParams();
+ }
- public String getTargetType() {
- return definition.getTargetType();
- }
+ public String getTargetType() {
+ return definition.getTargetType();
+ }
- public String getName() {
- return "AROUND " + definition.getName();
- }
+ public String getName() {
+ return "AROUND " + definition.getName();
+ }
public String getQualifiedName() {
return definition.getQualifiedName();
@@ -60,15 +59,15 @@ public class AdvicedDefinition implements XpandDefinition {
}
public void evaluate(final XpandExecutionContext ctx) {
- final XpandExecutionContext ctx1 = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(
- Advice.DEF_VAR_NAME, new XpandDefinitionImpl(definition, ctx)));
- advice.evaluate(ctx1);
- }
-
- public int getLine() {
- return advice.getLine();
- }
-
+ final XpandExecutionContext ctx1 = (XpandExecutionContext) ctx.cloneWithVariable(new Variable(
+ Advice.DEF_VAR_NAME, new XpandDefinitionImpl(definition, ctx)));
+ advice.evaluate(ctx1);
+ }
+
+ public int getLine() {
+ return advice.getLine();
+ }
+
public int getEnd() {
return advice.getEnd();
}
@@ -76,18 +75,21 @@ public class AdvicedDefinition implements XpandDefinition {
public int getStart() {
return advice.getStart();
}
-
+
public String getFileName() {
return advice.getFileName();
}
- public String getNameString(ExecutionContext context){
+ public String getNameString(ExecutionContext context) {
return advice.getNameString(context);
}
- @Override
- public String toString() {
- return definition.toString() + " adviced by " + advice.toString();
- }
+ @Override
+ public String toString() {
+ return definition.toString() + " adviced by " + advice.toString();
+ }
+ public final Object accept(final AbstractVisitor visitor) {
+ return visitor.visit(this);
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/Procedure.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/Procedure.java
index b9ebe61..add6c85 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/Procedure.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/Procedure.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.model;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandAdvice.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandAdvice.java
index 4565a8c..486c0b3 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandAdvice.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandAdvice.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.model;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandDefinition.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandDefinition.java
index 1592a8d..e79d615 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandDefinition.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandDefinition.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.model;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandResource.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandResource.java
index 5b935ea..ef9110d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandResource.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/XpandResource.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.model;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/package.html
new file mode 100644
index 0000000..5e205b7
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/model/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Basic abstractions of the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/package.html
new file mode 100644
index 0000000..08b9f27
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Implementation of the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandFactory.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandFactory.java
index 2cf9f31..c9a347c 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandFactory.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandFactory.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.parser;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLexer.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLexer.java
index 709d609..c3ff103 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLexer.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLexer.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
-// $ANTLR 3.0 ../core.xpand2/main/src/org/openarchitectureware/xpand2/parser/Xpand.g 2007-08-13 15:51:05
package org.eclipse.internal.xpand2.parser;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLocationAddingParser.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLocationAddingParser.java
index 4651bdd..5210333 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLocationAddingParser.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandLocationAddingParser.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.parser;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParseFacade.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParseFacade.java
index 5dd9216..7e0712a 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParseFacade.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParseFacade.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.parser;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParser.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParser.java
index f2ab2f6..d113d62 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParser.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/XpandParser.java
@@ -1,14 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
-// $ANTLR 3.0 ../core.xpand2/main/src/org/openarchitectureware/xpand2/parser/Xpand.g 2007-08-13 15:51:04
package org.eclipse.internal.xpand2.parser;
@@ -4565,7 +4562,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 1 :
- input.LA(1);
+ int LA30_48 = input.LA(1);
int index30_48 = input.index();
@@ -4580,7 +4577,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 2 :
- input.LA(1);
+ int LA30_39 = input.LA(1);
int index30_39 = input.index();
@@ -4595,7 +4592,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 3 :
- input.LA(1);
+ int LA30_42 = input.LA(1);
int index30_42 = input.index();
@@ -4610,7 +4607,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 4 :
- input.LA(1);
+ int LA30_44 = input.LA(1);
int index30_44 = input.index();
@@ -4625,7 +4622,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 5 :
- input.LA(1);
+ int LA30_35 = input.LA(1);
int index30_35 = input.index();
@@ -4640,7 +4637,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 6 :
- input.LA(1);
+ int LA30_43 = input.LA(1);
int index30_43 = input.index();
@@ -4655,7 +4652,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 7 :
- input.LA(1);
+ int LA30_11 = input.LA(1);
int index30_11 = input.index();
@@ -4670,7 +4667,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 8 :
- input.LA(1);
+ int LA30_28 = input.LA(1);
int index30_28 = input.index();
@@ -4685,7 +4682,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 9 :
- input.LA(1);
+ int LA30_29 = input.LA(1);
int index30_29 = input.index();
@@ -4700,7 +4697,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 10 :
- input.LA(1);
+ int LA30_33 = input.LA(1);
int index30_33 = input.index();
@@ -4715,7 +4712,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 11 :
- input.LA(1);
+ int LA30_30 = input.LA(1);
int index30_30 = input.index();
@@ -4730,7 +4727,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 12 :
- input.LA(1);
+ int LA30_34 = input.LA(1);
int index30_34 = input.index();
@@ -4745,7 +4742,7 @@ public class XpandParser extends Parser {
if ( s>=0 ) return s;
break;
case 13 :
- input.LA(1);
+ int LA30_36 = input.LA(1);
int index30_36 = input.index();
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/package.html
new file mode 100644
index 0000000..13c9390
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/parser/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Parser for the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegion.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegion.java
index ef589df..f81f6f9 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegion.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegion.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolver.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolver.java
index bcdd43a..a9019cc 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolver.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolver.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolverImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolverImpl.java
index 03256f8..1981d4c 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolverImpl.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionResolverImpl.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr;
@@ -34,87 +32,89 @@ import org.eclipse.internal.xpand2.pr.util.FSIO;
import org.eclipse.internal.xpand2.pr.util.GenericFileFilter;
/**
- * Default implementation of the {@link ProtectedRegionResolver} interface.
+ * Default implementation of the {@link ProtectedRegionResolver} interface.
*/
public class ProtectedRegionResolverImpl implements ProtectedRegionResolver {
+ private static final Log LOG = LogFactory.getLog(ProtectedRegionResolverImpl.class);
- private static final String ENABLED = "ENABLED";
+ private static final String ENABLED = "ENABLED";
- public static class ProtectedRegionImpl implements ProtectedRegion {
- private SoftReference<String> body;
+ public static class ProtectedRegionImpl implements ProtectedRegion {
+ private SoftReference<String> body;
- private String fileEncoding;
+ private String fileEncoding;
- private int endIndex;
+ private int endIndex;
- private File file;
+ private File file;
- private String id;
+ private String id;
- private int startIndex;
+ private int startIndex;
- private boolean disabled = true;
+ private boolean disabled = true;
- private boolean useBASE64;
+ private boolean useBASE64;
- public ProtectedRegionImpl(final String id, final boolean disabled, final File file, final String fileEncoding,
- final boolean useBASE64, final int startIndex, final int endIndex, final String body) {
- this.id = id;
- this.disabled = disabled;
+ public ProtectedRegionImpl(final String id, final boolean disabled, final File file, final String fileEncoding,
+ final boolean useBASE64, final int startIndex, final int endIndex, final String body) {
+ this.id = id;
+ this.disabled = disabled;
- this.file = file;
- this.fileEncoding = fileEncoding;
- this.useBASE64 = useBASE64;
- this.startIndex = startIndex;
- this.endIndex = endIndex;
+ this.file = file;
+ this.fileEncoding = fileEncoding;
+ this.useBASE64 = useBASE64;
+ this.startIndex = startIndex;
+ this.endIndex = endIndex;
- this.body = new SoftReference<String>(body);
- }
+ this.body = new SoftReference<String>(body);
+ }
- public void setBody(final String body) {
- this.body = new SoftReference<String>(body);
- }
+ public void setBody(final String body) {
+ this.body = new SoftReference<String>(body);
+ }
- public String getBody(final String startComment, final String endComment) throws ProtectedRegionSyntaxException {
- String body = this.body.get();
+ public String getBody(final String startComment, final String endComment) throws ProtectedRegionSyntaxException {
+ String body = this.body.get();
- if (body == null) {
- try {
- body = FSIO.readSingleFile(file, fileEncoding).substring(startIndex, endIndex);
- } catch (final IOException e) {
- throw new RuntimeException("Unexpected I/O exception (source files removed?)", e);
- }
- }
+ if (body == null) {
+ try {
+ body = FSIO.readSingleFile(file, fileEncoding).substring(startIndex, endIndex);
+ }
+ catch (final IOException e) {
+ throw new RuntimeException("Unexpected I/O exception (source files removed?)", e);
+ }
+ }
- final int endCommentIndex = body.indexOf(endComment);
+ final int endCommentIndex = body.indexOf(endComment);
- if ((endCommentIndex < 0) || (body.substring(0, endCommentIndex).trim().length() > 0))
- throw new ProtectedRegionSyntaxException("Start of protected region " + id
- + " does not end with comment " + endComment);
+ if ((endCommentIndex < 0) || (body.substring(0, endCommentIndex).trim().length() > 0))
+ throw new ProtectedRegionSyntaxException("Start of protected region " + id
+ + " does not end with comment " + endComment);
- final int startCommentIndex = body.lastIndexOf(startComment);
+ final int startCommentIndex = body.lastIndexOf(startComment);
- if ((startCommentIndex < 0)
- || (body.substring(startCommentIndex + startComment.length()).trim().length() > 0))
- throw new ProtectedRegionSyntaxException("End of protected region " + id
- + " does not start with comment " + startComment);
+ if ((startCommentIndex < 0)
+ || (body.substring(startCommentIndex + startComment.length()).trim().length() > 0))
+ throw new ProtectedRegionSyntaxException("End of protected region " + id
+ + " does not start with comment " + startComment);
- return body.substring(endCommentIndex + endComment.length(), startCommentIndex);
- }
+ return body.substring(endCommentIndex + endComment.length(), startCommentIndex);
+ }
+
+ public String getEndString(final String startComment, final String endComment) {
+ return startComment + PROTECT_END + endComment;
+ }
- public String getEndString(final String startComment, final String endComment) {
- return startComment + PROTECT_END + endComment;
- }
+ public File getFile() {
+ return file;
+ }
- public File getFile() {
- return file;
- }
+ public String getId() {
+ return id;
+ }
- public String getId() {
- return id;
- }
-
- public String getFileEncoding() {
+ public String getFileEncoding() {
return fileEncoding;
}
@@ -135,338 +135,373 @@ public class ProtectedRegionResolverImpl implements ProtectedRegionResolver {
}
public String getStartString(final String startComment, final String endComment) {
- if (useBASE64) {
- try {
- return (startComment + PROTECT_BEGIN + PROTECT_B64_BEFORE_ID + BASE64.toString(id)
- + PROTECT_B64_AFTER_ID + " " + (!disabled ? ENABLED + " " : "") + PROTECT_START_END + endComment);
- } catch (final IOException ie) {
- // fallback to old style if BASE64Encoder fails
- }
- }
+ if (useBASE64) {
+ try {
+ return (startComment + PROTECT_BEGIN + PROTECT_B64_BEFORE_ID + BASE64.toString(id)
+ + PROTECT_B64_AFTER_ID + " " + (!disabled ? ENABLED + " " : "") + PROTECT_START_END + endComment);
+ }
+ catch (final IOException ie) {
+ // fallback to old style if BASE64Encoder fails
+ }
+ }
+
+ return (startComment + PROTECT_BEGIN + PROTECT_BEFORE_ID + id + PROTECT_AFTER_ID + " "
+ + (!disabled ? ENABLED + " " : "") + PROTECT_START_END + endComment);
+ }
+
+ }
+
+ private static final String PROTECT_AFTER_ID = ")";
+
+ private static final String PROTECT_B64_AFTER_ID = "]";
+
+ private static final String PROTECT_B64_BEFORE_ID = "[";
+
+ private static final String PROTECT_BEFORE_ID = "(";
+
+ private static final String PROTECT_BEGIN = "PROTECTED REGION ID";
+
+ private static final String PROTECT_END = "PROTECTED REGION END";
+
+ private static final String PROTECT_START_END = "START";
+
+ private final Log log = LogFactory.getLog(getClass());
+
+ private File[] srcPaths = null;
+
+ private boolean defaultExcludes = true;
- return (startComment + PROTECT_BEGIN + PROTECT_BEFORE_ID + id + PROTECT_AFTER_ID + " "
- + (!disabled ? ENABLED + " " : "") + PROTECT_START_END + endComment);
- }
+ protected boolean useBASE64 = false;
- }
+ protected String encoding;
- private static final String PROTECT_AFTER_ID = ")";
+ private String ignoreList = null;
- private static final String PROTECT_B64_AFTER_ID = "]";
+ /**
+ * This map stores all scanned protected regions.
+ * <p>
+ * Key: Protected Region ID<br>
+ * Value: The Protected Region
+ */
+ private Map<String, ProtectedRegionImpl> regionMap = null;
- private static final String PROTECT_B64_BEFORE_ID = "[";
+ /**
+ * All already queried Protected Region Ids. Is used for detecting ambigious
+ * usage of Protected Regions.
+ */
+ private Set<String> usedSet = null;
- private static final String PROTECT_BEFORE_ID = "(";
+ /**
+ * Retrieves all Protected Regions from a source file.
+ *
+ * @param file
+ * The source file to scan.
+ * @return All found Protected Regions in the specified file.
+ * @throws ProtectedRegionSyntaxException
+ * If one of the Protected Regions in the file is incomplete or
+ * invalid.
+ * @throws IOException
+ * On errors occuring when reading the file
+ */
+ protected Collection<ProtectedRegionImpl> getAllRegions(final File file) throws ProtectedRegionSyntaxException,
+ IOException {
+ final List<ProtectedRegionImpl> regions = new ArrayList<ProtectedRegionImpl>();
- private static final String PROTECT_BEGIN = "PROTECTED REGION ID";
+ final String source = FSIO.readSingleFile(file, encoding);
- private static final String PROTECT_END = "PROTECTED REGION END";
+ final int beginLength = PROTECT_BEGIN.length();
+ final int startEndLength = PROTECT_START_END.length();
+ final int idBeginLength = PROTECT_BEFORE_ID.length();
+ final int idEndLength = PROTECT_AFTER_ID.length();
- private static final String PROTECT_START_END = "START";
+ int start = source.indexOf(PROTECT_BEGIN);
- private final Log log = LogFactory.getLog(getClass());
+ while (start >= 0) {
+ final int blockStart = start + beginLength;
- private File[] srcPaths = null;
+ boolean isB64 = false;
+ int idStart = source.indexOf(PROTECT_BEFORE_ID, blockStart);
- private boolean defaultExcludes = true;
+ if (idStart != blockStart) {
+ // IP System.out.println("IDSTART:"+idStart);
+ idStart = source.indexOf(PROTECT_B64_BEFORE_ID, blockStart);
+ isB64 = true;
+ }
+ idStart += idBeginLength;
- protected boolean useBASE64 = false;
+ final int end = source.indexOf(PROTECT_END, idStart);
+ final int next = source.indexOf(PROTECT_BEGIN, idStart);
- protected String encoding;
+ if ((end < 0) || ((next >= 0) && (next < end)))
+ throw new ProtectedRegionSyntaxException("Protected region at index " + start + " in file '" + file
+ + "' is incomplete");
- private String ignoreList = null;
+ final int idEnd = source.indexOf(isB64 ? PROTECT_B64_AFTER_ID : PROTECT_AFTER_ID, idStart);
- /**
- * This map stores all scanned protected regions.
- * <p>
- * Key: Protected Region ID<br>
- * Value: The Protected Region
- */
- private Map<String, ProtectedRegionImpl> regionMap = null;
+ if ((idEnd <= idStart) || (end < idEnd))
+ throw new ProtectedRegionSyntaxException("Protected region Id at index " + start + " in file '" + file
+ + "' is incomplete");
- /**
- * All already queried Protected Region Ids. Is used for detecting ambigious usage of
- * Protected Regions.
- */
- private Set<String> usedSet = null;
+ String id = new String(source.substring(idStart, idEnd));
- /**
- * Retrieves all Protected Regions from a source file.
- * @param file The source file to scan.
- * @return All found Protected Regions in the specified file.
- * @throws ProtectedRegionSyntaxException If one of the Protected Regions in the file is incomplete or invalid.
- * @throws IOException On errors occuring when reading the file
- */
- protected Collection<ProtectedRegionImpl> getAllRegions(final File file) throws ProtectedRegionSyntaxException, IOException {
- final List<ProtectedRegionImpl> regions = new ArrayList<ProtectedRegionImpl>();
-
- final String source = FSIO.readSingleFile(file, encoding);
+ if (isB64) {
+ try {
+ id = new String(BASE64.toByteArray(id));
+ }
+ catch (final IOException ie) {
+ throw new ProtectedRegionSyntaxException("Protected region Id at index " + start + " in file '"
+ + file + "' is incomplete", ie);
+ }
+ }
+
+ final int startEnd = source.indexOf(PROTECT_START_END, idEnd + idEndLength);
+
+ if (end < startEnd)
+ throw new ProtectedRegionSyntaxException("Protected region start at index " + start + " in file '"
+ + file + "' is incomplete");
+
+ final String type = new String(source.substring(idEnd + idEndLength, startEnd).trim().toUpperCase());
+
+ if (!(type.equals("") || type.equals(ENABLED)))
+ throw new ProtectedRegionSyntaxException("Protected region start at index " + start + " in file "
+ + file + " has illegal type '" + type + "'");
+ if (type.equals(ENABLED)) {
+ final String body = new String(source.substring(startEnd + startEndLength, end));
+ regions.add(new ProtectedRegionImpl(id, false, file, encoding, useBASE64, startEnd + startEndLength,
+ end, body));
+ }
+ start = next;
+ }
+
+ return regions;
+ }
+
+ public ProtectedRegion createProtectedRegion(final String id, final boolean disabled) {
+ return new ProtectedRegionImpl(id, disabled, null, null, useBASE64, 0, 0, null);
+ }
+
+ public ProtectedRegion getProtectedRegion(final String id) {
+ init();
+ // if (!usedSet.isEmpty()) { // Fix:No error if Handle is not used
+ // return null;
+ // }
+ if (!usedSet.add(id)) {
+ // id was not added to usedSet -> id was already queried before!
+ log.warn("Protected region with ID '" + id + "' referenced more than once");
+ }
+
+ return regionMap.get(id);
+ }
+
+ /**
+ * Initializes the ProtectedRegionResolver. This starts the scan over all
+ * configured paths (property 'srcPaths').
+ * <p>
+ * A second call (already initialized) to this method will return
+ * immediately.
+ *
+ * @throws IllegalStateException
+ * If a Protected Region Id is detected the second time, i.e. it
+ * is not unique.
+ */
+ public void init() throws IllegalStateException {
+ // Already initialized?
+ if (regionMap != null)
+ return;
+
+ // Initialize the Protected Region map
+ regionMap = new HashMap<String, ProtectedRegionImpl>();
+ usedSet = new HashSet<String>();
+
+ if (srcPaths == null) {
+ log.warn("No source paths configured for scanning.");
+ // abort
+ return;
+ }
+
+ long time = 0;
+ long fileCount = 0;
+
+ if (log.isInfoEnabled()) {
+ log.info("Source scan started ...");
+ time = System.currentTimeMillis();
+ }
+
+ // create the file filter
+ final GenericFileFilter filter = new GenericFileFilter(ignoreList, defaultExcludes);
+
+ // Scan all configured paths
+ for (int i = 0; i < srcPaths.length; i += 1) {
+ try {
+ // retrieve (recursive) all files from a path matching the
+ // configured filter
+ final File[] files = FSIO.getAllFiles(srcPaths[i], filter);
+
+ fileCount += files.length;
+
+ // scan all files
+ for (int j = 0; j < files.length; j += 1) {
+ // retrieve the Protected Regions from the current file
+ final Iterator<ProtectedRegionImpl> regions = getAllRegions(files[j]).iterator();
+
+ while (regions.hasNext()) {
+ final ProtectedRegionImpl region = regions.next();
+
+ final String id = region.getId();
+ // check for non-uniqueness of a Protected Region Id
+ if (regionMap.containsKey(id))
+ throw new IllegalStateException("Id '" + id + "' occuring in files " + region.getFile()
+ + " and " + regionMap.get(id).getFile() + " is not unique");
+ // Store this region
+ regionMap.put(id, region);
+ }
+ }
+ }
+ catch (final IOException e) {
+ throw new RuntimeException("Unexpected I/O exception", e);
+ }
+ catch (final ProtectedRegionSyntaxException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ if (log.isInfoEnabled()) {
+ time = System.currentTimeMillis() - time;
+
+ log.info("Source scan finished in " + (time / 1000.0) + "s");
+ log.info("Files scanned: " + fileCount);
+ log.info("Regions found: " + regionMap.size());
+ }
+
+ }
+
+ /**
+ * Dumps all known protected regions to files. For each protected region a
+ * file is created.
+ *
+ * @param dumpPath
+ * Directory where the dump files are created within.
+ */
+ public void reportRegions(final File dumpPath) {
+ final int unused = regionMap.size() - usedSet.size();
+
+ if (unused > 0) {
+ log.warn("There are " + unused + " unused Regions:");
+
+ if (dumpPath != null) {
+ dumpPath.mkdirs();
+ }
+
+ for (final Iterator<ProtectedRegionImpl> regions = regionMap.values().iterator(); regions.hasNext();) {
+ final ProtectedRegionImpl region = regions.next();
+
+ final String id = region.getId();
+
+ if (!usedSet.contains(id)) {
+ log.warn("File: " + region.getFile());
+ log.warn("ID: " + id);
+
+ try {
+ if (dumpPath != null) {
+ final File file = new File(dumpPath, BASE64.toString(id));
+
+ Writer writer;
+
+ if (encoding == null) {
+ writer = new FileWriter(file);
+ }
+ else {
+ writer = new OutputStreamWriter(new FileOutputStream(file), encoding);
+ }
+
+ writer.write(region.getStartString("", ""));
+ writer.write(region.getBody("", ""));
+ writer.write(region.getEndString("", ""));
+
+ writer.close();
+ }
+ }
+ catch (final IOException e) {
+ throw new RuntimeException("Unexpected I/O exception", e);
+ }
+ catch (final ProtectedRegionSyntaxException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This flag determines whether default file exclusion patterns should be
+ * used.
+ *
+ * @param defaultExcludes
+ * <code>true</code>: Use default file exclusion patterns,
+ * <code>false</code>: ignore them, just use the patterns
+ * specified by {@link #setIgnoreList(String) ignoreList}
+ * @see Xpand reference manual
+ */
+ public void setDefaultExcludes(final boolean defaultExcludes) {
+ this.defaultExcludes = defaultExcludes;
+ }
+
+ /**
+ * Sets the file encoding to be used when reading files.
+ *
+ * @param encoding
+ * A valid encoding string.
+ */
+ public void setFileEncoding(final String encoding) {
+ this.encoding = encoding;
+ }
+
+ /**
+ * Sets a custom list of file patterns that should be filtered during
+ * scanning of source files and directories.
+ *
+ * @param ignoreList
+ * A comma separated list of file patterns to ignore during scan.
+ */
+ public void setIgnoreList(final String ignoreList) {
+ this.ignoreList = ignoreList;
+ }
+
+ /**
+ * Sets the source paths that should be scanned.
+ *
+ * @param srcPathsAsString
+ * A comma separated list of directory paths.
+ * @throws IllegalArgumentException
+ * If one of the passed arguments is not a directory or does not
+ * exist
+ */
+ public void setSrcPathes(final String srcPathsAsString) throws IllegalArgumentException {
+ // Split the paths and initialize the
+ // file array 'srcPaths' from it
+ if ("".equals(srcPathsAsString)) {
+ this.srcPaths = new File[0];
+ }
+ else {
+ final String[] s = srcPathsAsString.split(",");
+ final List<File> validPaths = new ArrayList<File>(s.length);
+ for (int i = 0; i < s.length; i++) {
+ File dir = new File(s[i].trim());
+ // The configured path must point to an existing directory
+ if (dir.isDirectory()) {
+ validPaths.add(dir);
+ }
+ else {
+ final String msg = "Ignoring non-existing protected region path " + dir.getAbsolutePath();
+ LOG.warn(msg);
+ throw new IllegalArgumentException(msg);
+ }
+ }
+ this.srcPaths = validPaths.toArray(new File[] {});
+ }
+ }
- final int beginLength = PROTECT_BEGIN.length();
- final int startEndLength = PROTECT_START_END.length();
- final int idBeginLength = PROTECT_BEFORE_ID.length();
- final int idEndLength = PROTECT_AFTER_ID.length();
-
- int start = source.indexOf(PROTECT_BEGIN);
-
- while (start >= 0) {
- final int blockStart = start + beginLength;
-
- boolean isB64 = false;
- int idStart = source.indexOf(PROTECT_BEFORE_ID, blockStart);
-
- if (idStart != blockStart) {
- // IP System.out.println("IDSTART:"+idStart);
- idStart = source.indexOf(PROTECT_B64_BEFORE_ID, blockStart);
- isB64 = true;
- }
- idStart += idBeginLength;
-
- final int end = source.indexOf(PROTECT_END, idStart);
- final int next = source.indexOf(PROTECT_BEGIN, idStart);
-
- if ((end < 0) || ((next >= 0) && (next < end)))
- throw new ProtectedRegionSyntaxException("Protected region at index " + start + " in file '" + file
- + "' is incomplete");
-
- final int idEnd = source.indexOf(isB64 ? PROTECT_B64_AFTER_ID : PROTECT_AFTER_ID, idStart);
-
- if ((idEnd <= idStart) || (end < idEnd))
- throw new ProtectedRegionSyntaxException("Protected region Id at index " + start + " in file '" + file
- + "' is incomplete");
-
- String id = new String(source.substring(idStart, idEnd));
-
- if (isB64) {
- try {
- id = new String(BASE64.toByteArray(id));
- } catch (final IOException ie) {
- throw new ProtectedRegionSyntaxException("Protected region Id at index " + start + " in file '"
- + file + "' is incomplete", ie);
- }
- }
-
- final int startEnd = source.indexOf(PROTECT_START_END, idEnd + idEndLength);
-
- if (end < startEnd)
- throw new ProtectedRegionSyntaxException("Protected region start at index " + start + " in file '"
- + file + "' is incomplete");
-
- final String type = new String(source.substring(idEnd + idEndLength, startEnd).trim().toUpperCase());
-
- if (!(type.equals("") || type.equals(ENABLED)))
- throw new ProtectedRegionSyntaxException("Protected region start at index " + start + " in file "
- + file + " has illegal type '" + type+ "'");
- if (type.equals(ENABLED)) {
- final String body = new String(source.substring(startEnd + startEndLength, end));
- regions.add(new ProtectedRegionImpl(id, false, file, encoding, useBASE64, startEnd + startEndLength,
- end, body));
- }
- start = next;
- }
-
- return regions;
- }
-
- public ProtectedRegion createProtectedRegion(final String id, final boolean disabled) {
- return new ProtectedRegionImpl(id, disabled, null, null, useBASE64, 0, 0, null);
- }
-
- public ProtectedRegion getProtectedRegion(final String id) {
- init();
-// if (!usedSet.isEmpty()) { // Fix:No error if Handle is not used
-// return null;
-// }
- if (!usedSet.add(id)) {
- // id was not added to usedSet -> id was already queried before!
- log.warn("Protected region with ID '" + id + "' referenced more than once");
- }
-
- return regionMap.get(id);
- }
-
- /**
- * Initializes the ProtectedRegionResolver. This starts the scan over all configured paths (property 'srcPaths').
- * <p>
- * A second call (already initialized) to this method will return immediately.
- *
- * @throws IllegalStateException If a Protected Region Id is detected the second time, i.e. it is not unique.
- */
- public void init() throws IllegalStateException {
- // Already initialized?
- if (regionMap != null) {
- return;
- }
-
- // Initialize the Protected Region map
- regionMap = new HashMap<String, ProtectedRegionImpl>();
- usedSet = new HashSet<String>();
-
- if (srcPaths==null) {
- log.warn("No source paths configured for scanning.");
- // abort
- return;
- }
-
- long time = 0;
- long fileCount = 0;
-
- if (log.isInfoEnabled()) {
- log.info("Source scan started ...");
- time = System.currentTimeMillis();
- }
-
- // create the file filter
- final GenericFileFilter filter = new GenericFileFilter(ignoreList, defaultExcludes);
-
- // Scan all configured paths
- for (int i = 0; i < srcPaths.length; i += 1) {
- try {
- // retrieve (recursive) all files from a path matching the configured filter
- final File[] files = FSIO.getAllFiles(srcPaths[i], filter);
-
- fileCount += files.length;
-
- // scan all files
- for (int j = 0; j < files.length; j += 1) {
- // retrieve the Protected Regions from the current file
- final Iterator<ProtectedRegionImpl> regions = getAllRegions(files[j]).iterator();
-
- while (regions.hasNext()) {
- final ProtectedRegionImpl region = regions.next();
-
- final String id = region.getId();
- // check for non-uniqueness of a Protected Region Id
- if (regionMap.containsKey(id)) {
- throw new IllegalStateException ("Id '" + id + "' occuring in files " + region.getFile()
- + " and " + regionMap.get(id).getFile()
- + " is not unique");
- }
- // Store this region
- regionMap.put(id, region);
- }
- }
- } catch (final IOException e) {
- throw new RuntimeException("Unexpected I/O exception", e);
- } catch (final ProtectedRegionSyntaxException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- if (log.isInfoEnabled()) {
- time = System.currentTimeMillis() - time;
-
- log.info("Source scan finished in " + (time / 1000.0) + "s");
- log.info("Files scanned: " + fileCount);
- log.info("Regions found: " + regionMap.size());
- }
-
- }
-
- /**
- * Dumps all known protected regions to files. For each protected region a file is created.
- * @param dumpPath Directory where the dump files are created within.
- */
- public void reportRegions(final File dumpPath) {
- final int unused = regionMap.size() - usedSet.size();
-
- if (unused > 0) {
- log.warn("There are " + unused + " unused Regions:");
-
- if (dumpPath != null) {
- dumpPath.mkdirs();
- }
-
- for (final Iterator<ProtectedRegionImpl> regions = regionMap.values().iterator(); regions.hasNext();) {
- final ProtectedRegionImpl region = regions.next();
-
- final String id = region.getId();
-
- if (!usedSet.contains(id)) {
- log.warn("File: " + region.getFile());
- log.warn("ID: " + id);
-
- try {
- if (dumpPath != null) {
- final File file = new File(dumpPath, BASE64.toString(id));
-
- Writer writer;
-
- if (encoding == null) {
- writer = new FileWriter(file);
- } else {
- writer = new OutputStreamWriter(new FileOutputStream(file), encoding);
- }
-
- writer.write(region.getStartString("", ""));
- writer.write(region.getBody("", ""));
- writer.write(region.getEndString("", ""));
-
- writer.close();
- }
- } catch (final IOException e) {
- throw new RuntimeException("Unexpected I/O exception", e);
- } catch (final ProtectedRegionSyntaxException e) {
- log.error(e.getMessage(), e);
- }
- }
- }
- }
- }
-
- /**
- * This flag determines whether default file exclusion patterns should be used.
- * @param defaultExcludes <code>true</code>: Use default file exclusion patterns, <code>false</code>: ignore them, just use
- * the patterns specified by {@link #setIgnoreList(String) ignoreList}
- * @see Xpand reference manual
- */
- public void setDefaultExcludes(final boolean defaultExcludes) {
- this.defaultExcludes = defaultExcludes;
- }
-
- /**
- * Sets the file encoding to be used when reading files.
- * @param encoding A valid encoding string.
- */
- public void setFileEncoding(final String encoding) {
- this.encoding = encoding;
- }
-
- /**
- * Sets a custom list of file patterns that should be filtered during scanning of source files
- * and directories.
- * @param ignoreList A comma separated list of file patterns to ignore during scan.
- */
- public void setIgnoreList(final String ignoreList) {
- this.ignoreList = ignoreList;
- }
-
- /**
- * Sets the source paths that should be scanned.
- * @param srcPathsAsString A comma separated list of directory paths.
- * @throws IllegalArgumentException If one of the passed arguments is not a directory or does not exist
- */
- public void setSrcPathes(final String srcPathsAsString) throws IllegalArgumentException {
- // Split the paths and initialize the
- // file array 'srcPaths' from it
- if ("".equals(srcPathsAsString)) {
- this.srcPaths = new File[0];
- } else {
- final String[] s = srcPathsAsString.split(",");
- this.srcPaths = new File[s.length];
- for (int i = 0; i < this.srcPaths.length; i++) {
- this.srcPaths[i] = new File(s[i].trim());
- // The configured path must point to an existing directory
- if (!srcPaths[i].isDirectory()) {
- throw new IllegalArgumentException("Source path component " + srcPaths[i]
- + " not found or no directory");
- }
- }
-
- }
- }
-
- public void setUseBASE64(final boolean useBASE64) {
- this.useBASE64 = useBASE64;
- }
+ public void setUseBASE64(final boolean useBASE64) {
+ this.useBASE64 = useBASE64;
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionSyntaxException.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionSyntaxException.java
index e82fafe..1ec4261 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionSyntaxException.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/ProtectedRegionSyntaxException.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/package.html
new file mode 100644
index 0000000..12e6326
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Implementation of protected regions
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/BASE64.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/BASE64.java
index f517452..b283333 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/BASE64.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/BASE64.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr.util;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/FSIO.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/FSIO.java
index 7582ee3..909ce3c 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/FSIO.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/FSIO.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr.util;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/GenericFileFilter.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/GenericFileFilter.java
index 3fa484e..c42864c 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/GenericFileFilter.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/GenericFileFilter.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.pr.util;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/package.html
new file mode 100644
index 0000000..11fcbe6
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/pr/util/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Utility classes for protected regions
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/DefinitionType.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/DefinitionType.java
index 27f82c1..1500cba 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/DefinitionType.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/DefinitionType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.type;
@@ -56,7 +54,7 @@ public class DefinitionType extends AbstractTypeImpl {
return ((XpandDefinitionImpl) target).getParamNames();
}
},
- new OperationImpl(this, "proceed", getTypeSystem().getVoidType(), new Type[0]) {
+ new OperationImpl(this, "proceed", getTypeSystem().getVoidType()) {
@Override
protected Object evaluateInternal(final Object target, final Object[] params) {
@@ -74,7 +72,7 @@ public class DefinitionType extends AbstractTypeImpl {
return null;
}
- }, new OperationImpl(this, "toString", getTypeSystem().getStringType(), new Type[0]) {
+ }, new OperationImpl(this, "toString", getTypeSystem().getStringType()) {
@Override
protected Object evaluateInternal(final Object target, final Object[] params) {
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/IteratorType.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/IteratorType.java
index cd9b8d6..0c4b5a0 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/IteratorType.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/IteratorType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.type;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandDefinitionImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandDefinitionImpl.java
index 62c9ea7..4b13073 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandDefinitionImpl.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandDefinitionImpl.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.type;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandIterator.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandIterator.java
index cc23e5f..9783a30 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandIterator.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandIterator.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.type;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandTypesMetaModel.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandTypesMetaModel.java
index daf23d1..a8e9b92 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandTypesMetaModel.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/XpandTypesMetaModel.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.internal.xpand2.type;
@@ -28,54 +26,81 @@ public class XpandTypesMetaModel implements MetaModel {
private final Map<String, AbstractTypeImpl> types = new HashMap<String, AbstractTypeImpl>();
public XpandTypesMetaModel(final TypeSystem ts) {
- if (ts == null) {
+ if (ts == null)
throw new IllegalArgumentException("Typesystem must not be null!");
- }
typeSystem = ts;
types.put(DefinitionType.TYPE_NAME, new DefinitionType(ts));
types.put(IteratorType.TYPE_NAME, new IteratorType(ts));
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#getTypeSystem()
+ */
public TypeSystem getTypeSystem() {
return typeSystem;
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#setTypeSystem(org.eclipse.xtend.expression.TypeSystem)
+ */
public void setTypeSystem(final TypeSystem typeSystem) {
this.typeSystem = typeSystem;
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#getTypeForName(java.lang.String)
+ */
public Type getTypeForName(final String typeName) {
return types.get(typeName);
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#getType(java.lang.Object)
+ */
public Type getType(final Object obj) {
for (final Iterator<AbstractTypeImpl> iter = types.values().iterator(); iter.hasNext();) {
final Type t = iter.next();
- if (t.isInstance(obj)) {
+ if (t.isInstance(obj))
return t;
- }
}
return null;
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#getKnownTypes()
+ */
public Set<? extends Type> getKnownTypes() {
return new HashSet<AbstractTypeImpl>(types.values());
}
+ /**
+ * Returns the name of the metamodel.
+ *
+ * @return name of metamodel
+ */
public String getName() {
return "xpand";
}
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object arg0) {
return arg0 instanceof XpandTypesMetaModel;
}
+ /**
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
return 4711;
}
+ /**
+ * @see org.eclipse.xtend.typesystem.MetaModel#getNamespaces()
+ */
public Set<String> getNamespaces() {
return new HashSet<String>();
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/package.html
new file mode 100644
index 0000000..66d40c8
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/type/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Basic types of the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/Generator.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/Generator.java
index 68d3966..0adbb38 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/Generator.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/Generator.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
@@ -18,8 +16,9 @@ import java.io.OutputStream;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.eclipse.emf.mwe.core.ConfigurationException;
import org.eclipse.emf.mwe.core.WorkflowContext;
@@ -44,361 +43,467 @@ import org.eclipse.xtend.typesystem.MetaModel;
public class Generator extends AbstractExpressionsUsingWorkflowComponent {
- private String genPath = null;
+ private static final String COMPONENT_NAME = "Xpand Generator";
- private String srcPath = null;
+ private String genPath = null;
- private String prSrcPaths = null;
+ private String srcPath = null;
- private String prExcludes = null;
+ private String prSrcPaths = null;
- private boolean prDefaultExcludes = true;
+ private String prExcludes = null;
- private String expand = null;
+ private boolean prDefaultExcludes = true;
- private String fileEncoding = null;
+ private String expand = null;
- private List<?> beautifier = new ArrayList<Object>();
+ private String fileEncoding = null;
- private List<String> advices = new ArrayList<String>();
+ private List<?> beautifier = new ArrayList<Object>();
- private List<String> extensionAdvices = new ArrayList<String>();
-
- private boolean automaticHyphens = false;
-
- private ExceptionHandler exceptionHandler = null;
+ private final List<String> advices = new ArrayList<String>();
- private String collectProfileSummary = null;
- private String verboseProfileFilename = null;
-
- private Output output = null;
-
- public void setCollectProfileSummary (String c) {
- collectProfileSummary = c;
- }
-
- public void setVerboseProfileFilename (String f) {
- verboseProfileFilename = f;
- }
-
- public void setAutomaticHyphens(boolean automaticHyphens) {
- this.automaticHyphens = automaticHyphens;
- }
+ private final List<String> extensionAdvices = new ArrayList<String>();
- @Override
+ private boolean automaticHyphens = false;
+
+ private ExceptionHandler exceptionHandler = null;
+
+ private String collectProfileSummary = null;
+ private String verboseProfileFilename = null;
+
+ private Output output = null;
+
+ /**
+ * Sets the collection profile summary.
+ *
+ * @param summary
+ * the summary
+ */
+ public void setCollectProfileSummary(final String summary) {
+ collectProfileSummary = summary;
+ }
+
+ /**
+ * Sets the filename for verbose profile.
+ *
+ * @param fileName
+ * filename for verbose profile
+ */
+ public void setVerboseProfileFilename(final String fileName) {
+ verboseProfileFilename = fileName;
+ }
+
+ /**
+ * Enables or disables the automatic hyphenation. If automatic hyphenation
+ * is enabled, redundant blank lines are avoided automatically.
+ *
+ * @param automaticHyphens
+ * If <code>true</code>, automatic hyphenation is enabled,
+ * otherwise disabled.
+ */
+ public void setAutomaticHyphens(final boolean automaticHyphens) {
+ this.automaticHyphens = automaticHyphens;
+ }
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getLogMessage()
+ */
+ @Override
public String getLogMessage() {
- return "generating '"+expand+"' => directory '"+genPath+"'";
- }
-
- @Override
- public void addAdvices(final String advice) {
- if ( !this.advices.contains(advice) ) this.advices.add( advice );
- }
-
- @Override
- public void addAdvice(final String advice) {
- if ( !this.advices.contains(advice) ) this.advices.add( advice );
- }
-
- @Override
- public void addExtensionAdvices(String extensionAdvices) {
- if ( !this.extensionAdvices.contains(extensionAdvices) )
- this.extensionAdvices.add( extensionAdvices );
+ Set<String> outletDescriptions = new HashSet<String>();
+ for (Outlet outlet : outlets) {
+ outletDescriptions.add(outlet.toString());
+ }
+ String outletDesc = outletDescriptions.size() == 1 ? outletDescriptions.iterator().next() : outletDescriptions
+ .toString();
+ return "generating '" + expand + "' => " + outletDesc;
}
- @Override
- public void addExtensionAdvice(String extensionAdvice) {
- if ( !this.extensionAdvices.contains(extensionAdvice) )
- this.extensionAdvices.add( extensionAdvice );
+ /**
+ * Adds an advice.
+ *
+ * @param advice
+ * the advice
+ */
+ @Override
+ public void addAdvice(final String advice) {
+ if (!advices.contains(advice)) {
+ advices.add(advice);
+ }
}
- public List<?> getBeautifier() {
- return beautifier;
- }
+ /**
+ * Adds an extension advice.
+ *
+ * @param extensionAdvice
+ * the extension advice
+ */
+ @Override
+ public void addExtensionAdvice(final String extensionAdvice) {
+ if (!extensionAdvices.contains(extensionAdvice)) {
+ extensionAdvices.add(extensionAdvice);
+ }
+ }
- public void setBeautifier(final List<?> beautifiers) {
- beautifier = beautifiers;
- }
+ /**
+ * Returns the list of beatifiers that will be applied to the generated
+ * output.
+ *
+ * @return list of beautifiers
+ */
+ public List<?> getBeautifier() {
+ return beautifier;
+ }
- public void setFileEncoding(final String fileEncoding) {
- this.fileEncoding = fileEncoding;
- }
-
+ /**
+ * Sets the list of beatifiers that will be applied to the generated output.
+ *
+ * @param beautifiers
+ * list of beautifiera
+ */
+ public void setBeautifier(final List<?> beautifiers) {
+ beautifier = beautifiers;
+ }
+
+ /**
+ * Sets the character encoding used for the output file.
+ *
+ * @param fileEncoding
+ * name of character encoding
+ */
+ public void setFileEncoding(final String fileEncoding) {
+ this.fileEncoding = fileEncoding;
+ }
+
+ /**
+ * Returns the name of character encoding used for the output file.
+ *
+ * @return name of character encoding
+ */
public String getFileEncoding() {
return fileEncoding;
}
- /**
- *
- * @deprecated use outlets instead
- */
- @Deprecated
- public void setGenPath(final String genPath) {
- this.genPath = fixPath(genPath);
- }
-
- public void setExpand(final String invoke) {
- expand = invoke;
- }
-
- public void setPrDefaultExcludes(final boolean prDefaultExcludes) {
- this.prDefaultExcludes = prDefaultExcludes;
- }
-
- public void setPrExcludes(final String prExcludes) {
- this.prExcludes = prExcludes;
- }
-
- public void setPrSrcPaths(final String prSrcPathes) {
- this.prSrcPaths = prSrcPathes;
- }
-
- public void setExceptionHandler(final ExceptionHandler exceptionHandler) {
- this.exceptionHandler = exceptionHandler;
+ /**
+ *
+ * @deprecated use outlets instead
+ */
+ @Deprecated
+ public void setGenPath(final String genPath) {
+ this.genPath = fixPath(genPath);
}
/**
- *
- * @deprecated use outlets instead
- */
- @Deprecated
- public void setSrcPath(final String srcPath) {
- this.srcPath = fixPath(srcPath);
- }
-
- private String fixPath(final String p) {
- if (p.endsWith("\\"))
- return p.replace('\\', '/');
- if (p.endsWith("/"))
- return p;
- return p + "/";
- }
-
- @Override
- protected void invokeInternal2(final WorkflowContext ctx, final ProgressMonitor monitor, final Issues issues) {
- OutputStream verboseProfileOutputStream = null;
-
- if (verboseProfileFilename != null) {
- try {
- verboseProfileOutputStream = new BufferedOutputStream (new FileOutputStream (verboseProfileFilename));
- ProfileCollector.getInstance().setDetailedLoggingWriter(verboseProfileOutputStream);
- }
- catch (IOException exc) {
- log.warn("could nto open profiling log file", exc);
- }
- }
-
- final Output out = getOutput();
- final List<Outlet> outlets = getInitializedOutlets();
- for (final Iterator<Outlet> iter = outlets.iterator(); iter.hasNext();) {
- out.addOutlet(iter.next());
- }
-
- ProtectedRegionResolverImpl prs = null;
- if (prSrcPaths != null) {
- prs = new ProtectedRegionResolverImpl();
- prs.setDefaultExcludes(prDefaultExcludes);
- prs.setIgnoreList(prExcludes);
- prs.setSrcPathes(prSrcPaths);
- prs.setFileEncoding(fileEncoding);
- }
-
- XpandExecutionContextImpl executionContext = new XpandExecutionContextImpl(out, prs, getGlobalVars(ctx), exceptionHandler,getNullEvaluationHandler());
- if (monitor!=null) {
- executionContext.setMonitor(monitor);
- }
-
-
- if (fileEncoding != null) {
- executionContext.setFileEncoding(fileEncoding);
- }
-
- for (MetaModel mm : metaModels) {
- executionContext.registerMetaModel(mm);
- }
-
- final ExpandStatement es = getStatement();
- if (es == null)
- throw new ConfigurationException("property 'expand' has wrong syntax!");
-
- final String[] names = ctx.getSlotNames();
- for (int i = 0; i < names.length; i++) {
- final String name = names[i];
- executionContext = (XpandExecutionContextImpl) executionContext.cloneWithVariable(new Variable(name, ctx
- .get(name)));
- }
-
- for (String advice : advices) {
- final String[] allAdvices = advice.split(",");
- for (int i = 0; i < allAdvices.length; i++) {
- final String string = allAdvices[i];
- executionContext.registerAdvices(string.trim());
- }
+ * Sets the statement that is to expand by the generator.
+ *
+ * @param invoke
+ * statement to expand
+ */
+ public void setExpand(final String invoke) {
+ expand = invoke;
+ }
+
+ /**
+ * Enables oder disables the default excludes for protected regions.
+ *
+ * @param prDefaultExcludes
+ * If <code>true</code>, the default excludes are enabled,
+ * otherwise disabled.
+ */
+ public void setPrDefaultExcludes(final boolean prDefaultExcludes) {
+ this.prDefaultExcludes = prDefaultExcludes;
+ }
+
+ /**
+ * Sets the additional excludes for protected regions.
+ *
+ * @param prExcludes
+ * the excludes
+ */
+ public void setPrExcludes(final String prExcludes) {
+ this.prExcludes = prExcludes;
+ }
+
+ /**
+ * Sets the source paths for protected regions.
+ *
+ * @param prSrcPathes
+ * the source paths
+ */
+ public void setPrSrcPaths(final String prSrcPathes) {
+ this.prSrcPaths = prSrcPathes;
+ }
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
+
+ /**
+ *
+ * @deprecated use outlets instead
+ */
+ @Deprecated
+ public void setSrcPath(final String srcPath) {
+ this.srcPath = fixPath(srcPath);
+ }
+
+ private String fixPath(final String p) {
+ if (p.endsWith("\\"))
+ return p.replace('\\', '/');
+ if (p.endsWith("/"))
+ return p;
+ return p + "/";
+ }
+
+ @Override
+ protected void invokeInternal2(final WorkflowContext ctx, final ProgressMonitor monitor, final Issues issues) {
+ OutputStream verboseProfileOutputStream = null;
+
+ if (verboseProfileFilename != null) {
+ try {
+ verboseProfileOutputStream = new BufferedOutputStream(new FileOutputStream(verboseProfileFilename));
+ ProfileCollector.getInstance().setDetailedLoggingWriter(verboseProfileOutputStream);
+ }
+ catch (final IOException exc) {
+ log.warn("Could not open profiling log file", exc);
+ }
+ }
+
+ final Output out = getOutput();
+ final List<Outlet> outlets = getInitializedOutlets();
+ for (final Outlet outlet : outlets) {
+ out.addOutlet(outlet);
+ }
+
+ ProtectedRegionResolverImpl prs = null;
+ if (prSrcPaths != null) {
+ prs = new ProtectedRegionResolverImpl();
+ prs.setDefaultExcludes(prDefaultExcludes);
+ prs.setIgnoreList(prExcludes);
+ prs.setSrcPathes(prSrcPaths);
+ prs.setFileEncoding(fileEncoding);
+ }
+
+ XpandExecutionContextImpl executionContext = new XpandExecutionContextImpl(out, prs, getGlobalVars(ctx),
+ exceptionHandler, getNullEvaluationHandler());
+ if (monitor != null) {
+ executionContext.setMonitor(monitor);
+ }
+ executionContext.setResourceManager(getResourceManager());
+ if (callback != null) {
+ executionContext.setCallBack(callback);
+ }
+
+ if (fileEncoding != null) {
+ executionContext.setFileEncoding(fileEncoding);
}
-
- for (String advice : extensionAdvices) {
- final String[] allAdvices = advice.split(",");
- for (int i = 0; i < allAdvices.length; i++) {
- final String string = allAdvices[i];
- executionContext.registerExtensionAdvices(string.trim());
- }
- }
-
- es.evaluate(executionContext);
-
- for (final Iterator<Outlet> iter = outlets.iterator(); iter.hasNext();) {
- final Outlet element = iter.next();
- final String name = (element.getName() == null ? "[default]" : element.getName()) + "(" + element.getPath()
- + ")";
- if (element.getFilesWrittenAndClosed() > 0) {
- log.info("Written " + element.getFilesWrittenAndClosed() + " files to outlet " + name);
- }
- if (element.getFilesCreated() > element.getFilesWrittenAndClosed()) {
- log.info("Skipped writing of " + (element.getFilesCreated() - element.getFilesWrittenAndClosed())
- + " files to outlet " + name);
- }
- }
-
- ProfileCollector.getInstance().finish();
- if ("true".equalsIgnoreCase(this.collectProfileSummary)) {
- log.info ("profiling info: \n" + ProfileCollector.getInstance().toString());
- }
-
- if (verboseProfileOutputStream != null) {
- try {
- verboseProfileOutputStream.close ();
- }
- catch (IOException exc) {
- log.warn("problem closing profile log file", exc);
- }
- }
- }
-
- private final List<Outlet> outlets = new ArrayList<Outlet>();
-
- public void addOutlet(final Outlet outlet) {
- outlets.add(outlet);
- }
-
- public void setOutput (final Output output) {
- this.output = output;
- }
-
- private Output getOutput () {
- if (output==null) {
- // lazy initialization
- OutputImpl out = new OutputImpl();
- out.setAutomaticHyphens(automaticHyphens);
- this.output = out;
- }
- return output;
- }
-
- private List<Outlet> initializedOutlets = null;
-
- private List<Outlet> getInitializedOutlets() {
- if (initializedOutlets == null) {
- final List<Outlet> result = new ArrayList<Outlet>(outlets);
- if (result.isEmpty()) {
- if (genPath != null) { // backward compatibility
- Outlet o = new Outlet();
- o.setAppend(false);
- o.setFileEncoding(fileEncoding);
- o.setOverwrite(true);
- o.setPath(genPath);
- result.add(o);
-
- o = new Outlet();
- o.setAppend(true);
- o.setFileEncoding(fileEncoding);
- o.setName("APPEND");
- o.setOverwrite(true);
- o.setPath(genPath);
- result.add(o);
- }
- if (srcPath != null) {
- final Outlet o = new Outlet();
- o.setAppend(false);
- o.setFileEncoding(fileEncoding);
- o.setName("ONCE");
- o.setOverwrite(false);
- o.setPath(srcPath);
-
- result.add(o);
- }
- }
- for (final Iterator<Outlet> iter = result.iterator(); iter.hasNext();) {
- final Outlet o = iter.next();
- if (o.postprocessors.isEmpty()) {
- for (final Iterator<?> iterator = beautifier.iterator(); iterator.hasNext();) {
- final PostProcessor element = (PostProcessor) iterator.next();
- o.addPostprocessor(element);
- }
- }
- // Initialize file encoding for outlets. If it is not set then take the Generator
- // default encoding. If this not set also then take System default.
- if (o.hasDefaultEncoding() && fileEncoding!=null) {
- o.setFileEncoding(fileEncoding);
- }
- }
- initializedOutlets = result;
- }
- return initializedOutlets;
- }
-
- /**
- * Retrieves the configured and initialized outlets of the generator.
- * @since 4.2
- */
- public final List<Outlet> getOutlets () {
- return Collections.unmodifiableList(getInitializedOutlets());
- }
-
- private ExpandStatement getStatement() {
- Template tpl = XpandParseFacade.file(new StringReader(XpandTokens.LT + "DEFINE test FOR test" + XpandTokens.RT
- + XpandTokens.LT + "EXPAND " + expand + XpandTokens.RT + XpandTokens.LT + "ENDDEFINE" + XpandTokens.RT),null);
- ExpandStatement es = null;
- try {
- es = (ExpandStatement) ((Definition) tpl.getDefinitions()[0]).getBody()[1];
- } catch (final Exception e) {
- log.error(e);
- }
- return es;
- }
-
- @Override
- public void checkConfiguration(final Issues issues) {
- super.checkConfiguration(issues);
- if (genPath == null && getInitializedOutlets().isEmpty()) {
- issues.addError(this, "You need to configure at least one outlet!");
- }
- if ((genPath != null || srcPath != null) && !outlets.isEmpty()) {
- issues.addWarning(this, "'genPath' and 'srcPath' properties are ignored since you have specified outlets!");
- }
- int defaultOutlets = 0;
- for (final Iterator<Outlet> iter = getInitializedOutlets().iterator(); iter.hasNext();) {
- final Outlet o = iter.next();
- if (o.getName() == null)
- defaultOutlets++;
- }
- if (defaultOutlets > 1) {
- issues.addError(this,
- "Only one outlet can be the default outlet. Please specifiy a name for the other outlets!");
- } else if (defaultOutlets == 0) {
- issues.addWarning(this, "No default outlet configured!");
- }
- if (expand == null) {
- issues.addError(this, "property 'expand' not configured!");
- } else {
- try {
+
+ for (final MetaModel mm : metaModels) {
+ executionContext.registerMetaModel(mm);
+ }
+
+ final ExpandStatement es = getStatement();
+ if (es == null)
+ throw new ConfigurationException("property 'expand' has wrong syntax!");
+
+ final String[] names = ctx.getSlotNames();
+ for (final String name : names) {
+ executionContext = (XpandExecutionContextImpl) executionContext.cloneWithVariable(new Variable(name, ctx
+ .get(name)));
+ }
+
+ for (final String advice : advices) {
+ final String[] allAdvices = advice.split(",");
+ for (final String string : allAdvices) {
+ executionContext.registerAdvices(string.trim());
+ }
+ }
+
+ for (final String advice : extensionAdvices) {
+ final String[] allAdvices = advice.split(",");
+ for (final String string : allAdvices) {
+ executionContext.registerExtensionAdvices(string.trim());
+ }
+ }
+
+ es.evaluate(executionContext);
+
+ for (final Outlet element : outlets) {
+ final String name = (element.getName() == null ? "[default]" : element.getName()) + "(" + element.getPath()
+ + ")";
+ if (element.getFilesWrittenAndClosed() > 0) {
+ log.info("Written " + element.getFilesWrittenAndClosed() + " files to outlet " + name);
+ }
+ if (element.getFilesCreated() > element.getFilesWrittenAndClosed()) {
+ log.info("Skipped writing of " + (element.getFilesCreated() - element.getFilesWrittenAndClosed())
+ + " files to outlet " + name);
+ }
+ }
+
+ ProfileCollector.getInstance().finish();
+ if ("true".equalsIgnoreCase(this.collectProfileSummary)) {
+ log.info("profiling info: \n" + ProfileCollector.getInstance().toString());
+ }
+
+ if (verboseProfileOutputStream != null) {
+ try {
+ verboseProfileOutputStream.close();
+ }
+ catch (final IOException exc) {
+ log.warn("problem closing profile log file", exc);
+ }
+ }
+ }
+
+ private final List<Outlet> outlets = new ArrayList<Outlet>();
+
+ /**
+ * Adds an outlet.
+ *
+ * @param outlet
+ * the outlet
+ */
+ public void addOutlet(final Outlet outlet) {
+ outlets.add(outlet);
+ }
+
+ /**
+ * Sets the output.
+ *
+ * @param output
+ * the output
+ */
+ public void setOutput(final Output output) {
+ this.output = output;
+ }
+
+ private Output getOutput() {
+ if (output == null) {
+ // lazy initialization
+ final OutputImpl out = new OutputImpl();
+ out.setAutomaticHyphens(automaticHyphens);
+ this.output = out;
+ }
+ return output;
+ }
+
+ private List<Outlet> initializedOutlets = null;
+
+ private List<Outlet> getInitializedOutlets() {
+ if (initializedOutlets == null) {
+ final List<Outlet> result = new ArrayList<Outlet>(outlets);
+ if (result.isEmpty()) {
+ if (genPath != null) { // backward compatibility
+ Outlet o = new Outlet();
+ o.setAppend(false);
+ o.setFileEncoding(fileEncoding);
+ o.setOverwrite(true);
+ o.setPath(genPath);
+ result.add(o);
+
+ o = new Outlet();
+ o.setAppend(true);
+ o.setFileEncoding(fileEncoding);
+ o.setName("APPEND");
+ o.setOverwrite(true);
+ o.setPath(genPath);
+ result.add(o);
+ }
+ if (srcPath != null) {
+ final Outlet o = new Outlet();
+ o.setAppend(false);
+ o.setFileEncoding(fileEncoding);
+ o.setName("ONCE");
+ o.setOverwrite(false);
+ o.setPath(srcPath);
+
+ result.add(o);
+ }
+ }
+ for (final Outlet o : result) {
+ if (o.postprocessors.isEmpty()) {
+ for (final Object name : beautifier) {
+ final PostProcessor element = (PostProcessor) name;
+ o.addPostprocessor(element);
+ }
+ }
+ // Initialize file encoding for outlets. If it is not set then
+ // take the Generator
+ // default encoding. If this not set also then take System
+ // default.
+ if (o.hasDefaultEncoding() && fileEncoding != null) {
+ o.setFileEncoding(fileEncoding);
+ }
+ }
+ initializedOutlets = result;
+ }
+ return initializedOutlets;
+ }
+
+ /**
+ * Retrieves the configured and initialized outlets of the generator.
+ *
+ * @since 4.2
+ */
+ public final List<Outlet> getOutlets() {
+ return Collections.unmodifiableList(getInitializedOutlets());
+ }
+
+ private ExpandStatement getStatement() {
+ final Template tpl = XpandParseFacade.file(new StringReader(XpandTokens.LT + "DEFINE test FOR test"
+ + XpandTokens.RT + XpandTokens.LT + "EXPAND " + expand + XpandTokens.RT + XpandTokens.LT + "ENDDEFINE"
+ + XpandTokens.RT), null);
+ ExpandStatement es = null;
+ try {
+ es = (ExpandStatement) ((Definition) tpl.getDefinitions()[0]).getBody()[1];
+ }
+ catch (final Exception e) {
+ log.error(e);
+ }
+ return es;
+ }
+
+ @Override
+ protected void checkConfigurationInternal(final Issues issues) {
+ super.checkConfigurationInternal(issues);
+ if (genPath == null && getInitializedOutlets().isEmpty()) {
+ issues.addError(this, "You need to configure at least one outlet!");
+ }
+ if ((genPath != null || srcPath != null) && !outlets.isEmpty()) {
+ issues.addWarning(this, "'genPath' and 'srcPath' properties are ignored since you have specified outlets!");
+ }
+ int defaultOutlets = 0;
+ for (final Outlet o : getInitializedOutlets()) {
+ if (o.getName() == null) {
+ defaultOutlets++;
+ }
+ }
+ if (defaultOutlets > 1) {
+ issues.addError(this,
+ "Only one outlet can be the default outlet. Please specifiy a name for the other outlets!");
+ }
+ else if (defaultOutlets == 0) {
+ issues.addWarning(this, "No default outlet configured!");
+ }
+ if (expand == null) {
+ issues.addError(this, "property 'expand' not configured!");
+ }
+ else {
+ try {
final ExpandStatement es = getStatement();
if (es == null) {
issues.addError(this, "property 'expand' has wrong syntax!");
}
- } catch (ParseException e) {
- issues.addError(this, "property 'expand' has wrong syntax : "+e.getMessage());
}
- }
- }
+ catch (final ParseException e) {
+ issues.addError(this, "property 'expand' has wrong syntax : " + e.getMessage());
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/GeneratorAdvice.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/GeneratorAdvice.java
index d93d9aa..b4eec05 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/GeneratorAdvice.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/GeneratorAdvice.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/NoSuchTemplateException.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/NoSuchTemplateException.java
index c92e24a..5128749 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/NoSuchTemplateException.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/NoSuchTemplateException.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandCompilerIssue.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandCompilerIssue.java
index 65eb492..823d9d8 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandCompilerIssue.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandCompilerIssue.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContext.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContext.java
index 3204649..3b65c90 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContext.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContext.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContextImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContextImpl.java
index 5c552c5..efe8bd6 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContextImpl.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandExecutionContextImpl.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
@@ -35,6 +33,7 @@ import org.eclipse.internal.xtend.type.baseimpl.PolymorphicResolver;
import org.eclipse.internal.xtend.xtend.ast.Around;
import org.eclipse.internal.xtend.xtend.ast.Extension;
import org.eclipse.xpand2.output.Output;
+import org.eclipse.xtend.expression.Callback;
import org.eclipse.xtend.expression.ExceptionHandler;
import org.eclipse.xtend.expression.ExecutionContextImpl;
import org.eclipse.xtend.expression.NullEvaluationHandler;
@@ -54,67 +53,83 @@ import org.eclipse.xtend.typesystem.Type;
*/
public class XpandExecutionContextImpl extends ExecutionContextImpl implements XpandExecutionContext {
- private final Log log = LogFactory.getLog(getClass());
-
- protected final Output output;
-
- protected final ProtectedRegionResolver protectedRegionResolver;
-
- private List<XpandAdvice> registeredAdvices = new ArrayList<XpandAdvice>();
-
- public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs) {
- this (output, prs, null, null, null);
- }
-
- public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs, Map<String, Variable> globalVars, ExceptionHandler exceptionHandler, NullEvaluationHandler nullEvaluationHandler) {
- this(new TypeSystemImpl(), output, prs, globalVars, exceptionHandler, nullEvaluationHandler);
- }
-
- protected XpandExecutionContextImpl(final TypeSystemImpl ts, Output output, ProtectedRegionResolver prs, Map<String, Variable> globalVars, ExceptionHandler exceptionHandler, NullEvaluationHandler nullEvaluationHandler) {
- super(ts, globalVars);
- registerMetaModel(new XpandTypesMetaModel(this));
- resourceManager.registerParser(XpandUtil.TEMPLATE_EXTENSION, new ResourceParser() {
+ private final Log log = LogFactory.getLog(getClass());
+
+ protected final Output output;
+
+ protected final ProtectedRegionResolver protectedRegionResolver;
+
+ private List<XpandAdvice> registeredAdvices = new ArrayList<XpandAdvice>();
+
+ public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs) {
+ this(output, prs, null, null, null);
+ }
+
+ public XpandExecutionContextImpl(Output output, ProtectedRegionResolver prs, Map<String, Variable> globalVars,
+ ExceptionHandler exceptionHandler, NullEvaluationHandler nullEvaluationHandler) {
+ this(new TypeSystemImpl(), output, prs, globalVars, exceptionHandler, nullEvaluationHandler);
+ }
+
+ protected XpandExecutionContextImpl(final TypeSystemImpl ts, Output output, ProtectedRegionResolver prs,
+ Map<String, Variable> globalVars, ExceptionHandler exceptionHandler,
+ NullEvaluationHandler nullEvaluationHandler) {
+ super(ts, globalVars);
+ registerMetaModel(new XpandTypesMetaModel(this));
+ registerParser(resourceManager);
+ this.output = output;
+ this.protectedRegionResolver = prs;
+ this.exceptionHandler = exceptionHandler;
+ this.nullEvaluationHandler = nullEvaluationHandler;
+ }
+
+ private void registerParser(ResourceManager resourceManager) {
+ resourceManager.registerParser(XpandUtil.TEMPLATE_EXTENSION, new ResourceParser() {
public Resource parse(Reader in, String fileName) {
return XpandParseFacade.file(in, fileName);
- }});
- this.output = output;
- this.protectedRegionResolver = prs;
- this.exceptionHandler = exceptionHandler;
- this.nullEvaluationHandler = nullEvaluationHandler;
- }
-
-
- protected XpandExecutionContextImpl (ResourceManager resourceManager, Resource currentResource, TypeSystemImpl typeSystem, Map<String, Variable> vars,
- Map<String, Variable> globalVars, Output output, ProtectedRegionResolver protectedRegionResolver, ProgressMonitor monitor, ExceptionHandler exceptionHandler,List<Around> advices, NullEvaluationHandler nullEvaluationHandler, Map<Resource, Set<Extension>> allExtensionsPerResource) {
- super (resourceManager, currentResource, typeSystem, vars, globalVars, monitor, exceptionHandler,advices, nullEvaluationHandler,allExtensionsPerResource);
- registerMetaModel(new XpandTypesMetaModel(this));
- this.output = output;
- this.protectedRegionResolver = protectedRegionResolver;
- this.exceptionHandler = exceptionHandler;
- }
-
-
-
- @Override
- public XpandExecutionContextImpl cloneContext() {
- final XpandExecutionContextImpl result = new XpandExecutionContextImpl (resourceManager, currentResource(), typeSystem, getVisibleVariables(), getGlobalVariables(), output,
- protectedRegionResolver, getMonitor(), exceptionHandler,registeredExtensionAdvices, nullEvaluationHandler,allExtensionsPerResource);
- result.registeredAdvices.addAll(registeredAdvices); //todo: [aha] before I refactored, there was an assignment in this place. Is this modification correct?
- return result;
- }
-
- public List<XpandDefinition> getAllDefinitions() {
- XpandResource tpl = null;
- tpl = (XpandResource) currentResource();
- if (tpl == null)
- return null;
-
- XpandDefinition[] localDefinitions = tpl.getDefinitions();
-
- List<XpandDefinition> advicedDefinitions = new ArrayList<XpandDefinition>(localDefinitions.length);
-
- for (int i = 0; i < localDefinitions.length; i++) {
+ }
+ });
+ }
+
+ protected XpandExecutionContextImpl(ResourceManager resourceManager, Resource currentResource,
+ TypeSystemImpl typeSystem, Map<String, Variable> vars, Map<String, Variable> globalVars, Output output,
+ ProtectedRegionResolver protectedRegionResolver, ProgressMonitor monitor,
+ ExceptionHandler exceptionHandler, List<Around> advices, NullEvaluationHandler nullEvaluationHandler,
+ Map<Resource, Set<Extension>> allExtensionsPerResource, Callback callback) {
+ super(resourceManager, currentResource, typeSystem, vars, globalVars, monitor, exceptionHandler, advices,
+ nullEvaluationHandler, allExtensionsPerResource, callback);
+ registerMetaModel(new XpandTypesMetaModel(this));
+ this.output = output;
+ this.protectedRegionResolver = protectedRegionResolver;
+ this.exceptionHandler = exceptionHandler;
+ }
+
+ @Override
+ public XpandExecutionContextImpl cloneContext() {
+ final XpandExecutionContextImpl result = new XpandExecutionContextImpl(resourceManager, currentResource(),
+ typeSystem, getVisibleVariables(), getGlobalVariables(), output, protectedRegionResolver, getMonitor(),
+ exceptionHandler, registeredExtensionAdvices, nullEvaluationHandler, allExtensionsPerResource, callback);
+ result.registeredAdvices.addAll(registeredAdvices); // todo: [aha]
+ // before I
+ // refactored, there
+ // was an assignment
+ // in this place. Is
+ // this modification
+ // correct?
+ return result;
+ }
+
+ public List<XpandDefinition> getAllDefinitions() {
+ XpandResource tpl = null;
+ tpl = (XpandResource) currentResource();
+ if (tpl == null)
+ return null;
+
+ XpandDefinition[] localDefinitions = tpl.getDefinitions();
+
+ List<XpandDefinition> advicedDefinitions = new ArrayList<XpandDefinition>(localDefinitions.length);
+
+ for (int i = 0; i < localDefinitions.length; i++) {
XpandDefinition xpandDefinition = localDefinitions[i];
for (int x = registeredAdvices.size() - 1; x >= 0; x--) {
final XpandAdvice adv = registeredAdvices.get(x);
@@ -124,164 +139,177 @@ public class XpandExecutionContextImpl extends ExecutionContextImpl implements X
}
advicedDefinitions.add(xpandDefinition);
}
-
- return advicedDefinitions;
-
- }
-
- public XpandDefinition findDefinition(final String name, final Type target, final Type[] paramTypes) {
- XpandResource tpl = null;
- if (name.indexOf(SyntaxConstants.NS_DELIM) != -1) { // local call
- tpl = findTemplate(XpandUtil.withoutLastSegment(name));
- } else {
- tpl = (XpandResource) currentResource();
- }
- if (tpl == null)
- return null;
- final XpandExecutionContext ctx = (XpandExecutionContext) cloneWithResource(tpl);
- XpandDefinition def = findDefinition(tpl.getDefinitions(), name, target, paramTypes, ctx);
- for (int x = registeredAdvices.size() - 1; x >= 0; x--) {
- final XpandAdvice adv = registeredAdvices.get(x);
- if (adv.matches(def, this)) {
- def = new AdvicedDefinition(adv, def);
- }
- }
- return def;
- }
-
- public void registerAdvices(final String fullyQualifiedName) {
- final XpandResource tpl = findTemplate(fullyQualifiedName);
- if (tpl == null)
- throw new NoSuchTemplateException(fullyQualifiedName);
- final XpandAdvice[] as = tpl.getAdvices();
- for (int i = 0; i < as.length; i++) {
- final XpandAdvice advice = as[i];
- if (registeredAdvices.contains(advice)) {
- log.warn("advice " + advice.toString() + " already registered!");
- } else {
- registeredAdvices.add(advice);
- }
- }
- }
-
- public ProtectedRegionResolver getProtectedRegionResolver() {
- return protectedRegionResolver;
- }
-
- public Output getOutput() {
- return output;
- }
-
- public XpandResource findTemplate(final String templateName) {
- return findTemplate(templateName, getImportedNamespaces());
- }
-
- public XpandResource findTemplate(final String templateName, String[] importedNs) {
- final List<?> possibleNames = typeSystem.getPossibleNames(templateName, importedNs);
- for (final Iterator<?> iter = possibleNames.iterator(); iter.hasNext();) {
- final String element = (String) iter.next();
- final XpandResource tpl = (XpandResource) resourceManager.loadResource(element,
- XpandUtil.TEMPLATE_EXTENSION);
- if (tpl != null)
- return tpl;
- }
- return null;
- }
-
- /**
- * resolves the correct definition (using parametric polymorphism)
- *
- * @param definitions
- * @param target
- * @param paramTypes
- * @return
- */
- private XpandDefinition findDefinition(final XpandDefinition[] definitions, final String name, final Type target,
- Type[] paramTypes, final XpandExecutionContext ctx) {
- if (paramTypes == null) {
- paramTypes = new Type[0];
- }
- final Set<Callable> features = new HashSet<Callable>();
- for (int i = 0; i < definitions.length; i++) {
- final XpandDefinition def = definitions[i];
- if (def.getParams().length == paramTypes.length) {
- final List<Type> defsParamTypes = new ArrayList<Type>();
- Type t = null;
- boolean complete = true;
- for (int j = 0; j < paramTypes.length && complete; j++) {
- t = ctx.getTypeForName(def.getParams()[j].getType().getValue());
- if (t == null) {
- complete = false;
- }
- defsParamTypes.add(t);
- }
- t = ctx.getTypeForName(def.getTargetType());
- if (t == null) {
- complete = false;
- }
- if (complete) {
- features.add(new DefinitionOperationAdapter(def, def.getName(), t, defsParamTypes));
- }
- }
- }
- final DefinitionOperationAdapter defAdapter = (DefinitionOperationAdapter) PolymorphicResolver.getOperation(
- features, XpandUtil.getLastSegment(name), target, Arrays.asList(paramTypes));
- if (defAdapter != null)
- return defAdapter.def;
- return null;
- }
-
- public class DefinitionOperationAdapter implements Operation {
-
- private String name;
-
- private Type owner;
-
- private List<Type> paramTypes;
-
- public XpandDefinition def;
-
- public DefinitionOperationAdapter(final XpandDefinition def, final String name, final Type owner,
- final List<Type> paramTypes) {
- this.name = name;
- this.owner = owner;
- this.paramTypes = paramTypes;
- this.def = def;
- }
-
- public String getName() {
- return name;
- }
-
- public Type getReturnType() {
- throw new UnsupportedOperationException();
- }
-
- public Type getOwner() {
- return owner;
- }
-
- public List<Type> getParameterTypes() {
- return paramTypes;
- }
-
- public Object evaluate(final Object target, final Object[] params) {
- throw new UnsupportedOperationException();
- }
-
- public String getDocumentation() {
- return "Xpand definition " + getName() + " adapted in an Operation";
- }
-
- public Type getReturnType(final Type targetType, final Type[] paramTpes) {
- return getReturnType();
- }
-
- }
-
- @Override
- public void setFileEncoding(final String fileEncoding) {
- resourceManager.setFileEncoding(fileEncoding); //TODO: make this immutable - the entire context should be immutable!
- }
+ return advicedDefinitions;
+
+ }
+
+ public XpandDefinition findDefinition(final String name, final Type target, final Type[] paramTypes) {
+ XpandResource tpl = null;
+ if (name.indexOf(SyntaxConstants.NS_DELIM) != -1) { // local call
+ tpl = findTemplate(XpandUtil.withoutLastSegment(name));
+ }
+ else {
+ tpl = (XpandResource) currentResource();
+ }
+ if (tpl == null)
+ return null;
+ final XpandExecutionContext ctx = (XpandExecutionContext) cloneWithResource(tpl);
+ XpandDefinition def = findDefinition(tpl.getDefinitions(), name, target, paramTypes, ctx);
+ for (int x = registeredAdvices.size() - 1; x >= 0; x--) {
+ final XpandAdvice adv = registeredAdvices.get(x);
+ if (adv.matches(def, this)) {
+ def = new AdvicedDefinition(adv, def);
+ }
+ }
+ return def;
+ }
+
+ public void registerAdvices(final String fullyQualifiedName) {
+ final XpandResource tpl = findTemplate(fullyQualifiedName);
+ if (tpl == null)
+ throw new NoSuchTemplateException(fullyQualifiedName);
+ final XpandAdvice[] as = tpl.getAdvices();
+ for (int i = 0; i < as.length; i++) {
+ final XpandAdvice advice = as[i];
+ if (registeredAdvices.contains(advice)) {
+ log.warn("advice " + advice.toString() + " allready registered!");
+ }
+ else {
+ registeredAdvices.add(advice);
+ }
+ }
+ }
+
+ public ProtectedRegionResolver getProtectedRegionResolver() {
+ return protectedRegionResolver;
+ }
+
+ public Output getOutput() {
+ return output;
+ }
+
+ public XpandResource findTemplate(final String templateName) {
+ return findTemplate(templateName, getImportedNamespaces());
+ }
+
+ public XpandResource findTemplate(final String templateName, String[] importedNs) {
+ final List<?> possibleNames = typeSystem.getPossibleNames(templateName, importedNs);
+ for (final Iterator<?> iter = possibleNames.iterator(); iter.hasNext();) {
+ final String element = (String) iter.next();
+ final XpandResource tpl = (XpandResource) resourceManager.loadResource(element,
+ XpandUtil.TEMPLATE_EXTENSION);
+ if (tpl != null)
+ return tpl;
+ }
+ return null;
+ }
+
+ /**
+ * resolves the correct definition (using parametric polymorphism)
+ *
+ * @param definitions
+ * @param target
+ * @param paramTypes
+ * @return
+ */
+ private XpandDefinition findDefinition(final XpandDefinition[] definitions, final String name, final Type target,
+ Type[] paramTypes, final XpandExecutionContext ctx) {
+ if (paramTypes == null) {
+ paramTypes = new Type[0];
+ }
+ final Set<Callable> features = new HashSet<Callable>();
+ for (int i = 0; i < definitions.length; i++) {
+ final XpandDefinition def = definitions[i];
+ if (def.getParams().length == paramTypes.length) {
+ final List<Type> defsParamTypes = new ArrayList<Type>();
+ Type t = null;
+ boolean complete = true;
+ for (int j = 0; j < paramTypes.length && complete; j++) {
+ t = ctx.getTypeForName(def.getParams()[j].getType().getValue());
+ if (t == null) {
+ complete = false;
+ }
+ defsParamTypes.add(t);
+ }
+ t = ctx.getTypeForName(def.getTargetType());
+ if (t == null) {
+ complete = false;
+ }
+ if (complete) {
+ features.add(new DefinitionOperationAdapter(def, def.getName(), t, defsParamTypes));
+ }
+ }
+ }
+ final DefinitionOperationAdapter defAdapter = (DefinitionOperationAdapter) PolymorphicResolver.getOperation(
+ features, XpandUtil.getLastSegment(name), target, Arrays.asList(paramTypes));
+ if (defAdapter != null)
+ return defAdapter.def;
+ return null;
+ }
+
+ public class DefinitionOperationAdapter implements Operation {
+
+ private String name;
+
+ private Type owner;
+
+ private List<Type> paramTypes;
+
+ public XpandDefinition def;
+
+ public DefinitionOperationAdapter(final XpandDefinition def, final String name, final Type owner,
+ final List<Type> paramTypes) {
+ this.name = name;
+ this.owner = owner;
+ this.paramTypes = paramTypes;
+ this.def = def;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Type getReturnType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getOwner() {
+ return owner;
+ }
+
+ public List<Type> getParameterTypes() {
+ return paramTypes;
+ }
+
+ public Object evaluate(final Object target, final Object[] params) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDocumentation() {
+ return "Xpand definition " + getName() + " adapted in an Operation";
+ }
+
+ public Type getReturnType(final Type targetType, final Type[] paramTpes) {
+ return getReturnType();
+ }
+
+ }
+
+ @Override
+ public void setFileEncoding(final String fileEncoding) {
+ resourceManager.setFileEncoding(fileEncoding); // TODO: make this
+ // immutable - the
+ // entire context should
+ // be immutable!
+ }
+
+ public void setResourceManager(ResourceManager resourceManager) {
+ registerParser(resourceManager);
+ this.resourceManager = resourceManager;
+ }
+
+ public void setCallBack(Callback callback) {
+ this.callback = callback;
+ }
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandFacade.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandFacade.java
index 548edaf..c4c0f6b 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandFacade.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandFacade.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandUtil.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandUtil.java
index c307b5b..f08944a 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandUtil.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/XpandUtil.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/BlankLineSkippingOutput.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/BlankLineSkippingOutput.java
index a914073..c8e3b96 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/BlankLineSkippingOutput.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/BlankLineSkippingOutput.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandle.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandle.java
index a561a51..82d514a 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandle.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandle.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandleImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandleImpl.java
index 44ff789..d0ad862 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandleImpl.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/FileHandleImpl.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/JavaBeautifier.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/JavaBeautifier.java
index fe07431..31f2512 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/JavaBeautifier.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/JavaBeautifier.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/NoChangesVetoStrategy.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/NoChangesVetoStrategy.java
index 35464ef..6c894c6 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/NoChangesVetoStrategy.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/NoChangesVetoStrategy.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Outlet.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Outlet.java
index 069661a..670b81d 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Outlet.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Outlet.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Output.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Output.java
index 83f633a..6e494e7 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Output.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/Output.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/OutputImpl.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/OutputImpl.java
index 13e6dd0..21bc941 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/OutputImpl.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/OutputImpl.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/PostProcessor.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/PostProcessor.java
index 70c1338..2d15197 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/PostProcessor.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/PostProcessor.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoException.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoException.java
new file mode 100644
index 0000000..d4626c8
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoException.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+
+package org.eclipse.xpand2.output;
+
+/**
+ * Signals a veto by a {@link VetoStrategy2} implementation.
+ *
+ * @author thoms
+ * @since 4.3.1
+ */
+public class VetoException extends RuntimeException {
+ private static final long serialVersionUID = 8376169402481644160L;
+
+ public VetoException(String message) {
+ super(message);
+ }
+
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy.java
index a504b81..9123e6b 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy.java
@@ -1,23 +1,24 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
+
package org.eclipse.xpand2.output;
public interface VetoStrategy {
-
+
/**
- * Called before the file will be written
- * and <b>after</b> beforeWriteAndClose() has been invoked on all post processors.
- * @param impl A handle to the file that will be written
+ * Called before the file will be written and <b>after</b>
+ * beforeWriteAndClose() has been invoked on all post processors.
+ *
+ * @param impl
+ * A handle to the file that will be written
* @return if hasVeto returns true the file will not be written
*/
boolean hasVeto(FileHandle handle);
-
+
}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy2.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy2.java
new file mode 100644
index 0000000..2cb6067
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/VetoStrategy2.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+
+package org.eclipse.xpand2.output;
+
+/**
+ *
+ * @author thoms
+ * @since 4.3.1
+ */
+public interface VetoStrategy2 extends VetoStrategy {
+
+ /**
+ * Called before the file will be opened and generated.
+ *
+ * @param impl
+ * A handle to the file that will be generated
+ * @return if hasVetoBeforeOpen returns true the file will not be opened nor
+ * generated
+ */
+ boolean hasVetoBeforeOpen(FileHandle handle);
+
+}
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/XmlBeautifier.java b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/XmlBeautifier.java
index e524908..eec572e 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/XmlBeautifier.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/XmlBeautifier.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand2.output;
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/package.html
new file mode 100644
index 0000000..869f09c
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/output/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Generator output handling
+</body>
+</html>
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/package.html b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/package.html
new file mode 100644
index 0000000..08b9f27
--- /dev/null
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/xpand2/package.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!-- $Id: package.html,v 1.1 2009/01/10 00:59:23 pschonbac Exp $ -->
+<html> <head>
+<title></title>
+</head>
+
+<body>
+Implementation of the Xpand language
+</body>
+</html>
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
index ccf62c1..8b1e74e 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllAllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllTests.java
index 9d35f04..7794926 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionAnalyzationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionAnalyzationTest.java
index 057d99d..a412cdd 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionAnalyzationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionAnalyzationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
index aca3d89..90659e2 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/ExtensionEvaluationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend;
@@ -35,9 +33,7 @@ public class ExtensionEvaluationTest extends TestCase {
@Override
protected void setUp() throws Exception {
ec = new ExecutionContextImpl();
- ec
- .registerMetaModel(new JavaMetaModel("asdf",
- new JavaBeansStrategy()));
+ ec.registerMetaModel(new JavaMetaModel("asdf", new JavaBeansStrategy()));
}
private ExtensionFile parse(final String expression) {
@@ -50,11 +46,7 @@ public class ExtensionEvaluationTest extends TestCase {
+ "String privateHelper(String str) : JAVA org.eclipse.xtend.Helper.privateHelper(java.lang.String) ; \n"
+ "\n"
+ "String nonStaticHelper(String str) : JAVA org.eclipse.xtend.Helper.nonStaticHelper(java.lang.String) ; \n"
- + "\n"
- + "/* \n"
- + " * Meine Funktion \n"
- + " */ \n"
- + "myExtension(Object val) : {val} ; \n");
+ + "\n" + "/* \n" + " * Meine Funktion \n" + " */ \n" + "myExtension(Object val) : {val} ; \n");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
final Object[] params = new Object[] { "test" };
@@ -62,8 +54,7 @@ public class ExtensionEvaluationTest extends TestCase {
assertEquals("TEST", ext.evaluate(params, ec));
ext = ec.getExtension("myExtension", params);
- assertEquals(Collections.singletonList("test"), ext
- .evaluate(params, ec));
+ assertEquals(Collections.singletonList("test"), ext.evaluate(params, ec));
}
public final void testJavaExtension2() {
@@ -71,8 +62,7 @@ public class ExtensionEvaluationTest extends TestCase {
+ "org.eclipse.xtend.Helper.union(java.util.Collection,java.util.Collection) ; \n");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final Object[] params = new Object[] { Collections.singleton("1"),
- Collections.singleton("2") };
+ final Object[] params = new Object[] { Collections.singleton("1"), Collections.singleton("2") };
final Extension ext = ec.getExtension("union", params);
final Collection result = (Collection) ext.evaluate(params, ec);
assertTrue(result.size() == 2);
@@ -81,26 +71,21 @@ public class ExtensionEvaluationTest extends TestCase {
}
public final void testPolymorphism() {
- final ExtensionFile file = parse("ext(Object val) : 'Object' ; \n"
- + "ext(List[Object] val) : 'List' ; \n"
- + "ext(Collection[Object] val) : 'Collection' ; \n"
- + "ext(Integer val) : 'Integer' ; \n");
+ final ExtensionFile file = parse("ext(Object val) : 'Object' ; \n" + "ext(List[Object] val) : 'List' ; \n"
+ + "ext(Collection[Object] val) : 'Collection' ; \n" + "ext(Integer val) : 'Integer' ; \n");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
Extension ext = ec.getExtension("ext", new Object[] { "test" });
assertEquals("Object", ext.evaluate(new Object[] { "test" }, ec));
ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_SET });
- assertEquals("Collection", ext.evaluate(
- new Object[] { Collections.EMPTY_SET }, ec));
+ assertEquals("Collection", ext.evaluate(new Object[] { Collections.EMPTY_SET }, ec));
ext = ec.getExtension("ext", new Object[] { Collections.EMPTY_LIST });
- assertEquals("List", ext.evaluate(
- new Object[] { Collections.EMPTY_LIST }, ec));
+ assertEquals("List", ext.evaluate(new Object[] { Collections.EMPTY_LIST }, ec));
ext = ec.getExtension("ext", new Object[] { new Integer(2) });
- assertEquals("Integer", ext.evaluate(new Object[] { new Integer(2) },
- ec));
+ assertEquals("Integer", ext.evaluate(new Object[] { new Integer(2) }, ec));
}
@@ -109,21 +94,18 @@ public class ExtensionEvaluationTest extends TestCase {
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final Extension ext = ec.getExtension("recExtension", new Object[] {
- new Long(5), new Long(10) });
+ final Extension ext = ec.getExtension("recExtension", new Object[] { new Long(5), new Long(10) });
final List<Long> expected = new ArrayList<Long>();
for (int i = 5; i <= 10; i++) {
expected.add(new Long(i));
}
- final Object evalResult = ext.evaluate(new Object[] { new Long(5),
- new Long(10) }, ec);
+ final Object evalResult = ext.evaluate(new Object[] { new Long(5), new Long(10) }, ec);
assertEquals(expected, evalResult);
}
public final void testMemberPosition() {
- final ExtensionFile file = parse("ext1(String txt) : 'test'+txt ;"
- + "ext2(String txt) : txt.ext1() ;");
+ final ExtensionFile file = parse("ext1(String txt) : 'test'+txt ;" + "ext2(String txt) : txt.ext1() ;");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
final Extension ext = ec.getExtension("ext2", new Object[] { "fall" });
@@ -132,16 +114,16 @@ public class ExtensionEvaluationTest extends TestCase {
}
-
public final void testCachedExtension() {
final ExtensionFile file = parse("cached String ext(String txt) : JAVA org.eclipse.xtend.ExtensionEvaluationTest.testMethod(java.lang.String);");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
final Extension ext = ec.getExtension("ext", new Object[] { "test" });
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
- assertEquals("test0", ext.evaluate(new Object[] { "test" }, ec));
+ String expected = "test" + String.valueOf(magic);
+ assertEquals(expected, ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals(expected, ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals(expected, ext.evaluate(new Object[] { "test" }, ec));
+ assertEquals(expected, ext.evaluate(new Object[] { "test" }, ec));
}
private static int magic = 0;
@@ -153,8 +135,7 @@ public class ExtensionEvaluationTest extends TestCase {
public final void testCreateExtension() {
final ExtensionFile file = parse("create List l test(String s) : l.add(s) ;");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final List l = (List) ((Extension) file.getExtensions().get(0))
- .evaluate(new String[] { "test" }, ec);
+ final List l = (List) (file.getExtensions().get(0)).evaluate(new String[] { "test" }, ec);
assertEquals(Collections.singletonList("test"), l);
}
@@ -162,31 +143,29 @@ public class ExtensionEvaluationTest extends TestCase {
public final void testCreateExtension1() {
final ExtensionFile file = parse("create List test(String s) : add(s) ;");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
- final List l = (List) ((Extension) file.getExtensions().get(0))
- .evaluate(new String[] { "test" }, ec);
+ final List l = (List) (file.getExtensions().get(0)).evaluate(new String[] { "test" }, ec);
assertEquals(Collections.singletonList("test"), l);
}
public final void testAmbigous() {
- final ExtensionFile file = parse("import "
- + TypeA.class.getPackage().getName().replaceAll("\\.", "::")
- + ";" + "doStuff(TypeA this) : true; "
- + "doStuff(TypeC this) : false;");
+ final ExtensionFile file = parse("import " + TypeA.class.getPackage().getName().replaceAll("\\.", "::") + ";"
+ + "doStuff(TypeA this) : true; " + "doStuff(TypeC this) : false;");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
assertNotNull(ec.getExtension("doStuff", new Object[] { new TypeA() }));
try {
ec.getExtension("doStuff", new Object[] { new TypeB() });
fail("Ambigous operation exception expected");
- } catch (final RuntimeException re) {
+ }
+ catch (final RuntimeException re) {
// expected
System.out.println(re.getMessage());
}
}
public final void testBug134626() {
- final ExtensionFile file = parse("String someExt(TestA someA) : JAVA "
- + getClass().getName() + "(java.lang.String) ; \n");
+ final ExtensionFile file = parse("String someExt(TestA someA) : JAVA " + getClass().getName()
+ + "(java.lang.String) ; \n");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
}
@@ -196,8 +175,7 @@ public class ExtensionEvaluationTest extends TestCase {
}
public void testAdvices() throws Exception {
- final ExtensionFile file = parse("doStuff() : '_THE_'; "
- + "doStuff(String s) : s;");
+ final ExtensionFile file = parse("doStuff() : '_THE_'; " + "doStuff(String s) : s;");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
ec.registerExtensionAdvices("org::eclipse::xtend::Advices");
@@ -206,8 +184,7 @@ public class ExtensionEvaluationTest extends TestCase {
}
- private Object call(ExecutionContextImpl ctx, String string,
- Object... params) {
+ private Object call(ExecutionContextImpl ctx, String string, Object... params) {
Extension ext = ctx.getExtension(string, params);
return ext.evaluate(params, ctx);
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/Helper.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/Helper.java
index fbbbe44..f0ad213 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/Helper.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/Helper.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendComponentTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendComponentTest.java
index 2a64a52..e0823da 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendComponentTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendComponentTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendFacadeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendFacadeTest.java
index 63a7996..9906fa6 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendFacadeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/XtendFacadeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/AllTests.java
index 5f7e112..ea54aec 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.check;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckAnalyzationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckAnalyzationTest.java
index 769cbf6..fdabbca 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckAnalyzationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckAnalyzationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckEvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckEvaluationTest.java
index 30d6447..9df1f20 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckEvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckEvaluationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckFastAnalyzerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckFastAnalyzerTest.java
index 737a734..5633598 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckFastAnalyzerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/CheckFastAnalyzerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/FeaturedCheckTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/FeaturedCheckTest.java
index d1039c7..cce5995 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/FeaturedCheckTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/FeaturedCheckTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/Helper.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/Helper.java
index 5b0ec1c..388e02a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/Helper.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/check/Helper.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/AllTests.java
index a19661e..f56725c 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.codeassist;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/FastAnalyzerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/FastAnalyzerTest.java
index 734f564..cb12667 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/FastAnalyzerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/codeassist/FastAnalyzerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.codeassist;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/AllTests.java
index 7310075..bf31ba2 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.expression;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/EvaluationExceptionTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/EvaluationExceptionTest.java
index 66c95d9..50a0fbe 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/EvaluationExceptionTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/EvaluationExceptionTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ExecutionContextImplTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ExecutionContextImplTest.java
index ef6ba46..4e60734 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ExecutionContextImplTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ExecutionContextImplTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/PolymorphismTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/PolymorphismTest.java
index 9faaadb..3d2be2a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/PolymorphismTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/PolymorphismTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
index 402fa38..44aec9d 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ResourceManagerDefaultImplTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
@@ -18,10 +16,9 @@ import java.io.StringWriter;
import junit.framework.TestCase;
public class ResourceManagerDefaultImplTest extends TestCase {
- private static final String LINE_WRAP = System
- .getProperty("line.separator");
- private final static String CONTENT = tag("IMPORT ecore") + LINE_WRAP
- + tag("AROUND Root FOR EPackage") + LINE_WRAP + tag("ENDAROUND");
+ private static final String LINE_WRAP = System.getProperty("line.separator");
+ private final static String CONTENT = tag("IMPORT ecore") + LINE_WRAP + tag("AROUND Root FOR EPackage") + LINE_WRAP
+ + tag("ENDAROUND");
class TestResourcManager extends ResourceManagerDefaultImpl {
public Reader _createReader(InputStream in) {
@@ -51,18 +48,26 @@ public class ResourceManagerDefaultImplTest extends TestCase {
checkResourceLoading(null, "templatefile-macroman.xpt");
}
- private void checkResourceLoading(String encoding, String testfile)
- throws IOException {
+ private void checkResourceLoading(String encoding, String testfile) throws IOException {
resMgr.setFileEncoding(encoding);
InputStream is = getClass().getResourceAsStream(testfile);
assertNotNull(is);
Reader reader = resMgr._createReader(is);
String read = read(reader);
assertNotNull(read);
- assertEquals(CONTENT, read);
+ assertEquals(unifyLineWrap(CONTENT), unifyLineWrap(read));
}
+ private String unifyLineWrap(String s) {
+ if (s == null)
+ return null;
+
+ String res = s.replaceAll("\\r\\n", "\n");
+ res = res.replaceAll("\\r", "\n");
+ return res;
+ }
+
private String read(Reader r) throws IOException {
StringWriter s = new StringWriter();
char[] buf = new char[1024];
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type1.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type1.java
index dfe9f63..278f610 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type1.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type1.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type2.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type2.java
index c7ada1d..d95de77 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type2.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type2.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type3.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type3.java
index 549bf03..288764a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type3.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/Type3.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/TypeNameUtilTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/TypeNameUtilTest.java
index 2f19fa5..17f8659 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/TypeNameUtilTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/TypeNameUtilTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AType.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AType.java
index 18c0743..05c47b5 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AType.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.ast;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AllTests.java
index 890e59e..c62dada 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.expression.ast;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AnalyzationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AnalyzationTest.java
index 08c5888..7e26974 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AnalyzationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/AnalyzationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.ast;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
index 78f0efe..0486426 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/EvaluationTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.ast;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestMetaModel.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestMetaModel.java
index 12ef64c..c060737 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestMetaModel.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestMetaModel.java
@@ -1,16 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
-/**
- *
- */
package org.eclipse.xtend.expression.ast;
import java.util.Collections;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestType.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestType.java
index de4c758..f5ad6e3 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestType.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/ast/TestType.java
@@ -1,13 +1,11 @@
-/*
-Copyright (c) 2008 Arno Haase.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Eclipse Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/epl-v10.html
-
-Contributors:
- Arno Haase - initial API and implementation
- */
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.expression.ast;
import java.util.Arrays;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/AllTests.java
index b728e38..0818ea7 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.expression.codeassist;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExpressionProposalComputerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExpressionProposalComputerTest.java
index c1afa3f..d13bbec 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExpressionProposalComputerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExpressionProposalComputerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.codeassist;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExtensionImportProposalComputerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExtensionImportProposalComputerTest.java
index 32b617c..3f54b7d 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExtensionImportProposalComputerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ExtensionImportProposalComputerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.codeassist;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ReverseScannerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ReverseScannerTest.java
index 95d1c0f..df2b987 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ReverseScannerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/ReverseScannerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.codeassist;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/TypeProposalComputerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/TypeProposalComputerTest.java
index 72bf644..9680e77 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/TypeProposalComputerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/codeassist/TypeProposalComputerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.codeassist;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/AllTests.java
index 7e2f979..4d2194e 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.expression.parser;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ParserTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ParserTest.java
index db7c116..16a8023 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ParserTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ParserTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.parser;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ScannerTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ScannerTest.java
index 47f3a42..a06268e 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ScannerTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/expression/parser/ScannerTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.expression.parser;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/AllTests.java
index 5289ab4..4fe4bd3 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.parser;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/ExtensionParserTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/ExtensionParserTest.java
index b62e670..cd01347 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/ExtensionParserTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/parser/ExtensionParserTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.parser;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/AllTests.java
index 5dc7cb6..4973f61 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/CollectionFeaturesTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/CollectionFeaturesTest.java
index 5050b79..783e4ab 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/CollectionFeaturesTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/CollectionFeaturesTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl;
@@ -29,75 +27,75 @@ import org.eclipse.xtend.expression.ExpressionFacade;
* @author Bernd Kolb
*/
public class CollectionFeaturesTest extends TestCase {
- ExecutionContextImpl ec;
-
- private ExpressionFacade ef;
-
- private ArrayList<String> vals;
-
- @Override
- protected void setUp() throws Exception {
- vals = new ArrayList<String>();
- vals.add("1");
- vals.add("2");
- vals.add("3");
- vals.add("4");
- vals.add("5");
- ec = new ExecutionContextImpl();
- ec.registerMetaModel(new JavaMetaModel("asdf", new JavaBeansStrategy()));
- ef = new ExpressionFacade(ec);
- }
-
- public final void testSelect() {
- final Collection result = (Collection) ef.evaluate("vals.select(s| s >= \"3\")", Collections.singletonMap(
- "vals", vals));
- assertEquals(3, result.size());
- assertTrue(result.contains("3"));
- assertTrue(result.contains("4"));
- assertTrue(result.contains("5"));
- }
-
- public final void testSelectFirst() {
- final Object result = ef.evaluate("vals.selectFirst(s| s >= \"3\")", Collections.singletonMap(
- "vals", vals));
- assertEquals("3", result);
- }
-
- public final void testContains() {
- final Boolean result = (Boolean)ef.evaluate("vals.contains(\"3\")", Collections.singletonMap(
- "vals", vals));
- assertTrue(result.booleanValue());
- }
-
- public final void testContainsAll() {
- final Boolean result = (Boolean)ef.evaluate("vals.containsAll({\"3\",\"4\"})", Collections.singletonMap(
- "vals", vals));
- assertTrue(result.booleanValue());
- }
-
- public final void testCollect() {
- final Collection result = (Collection) ef.evaluate("vals.collect( s| s.length)", Collections.singletonMap(
- "vals", vals));
- assertEquals(5, result.size());
- for (final Iterator iter = result.iterator(); iter.hasNext();) {
- assertEquals(new Long(1), iter.next());
- }
- }
-
- public final void testExists() {
- assertEquals(Boolean.TRUE, ef.evaluate("vals.exists(s| s == \"3\")", Collections.singletonMap("vals", vals)));
- assertEquals(Boolean.FALSE, ef.evaluate("vals.exists(s| s == \"33\")", Collections.singletonMap("vals", vals)));
- }
-
- public final void testNotExists() {
- assertEquals(Boolean.FALSE, ef.evaluate("vals.notExists(s| s == \"3\")", Collections.singletonMap("vals", vals)));
- assertEquals(Boolean.TRUE, ef.evaluate("vals.notExists(s| s == \"33\")", Collections.singletonMap("vals", vals)));
- }
-
- public final void testForAll() {
- assertEquals(Boolean.FALSE, ef.evaluate("{}.forAll(s | true)"));
- assertEquals(Boolean.TRUE, ef.evaluate("vals.forAll(s| s.length == 1)", Collections.singletonMap("vals", vals)));
- assertEquals(Boolean.FALSE, ef.evaluate("vals.forAll(s| s == \"3\")", Collections.singletonMap("vals", vals)));
- }
+ ExecutionContextImpl ec;
+
+ private ExpressionFacade ef;
+
+ private ArrayList<String> vals;
+
+ @Override
+ protected void setUp() throws Exception {
+ vals = new ArrayList<String>();
+ vals.add("1");
+ vals.add("2");
+ vals.add("3");
+ vals.add("4");
+ vals.add("5");
+ ec = new ExecutionContextImpl();
+ ec.registerMetaModel(new JavaMetaModel("asdf", new JavaBeansStrategy()));
+ ef = new ExpressionFacade(ec);
+ }
+
+ public final void testSelect() {
+ final Collection result = (Collection) ef.evaluate("vals.select(s| s >= \"3\")", Collections.singletonMap(
+ "vals", vals));
+ assertEquals(3, result.size());
+ assertTrue(result.contains("3"));
+ assertTrue(result.contains("4"));
+ assertTrue(result.contains("5"));
+ }
+
+ public final void testSelectFirst() {
+ final Object result = ef.evaluate("vals.selectFirst(s| s >= \"3\")", Collections.singletonMap("vals", vals));
+ assertEquals("3", result);
+ }
+
+ public final void testContains() {
+ final Boolean result = (Boolean) ef.evaluate("vals.contains(\"3\")", Collections.singletonMap("vals", vals));
+ assertTrue(result.booleanValue());
+ }
+
+ public final void testContainsAll() {
+ final Boolean result = (Boolean) ef.evaluate("vals.containsAll({\"3\",\"4\"})", Collections.singletonMap(
+ "vals", vals));
+ assertTrue(result.booleanValue());
+ }
+
+ public final void testCollect() {
+ final Collection result = (Collection) ef.evaluate("vals.collect( s| s.length)", Collections.singletonMap(
+ "vals", vals));
+ assertEquals(5, result.size());
+ for (final Iterator iter = result.iterator(); iter.hasNext();) {
+ assertEquals(new Long(1), iter.next());
+ }
+ }
+
+ public final void testExists() {
+ assertEquals(Boolean.TRUE, ef.evaluate("vals.exists(s| s == \"3\")", Collections.singletonMap("vals", vals)));
+ assertEquals(Boolean.FALSE, ef.evaluate("vals.exists(s| s == \"33\")", Collections.singletonMap("vals", vals)));
+ }
+
+ public final void testNotExists() {
+ assertEquals(Boolean.FALSE, ef
+ .evaluate("vals.notExists(s| s == \"3\")", Collections.singletonMap("vals", vals)));
+ assertEquals(Boolean.TRUE, ef
+ .evaluate("vals.notExists(s| s == \"33\")", Collections.singletonMap("vals", vals)));
+ }
+
+ public final void testForAll() {
+ assertEquals(Boolean.TRUE, ef.evaluate("{}.forAll(s | true)"));
+ assertEquals(Boolean.TRUE, ef.evaluate("vals.forAll(s| s.length == 1)", Collections.singletonMap("vals", vals)));
+ assertEquals(Boolean.FALSE, ef.evaluate("vals.forAll(s| s == \"3\")", Collections.singletonMap("vals", vals)));
+ }
}
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/ObjectFeaturesTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/ObjectFeaturesTest.java
index 9d705d0..9a7fcf4 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/ObjectFeaturesTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/ObjectFeaturesTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/TypesComparatorTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/TypesComparatorTest.java
index 92b1264..0659740 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/TypesComparatorTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/TypesComparatorTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/AllTests.java
index 3be695f..ad24d21 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/BooleanTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/BooleanTypeTest.java
index 857b6e2..eb60180 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/BooleanTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/BooleanTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/CollectionTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/CollectionTypeTest.java
index 6d3cd42..8e1c787 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/CollectionTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/CollectionTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/EnumTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/EnumTest.java
index 720c01a..76c5a13 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/EnumTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/EnumTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/IntegerTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/IntegerTypeTest.java
index 73d9056..c4ba12f 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/IntegerTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/IntegerTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyClass.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyClass.java
index d218133..ccbbea2 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyClass.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyClass.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyEnum.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyEnum.java
index 90fd501..6c9edde 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyEnum.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/MyEnum.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/ObjectTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/ObjectTypeTest.java
index 79ef2f0..906bd25 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/ObjectTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/ObjectTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/RealTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/RealTypeTest.java
index 196c4df..51e874f 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/RealTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/RealTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/StringTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/StringTypeTest.java
index d3f4743..d6332b5 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/StringTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/StringTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/TypeTypeTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/TypeTypeTest.java
index 4f4165a..c899147 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/TypeTypeTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/baseimpl/types/TypeTypeTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.baseimpl.types;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/AllTests.java
index f77f68d..3ba2fcc 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/AllTests.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
+ *
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorPluginTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorPluginTests.java
index 69afb78..de2a183 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorPluginTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorPluginTests.java
@@ -1,14 +1,10 @@
/*******************************************************************************
- * <copyright>
- * Copyright (c) 2008 itemis AG and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
- * </copyright>
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorStandaloneTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorStandaloneTests.java
index 14e59f9..bd5118e 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorStandaloneTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/OawValidatorStandaloneTests.java
@@ -1,14 +1,10 @@
/*******************************************************************************
- * <copyright>
- * Copyright (c) 2008 itemis AG and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
- * </copyright>
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/AllTests.java
index f70306d..cf8fc80 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/AllTests.java
@@ -1,9 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
+ *
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.cache;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/CachedExtensionTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/CachedExtensionTest.java
index ddca185..db1834b 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/CachedExtensionTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/cache/CachedExtensionTest.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.cache;
import junit.framework.TestCase;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/HelloPDE.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/HelloPDE.java
index 125eaae..7b36156 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/HelloPDE.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/HelloPDE.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model;
public class HelloPDE {
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyEnum.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyEnum.java
index fc7a480..a5f1603 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyEnum.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyEnum.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: MyEnum.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test;
import java.util.Arrays;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyMetaClass.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyMetaClass.java
index 62083a7..7192c62 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyMetaClass.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/MyMetaClass.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: MyMetaClass.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test;
import org.eclipse.emf.common.util.EList;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestFactory.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestFactory.java
index 9044962..9d3326f 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestFactory.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestFactory.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestFactory.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test;
import org.eclipse.emf.ecore.EFactory;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestPackage.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestPackage.java
index c9a2d77..d722201 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestPackage.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/TestPackage.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestPackage.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test;
import org.eclipse.emf.ecore.EAttribute;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/MyMetaClassImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/MyMetaClassImpl.java
index 118e73b..4fb887b 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/MyMetaClassImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/MyMetaClassImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: MyMetaClassImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.impl;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestFactoryImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestFactoryImpl.java
index 6127056..3b258bd 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestFactoryImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestFactoryImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestFactoryImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.impl;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestPackageImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestPackageImpl.java
index 276616f..30e9dfe 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestPackageImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/impl/TestPackageImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestPackageImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.impl;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageFactory.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageFactory.java
index 2747ac9..e0bac14 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageFactory.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageFactory.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageFactory.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage;
import org.eclipse.emf.ecore.EFactory;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageMetaClass.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageMetaClass.java
index b894227..8a4936a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageMetaClass.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackageMetaClass.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageMetaClass.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage;
import org.eclipse.emf.ecore.EObject;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackagePackage.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackagePackage.java
index 89bc346..e8796c7 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackagePackage.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/SubpackagePackage.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackagePackage.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage;
import org.eclipse.emf.ecore.EAttribute;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageFactoryImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageFactoryImpl.java
index 2814647..07d1b37 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageFactoryImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageFactoryImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageFactoryImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage.impl;
import org.eclipse.emf.ecore.EClass;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageMetaClassImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageMetaClassImpl.java
index 55c7cba..85e32cd 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageMetaClassImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackageMetaClassImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageMetaClassImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage.impl;
import org.eclipse.emf.common.notify.Notification;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackagePackageImpl.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackagePackageImpl.java
index f617dd1..7c22a55 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackagePackageImpl.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/impl/SubpackagePackageImpl.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackagePackageImpl.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage.impl;
import org.eclipse.emf.ecore.EAttribute;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageAdapterFactory.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageAdapterFactory.java
index b79d88f..af748f3 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageAdapterFactory.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageAdapterFactory.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageAdapterFactory.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage.util;
import org.eclipse.emf.common.notify.Adapter;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageSwitch.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageSwitch.java
index fd81280..a3a094c 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageSwitch.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/subpackage/util/SubpackageSwitch.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: SubpackageSwitch.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.subpackage.util;
import java.util.List;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestAdapterFactory.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestAdapterFactory.java
index a151fc7..4350cd5 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestAdapterFactory.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestAdapterFactory.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestAdapterFactory.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.util;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestSwitch.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestSwitch.java
index 2f3c91c..9e6322b 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestSwitch.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/util/TestSwitch.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: TestSwitch.java,v 1.2 2008/11/26 12:46:25 dhubner Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.util;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/validation/MyMetaClassValidator.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/validation/MyMetaClassValidator.java
index ec5cc63..7867474 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/validation/MyMetaClassValidator.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/emf/check/model/test/validation/MyMetaClassValidator.java
@@ -1,9 +1,11 @@
-/**
- * <copyright>
- * </copyright>
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
*
- * $Id: MyMetaClassValidator.java,v 1.1 2008/10/21 07:32:51 jkohnlein Exp $
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check.model.test.validation;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/AllTests.java
index 120eb36..850f377 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.impl.javabeans;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansMetaType.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansMetaType.java
index f3bb6b7..b088221 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansMetaType.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansMetaType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.impl.javabeans;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansStrategyTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansStrategyTest.java
index 6387027..4d93bba 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansStrategyTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/JavaBeansStrategyTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.impl.javabeans;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/MyMetaTypeInterface.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/MyMetaTypeInterface.java
index 7156351..f781cda 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/MyMetaTypeInterface.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/javabeans/MyMetaTypeInterface.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.impl.javabeans;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/AllTests.java
index 5c5f716..b0b6cc4 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.impl.oawclassic;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicMetaType.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicMetaType.java
index 51edcfb..4dbae14 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicMetaType.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicMetaType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.impl.oawclassic;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicStrategyTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicStrategyTest.java
index 37e3c36..0464cc2 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicStrategyTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/impl/oawclassic/OawClassicStrategyTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.impl.oawclassic;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
index 09e8c2d..d48c6ff 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/AllTests.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
import junit.framework.Test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/InterfaceD.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/InterfaceD.java
index fd842b8..02cb1c8 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/InterfaceD.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/InterfaceD.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java
index 066d552..0ffeb7f 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/JavaTest.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/Mib.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/Mib.java
index 9d84435..85e7f29 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/Mib.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/Mib.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/OAWTypeD.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/OAWTypeD.java
index 5a62f0e..206fd4a 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/OAWTypeD.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/OAWTypeD.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeA.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeA.java
index 2367536..6ec8be1 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeA.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeA.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeB.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeB.java
index b553d30..3629900 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeB.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeB.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeC.java b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeC.java
index 307feb5..b6c883f 100644
--- a/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeC.java
+++ b/plugins/org.eclipse.xtend.tests/src/org/eclipse/xtend/typesystem/javabeansimpl/test/TypeC.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.javabeansimpl.test;
diff --git a/plugins/org.eclipse.xtend.tests/src/test/Bean.java b/plugins/org.eclipse.xtend.tests/src/test/Bean.java
index 0f7d3bb..0ff449d 100644
--- a/plugins/org.eclipse.xtend.tests/src/test/Bean.java
+++ b/plugins/org.eclipse.xtend.tests/src/test/Bean.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package test;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EClassType.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EClassType.java
index 08a7f62..7094f4c 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EClassType.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EClassType.java
@@ -1,17 +1,11 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) and others.
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
- *
- * </copyright>
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
import java.lang.reflect.Method;
@@ -41,147 +35,160 @@ import org.eclipse.xtend.typesystem.Type;
public class EClassType extends AbstractTypeImpl {
- private final static Log log = LogFactory.getLog(EClassType.class);
-
- private EmfRegistryMetaModel emfMetaModel;
-
- private EClass eClass;
-
- public EClassType(final EmfRegistryMetaModel model, final String name, final EClass class1) {
- super(model.getTypeSystem(), name);
- emfMetaModel = model;
- eClass = class1;
- }
-
-
- @Override
- public Feature[] getContributedFeatures() {
- final Set<FeatureImpl> result = new HashSet<FeatureImpl>();
- // Attributes
- List<EStructuralFeature> list = eClass.getEStructuralFeatures();
- for (final EStructuralFeature feature : list) {
- final Type t = emfMetaModel.getTypeForETypedElement(feature);
- if (t == null) {
- log.warn("Couldn't resolve type for " + getTypeName(feature.getEType()));
- } else {
- result.add(new PropertyImpl(this, feature.getName(), t) {
-
- public Object get(final Object target) {
- return ((EObject) target).eGet(feature);
- }
-
- @Override
- public void set(final Object target, Object newValue) {
- if (feature.isChangeable() && !feature.isUnsettable() && !feature.isDerived()) {
- if (feature.getEType() instanceof EDataType && !(feature.getEType() instanceof EEnum)) {
- final EDataType dt = (EDataType) feature.getEType();
- newValue = getReturnType().convert(newValue, dt.getInstanceClass());
- }
- ((EObject) target).eSet(feature, newValue);
- } else
- throw new UnsupportedOperationException("setting property '" + feature.getName() + "' is not allowed!");
- }
- });
- }
- }
- // Operations
- final List operations = eClass.getEOperations();
- for (final Iterator iter = operations.iterator(); iter.hasNext();) {
- final EOperation op = (EOperation) iter.next();
- final EList emfParams = op.getEParameters();
- final Type[] paramTypes = new Type[emfParams.size()];
- boolean errors = false;
- for (int i = 0, x = emfParams.size(); i < x; i++) {
- final EParameter param = (EParameter) emfParams.get(i);
- paramTypes[i] = emfMetaModel.getTypeForETypedElement(param);
- if (paramTypes[i] == null) {
- log.warn("Couldn't resolve type for " + getTypeName(param.getEType()));
- errors = true;
- }
- }
- final Type t = emfMetaModel.getTypeForETypedElement(op);
- if (t == null) {
- log.warn("Couldn't resolve type for " + getTypeName(op.getEType()));
- errors = true;
- }
- if (!errors) {
-
- result.add(new OperationImpl(this, op.getName(), t, paramTypes) {
-
- @Override
- protected Object evaluateInternal(final Object target, final Object[] params) {
- final Class[] paramClasses = new Class[emfParams.size()];
- for (int i = 0, x = emfParams.size(); i < x; i++) {
- final EParameter param = (EParameter) emfParams.get(i);
- paramClasses[i] = param.getEType().getInstanceClass();
- params[i] = getParameterTypes().get(i).convert(params[i], paramClasses[i]);
- }
- try {
- final Method m = target.getClass().getMethod(getName(), paramClasses);
- return m.invoke(target, params);
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- }
- // setter
- for (final EStructuralFeature feature : (List<EStructuralFeature>) eClass.getEStructuralFeatures()) {
-
- final Type t = emfMetaModel.getTypeForETypedElement(feature);
- if (t == null) {
- log.warn("Couldn't resolve type for " + getTypeName(feature.getEType()));
- } else {
- if (feature.isChangeable() && !feature.isDerived()) { // !feature.isUnsettable() &&
- result.add(new OperationImpl(this, "set" + StringHelper.firstUpper(feature.getName()), this, new Type[] { t }) {
-
- @Override
- protected Object evaluateInternal(final Object target, final Object[] params) {
- Object newValue = params[0];
- if (newValue != null && feature.getEType() instanceof EDataType && !(feature.getEType() instanceof EEnum)) {
- final EDataType dt = (EDataType) feature.getEType();
- newValue = getParameterTypes().get(0).convert(newValue, dt.getInstanceClass());
- }
- ((EObject) target).eSet(feature, newValue);
- return target;
- }
-
- });
- }
- }
- }
- return result.toArray(new Feature[result.size()]);
- }
-
- private String getTypeName(EClassifier type) {
- if (type==null) return "null";
- return type.getName();
- }
-
- public boolean isInstance(final Object o) {
- return eClass.isInstance(o);
- }
-
- public Object newInstance() {
- return eClass.getEPackage().getEFactoryInstance().create(eClass);
- }
-
- @Override
- protected Set<Type> internalGetSuperTypes() {
- final EList st = eClass.getESuperTypes();
- final Set<Type> result = new HashSet<Type>();
- for (final Iterator iter = st.iterator(); iter.hasNext();) {
- final EClass element = (EClass) iter.next();
- result.add(emfMetaModel.getTypeForEClassifier(element));
- }
- result.add(emfMetaModel.getEobjectType());
- return result;
- }
-
- @Override
- public boolean isAbstract() {
- return eClass.isAbstract();
- }
+ private final static Log log = LogFactory.getLog(EClassType.class);
+
+ private EmfRegistryMetaModel emfMetaModel;
+
+ private EClass eClass;
+
+ public EClassType(final EmfRegistryMetaModel model, final String name, final EClass class1) {
+ super(model.getTypeSystem(), name);
+ emfMetaModel = model;
+ eClass = class1;
+ }
+
+ @Override
+ public Feature[] getContributedFeatures() {
+ final Set<FeatureImpl> result = new HashSet<FeatureImpl>();
+ // Attributes
+ List<EStructuralFeature> list = eClass.getEStructuralFeatures();
+ for (final EStructuralFeature feature : list) {
+ final Type t = emfMetaModel.getTypeForETypedElement(feature);
+ if (t == null) {
+ log.warn("Couldn't resolve type for " + getTypeName(feature.getEType()));
+ }
+ else {
+ result.add(new PropertyImpl(this, feature.getName(), t) {
+
+ public Object get(final Object target) {
+ return ((EObject) target).eGet(feature);
+ }
+
+ @Override
+ public void set(final Object target, Object newValue) {
+ if (feature.isChangeable() && !feature.isUnsettable() && !feature.isDerived()) {
+ if (feature.getEType() instanceof EDataType && !(feature.getEType() instanceof EEnum)) {
+ final EDataType dt = (EDataType) feature.getEType();
+ newValue = getReturnType().convert(newValue, dt.getInstanceClass());
+ }
+ ((EObject) target).eSet(feature, newValue);
+ }
+ else
+ throw new UnsupportedOperationException("setting property '" + feature.getName()
+ + "' is not allowed!");
+ }
+ });
+ }
+ }
+ // Operations
+ final List operations = eClass.getEOperations();
+ for (final Iterator iter = operations.iterator(); iter.hasNext();) {
+ final EOperation op = (EOperation) iter.next();
+ final EList emfParams = op.getEParameters();
+ final Type[] paramTypes = new Type[emfParams.size()];
+ boolean errors = false;
+ for (int i = 0, x = emfParams.size(); i < x; i++) {
+ final EParameter param = (EParameter) emfParams.get(i);
+ paramTypes[i] = emfMetaModel.getTypeForETypedElement(param);
+ if (paramTypes[i] == null) {
+ log.warn("Couldn't resolve type for " + getTypeName(param.getEType()));
+ errors = true;
+ }
+ }
+ final Type t = emfMetaModel.getTypeForETypedElement(op);
+ if (t == null) {
+ log.warn("Couldn't resolve type for " + getTypeName(op.getEType()));
+ errors = true;
+ }
+ if (!errors) {
+
+ result.add(new OperationImpl(this, op.getName(), t, paramTypes) {
+
+ @Override
+ protected Object evaluateInternal(final Object target, final Object[] params) {
+ final Class[] paramClasses = new Class[emfParams.size()];
+ for (int i = 0, x = emfParams.size(); i < x; i++) {
+ final EParameter param = (EParameter) emfParams.get(i);
+ if (param.isMany()) {
+ paramClasses[i] = EList.class;
+ }
+ else {
+ paramClasses[i] = param.getEType().getInstanceClass();
+ }
+ params[i] = getParameterTypes().get(i).convert(params[i], paramClasses[i]);
+ }
+ try {
+ final Method m = target.getClass().getMethod(getName(), paramClasses);
+ return m.invoke(target, params);
+ }
+ catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+ }
+ // setter
+ for (final EStructuralFeature feature : eClass.getEStructuralFeatures()) {
+
+ final Type t = emfMetaModel.getTypeForETypedElement(feature);
+ if (t == null) {
+ log.warn("Couldn't resolve type for " + getTypeName(feature.getEType()));
+ }
+ else {
+ if (feature.isChangeable() && !feature.isDerived()) { // !feature.isUnsettable()
+ // &&
+ result.add(new OperationImpl(this, "set" + StringHelper.firstUpper(feature.getName()), this,
+ new Type[] { t }) {
+
+ @Override
+ protected Object evaluateInternal(final Object target, final Object[] params) {
+ Object newValue = params[0];
+ if (newValue != null && feature.getEType() instanceof EDataType
+ && !(feature.getEType() instanceof EEnum)) {
+ final EDataType dt = (EDataType) feature.getEType();
+ newValue = getParameterTypes().get(0).convert(newValue, dt.getInstanceClass());
+ }
+ ((EObject) target).eSet(feature, newValue);
+ return target;
+ }
+
+ });
+ }
+ }
+ }
+ return result.toArray(new Feature[result.size()]);
+ }
+
+ private String getTypeName(EClassifier type) {
+ if (type == null)
+ return "null";
+ return type.getName();
+ }
+
+ public boolean isInstance(final Object o) {
+ return eClass.isInstance(o);
+ }
+
+ public Object newInstance() {
+ return eClass.getEPackage().getEFactoryInstance().create(eClass);
+ }
+
+ @Override
+ protected Set<Type> internalGetSuperTypes() {
+ final EList st = eClass.getESuperTypes();
+ final Set<Type> result = new HashSet<Type>();
+ for (final Iterator iter = st.iterator(); iter.hasNext();) {
+ final EClass element = (EClass) iter.next();
+ result.add(emfMetaModel.getTypeForEClassifier(element));
+ }
+ result.add(emfMetaModel.getEobjectType());
+ return result;
+ }
+
+ @Override
+ public boolean isAbstract() {
+ return eClass.isAbstract();
+ }
}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EDataTypeType.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EDataTypeType.java
index d13344f..90c515e 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EDataTypeType.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EDataTypeType.java
@@ -1,17 +1,11 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) and others.
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
- *
- * </copyright>
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
import java.util.Collections;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EEnumType.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EEnumType.java
index fb8f2c5..eebe155 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EEnumType.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EEnumType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
@@ -22,6 +20,7 @@ import org.eclipse.internal.xtend.type.baseimpl.StaticPropertyImpl;
import org.eclipse.xtend.typesystem.AbstractTypeImpl;
import org.eclipse.xtend.typesystem.Feature;
+@SuppressWarnings("unchecked")
public class EEnumType extends AbstractTypeImpl {
private EEnum eEnum;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EObjectType.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EObjectType.java
index 06286fc..6078cc2 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EObjectType.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EObjectType.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
@@ -38,7 +36,7 @@ public class EObjectType extends AbstractTypeImpl {
@Override
public String getDocumentation() {
- return "base type for all ecore based metamodels (added by xtend's typesystem)";
+ return "base type for all ecore based metamodels (added by oAW4 emftools)";
}
@Override
@@ -84,6 +82,7 @@ public class EObjectType extends AbstractTypeImpl {
new PropertyImpl(EObjectType.this, "eAllContents",
getTypeSystem().getSetType(EObjectType.this)) {
+ @SuppressWarnings("unchecked")
public Object get(final Object target) {
final HashSet allCont = new HashSet();
final Iterator iter = ((EObject) target).eAllContents();
@@ -126,6 +125,7 @@ public class EObjectType extends AbstractTypeImpl {
return Collections.singleton(getTypeSystem().getObjectType());
}
+ @SuppressWarnings("unchecked")
public static StringBuffer toString(EObject x) {
if (x == null) {
return new StringBuffer("null");
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EcoreUtil2.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EcoreUtil2.java
index 4b23584..2a816a4 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EcoreUtil2.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EcoreUtil2.java
@@ -1,23 +1,18 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) and others.
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
- *
- * </copyright>
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -27,6 +22,7 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
@@ -40,44 +36,68 @@ import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory;
/**
* Provides useful functions for usage of EMF.
+ *
* @since 4.0
*/
+@SuppressWarnings("unchecked")
public class EcoreUtil2 {
private final static Log log = LogFactory.getLog(EcoreUtil2.class);
static {
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
+ new XMIResourceFactoryImpl());
EPackage.Registry.INSTANCE.put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE);
}
public final static EPackage getEPackage(final String pathToEcoreFile) {
- EPackage result = null;
+ EPackage topLevelPackage = null;
final URI fileURI = getURI(pathToEcoreFile);
if (fileURI == null)
- throw new RuntimeException("cannot resolve EPackage for " + pathToEcoreFile + ". Probably cannot find the .ecore file.");
+ throw new RuntimeException("cannot resolve EPackage for " + pathToEcoreFile
+ + ". Probably cannot find the .ecore file.");
try {
final Resource res = new ResourceSetImpl().createResource(fileURI);
if (res == null)
- throw new ConfigurationException("No ecore model file '" + pathToEcoreFile + "' found! (" + fileURI.toString() + ")");
+ throw new ConfigurationException("No ecore model file '" + pathToEcoreFile + "' found! ("
+ + fileURI.toString() + ")");
res.load(new HashMap());
- result = (EPackage) res.getContents().get(0);
- if (result.getNsURI() != null) {
- if (EPackage.Registry.INSTANCE.containsKey(result.getNsURI())) {
- result = EPackage.Registry.INSTANCE.getEPackage(result.getNsURI());
- } else {
- EPackage.Registry.INSTANCE.put(result.getNsURI(), result);
- URIConverter.URI_MAP.put(URI.createURI(result.getNsURI()), fileURI);
- }
- }
- return result;
- } catch (final IOException e) {
+ topLevelPackage = (EPackage) res.getContents().get(0);
+ registerPackage(topLevelPackage, fileURI);
+ registerSubPackages(topLevelPackage, fileURI);
+ return topLevelPackage;
+ }
+ catch (final IOException e) {
throw new ConfigurationException(e);
- } finally {
+ }
+ finally {
logPackages();
}
}
+ private static void registerSubPackages(EPackage ePackage, URI fileURI) {
+ if (ePackage == null || fileURI == null)
+ throw new IllegalArgumentException();
+
+ for (TreeIterator<EObject> it = ePackage.eAllContents(); it.hasNext();) {
+ EObject obj = it.next();
+ if (obj instanceof EPackage) {
+ EPackage p = (EPackage) obj;
+ registerPackage(p, fileURI);
+ }
+ }
+
+ }
+
+ private static void registerPackage(EPackage ePackage, final URI fileURI) {
+ if (ePackage != null && fileURI != null && ePackage.getNsURI() != null) {
+ if (!EPackage.Registry.INSTANCE.containsKey(ePackage.getNsURI())) {
+ EPackage.Registry.INSTANCE.put(ePackage.getNsURI(), ePackage);
+ URIConverter.URI_MAP.put(URI.createURI(ePackage.getNsURI()), fileURI);
+ }
+ }
+ }
+
private static void logPackages() {
// if (log.isDebugEnabled()) {
// Set s = EPackage.Registry.INSTANCE.keySet();
@@ -93,27 +113,33 @@ public class EcoreUtil2 {
/**
* Finds all elements within a collection of a specific type.
- * @param iter An iterator over the source collection.
- * @param type The type which should be selected.
+ *
+ * @param iter
+ * An iterator over the source collection.
+ * @param type
+ * The type which should be selected.
* @return A set with all elements of the specified type.
*/
public static Set<EObject> findAllByType(final Iterator iter, final Class type) {
final Set<EObject> result = new HashSet<EObject>();
while (iter.hasNext()) {
final EObject curr = (EObject) iter.next();
- if (type.isInstance(curr))
+ if (type.isInstance(curr)) {
result.add(curr);
+ }
}
return result;
}
/**
* Clones a list.
- * @param list The list that should be cloned.
+ *
+ * @param list
+ * The list that should be cloned.
* @return A copy of the original list
*/
public static List clone(final EList list) {
- if (list==null)
+ if (list == null)
return null;
final List res = new ArrayList();
res.addAll(list);
@@ -121,12 +147,15 @@ public class EcoreUtil2 {
}
/**
- * Finds an EMF EPackage instance by its class name. The EPackage class must be loadable by the
- * ResourceLoader
- * @param ePackage The class name of the EPackage interface
- * @return The EPackage instance. Returns <code>null</code> if any exception occurs after the class
- * was successfully loaded.
- * @throws ConifgurationException If the class specified by <tt>ePackage</tt> cannot be loaded.
+ * Finds an EMF EPackage instance by its class name. The EPackage class must
+ * be loadable by the ResourceLoader
+ *
+ * @param ePackage
+ * The class name of the EPackage interface
+ * @return The EPackage instance. Returns <code>null</code> if any exception
+ * occurs after the class was successfully loaded.
+ * @throws ConifgurationException
+ * If the class specified by <tt>ePackage</tt> cannot be loaded.
*/
public static EPackage getEPackageByClassName(final String ePackage) throws ConfigurationException {
Class clazz;
@@ -135,34 +164,43 @@ public class EcoreUtil2 {
clazz = ResourceLoaderFactory.createResourceLoader().loadClass(ePackage);
if (clazz == null)
throw new ConfigurationException("Couldn't find class " + ePackage);
- // each EPackage class has an 'eINSTANCE' field which holds the implementation instance
+ // each EPackage class has an 'eINSTANCE' field which holds the
+ // implementation instance
final Field f = clazz.getField("eINSTANCE");
// retrieve the EPackage instance from the eINSTANCE field
final EPackage result = (EPackage) f.get(null);
- // register the EPackage instance in the EPackage Registry
+ // register the EPackage instance in the EPackage Registry
EPackage.Registry.INSTANCE.put(result.getNsURI(), result);
return result;
- } catch (final SecurityException e) {
+ }
+ catch (final SecurityException e) {
log.error(e);
return null;
- } catch (final NoSuchFieldException e) {
+ }
+ catch (final NoSuchFieldException e) {
log.error(e);
return null;
- } catch (final IllegalArgumentException e) {
+ }
+ catch (final IllegalArgumentException e) {
log.error(e);
return null;
- } catch (final IllegalAccessException e) {
+ }
+ catch (final IllegalAccessException e) {
log.error(e);
return null;
- } finally {
+ }
+ finally {
logPackages();
}
}
/**
* Finds an EPackage by the class name of the Package Descriptor.
- * @param ePackageDescriptor The Package Descriptor's classname
- * @return The EPackage instance. Returns <code>null</code> on any exception occuring while retrieval.
+ *
+ * @param ePackageDescriptor
+ * The Package Descriptor's classname
+ * @return The EPackage instance. Returns <code>null</code> on any exception
+ * occuring while retrieval.
*/
public static EPackage getEPackageByDescriptorClassName(final String ePackageDescriptor) {
Class clazz;
@@ -173,27 +211,67 @@ public class EcoreUtil2 {
final String uri = (String) f.get(null);
EPackage.Registry.INSTANCE.put(uri, descriptor);
return EPackage.Registry.INSTANCE.getEPackage(uri);
- } catch (final Exception e) {
+ }
+ catch (final Exception e) {
log.error("Couldn't load ePackage '" + ePackageDescriptor, e);
return null;
- } finally {
+ }
+ finally {
logPackages();
}
}
/**
* Creates an URI from a file name.
- * @param file The file's path
+ *
+ * @param file
+ * The file's path
* @return The URI representing the file
*/
public static URI getURI(final String file) {
// try to load the resource specified by 'file'
final URL url = ResourceLoaderFactory.createResourceLoader().getResource(file);
- // if the ResourceLoader cannot locate this file create a URI from the file
- if (url == null)
- return URI.createURI(file);
- // the ResourceLoader has successfully located the file. Return the external form of the path
- return URI.createURI(url.toExternalForm());
+ URI uri;
+
+ try {
+ // if the ResourceLoader cannot locate this file create a URI from
+ // the file
+ if (url == null) {
+ uri = URI.createURI(file);
+ }
+ else {
+ // the ResourceLoader has successfully located the file. Return
+ // the external form of the path
+
+ uri = URI.createURI(url.toExternalForm());
+
+ // this is the old implementation of this block, but it caused
+ // errors:
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=256833
+ // I'm leaving this here for a while to make sure unforeseen
+ // side effects can be understood
+ // if (url.getProtocol().equals("file")) {
+ // uri = URI.createFileURI(url.getFile());
+ // }
+ // else {
+ // uri = URI.createURI(url.toString());
+ // }
+ }
+ }
+ catch (IllegalArgumentException e) {
+ uri = URI.createFileURI(url.getFile());
+ }
+
+ return uri;
+ }
+
+ public static Collection<EObject> allContents(EObject modelElement) {
+ List<EObject> all = new ArrayList<EObject>();
+ TreeIterator<EObject> iterator = modelElement.eAllContents();
+ while (iterator.hasNext()) {
+ all.add(iterator.next());
+ }
+ return all;
}
}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java
index e7c88fc..c272cf0 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfMetaModel.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
index b8dc505..38edfd8 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/EmfRegistryMetaModel.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
@@ -37,6 +35,7 @@ import org.eclipse.xtend.expression.TypeSystem;
import org.eclipse.xtend.typesystem.MetaModel;
import org.eclipse.xtend.typesystem.Type;
+@SuppressWarnings("unchecked")
public class EmfRegistryMetaModel implements MetaModel {
TypeSystem typeSystem;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Mapping.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Mapping.java
index 59ea4da..a67c0a8 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Mapping.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Mapping.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Setup.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Setup.java
index c7f2529..410eb54 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Setup.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/Setup.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
@@ -43,6 +41,7 @@ public class Setup {
EcoreUtil2.getEPackageByClassName(clazz);
}
+ @SuppressWarnings("unchecked")
public void addUriMap(final Mapping uriMap) {
final URI baseUri = URI.createURI(uriMap.getFrom());
final URI mappedUri = EcoreUtil2.getURI(uriMap.getTo());
@@ -62,6 +61,7 @@ public class Setup {
* <li> The inner factory class for the extension cannot be found
* </ul>
*/
+ @SuppressWarnings("unchecked")
public void addExtensionMap(final Mapping m) throws ConfigurationException {
try {
// locate the factory class of the extension
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiReader.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiReader.java
index 4889a5e..4d41482 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiReader.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiReader.java
@@ -1,17 +1,11 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) and others.
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
- *
- * </copyright>
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
import java.io.File;
@@ -30,86 +24,149 @@ import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory;
/**
- * @author Sven Efftinge (http://www.efftinge.de)
+ * @author Sven Efftinge (http://www.itemis.eu)
+ *
+ *
+ * @deprecated use org.eclipse.mwe.emf.Reader instead
*/
-public class XmiReader extends AbstractWorkflowComponent {
-
- protected String modelFile;
-
- protected String outputSlot = WorkflowContext.DEFAULT_SLOT;
-
- protected boolean firstElementOnly = true;
-
- public String getLogMessage() {
- return "file '"+modelFile+"' => slot '"+outputSlot+"'";
- }
-
- public void setMetaModelFile(final String metaModelFile) {
- new Setup().addEPackageFile(metaModelFile);
- }
-
- public void setMetaModelPackage(final String metaModelPackage) {
- new Setup().addEPackageClass(metaModelPackage);
- }
-
- public void setMetaModelDescriptor(final String metaModelDescriptor) {
- new Setup().addEPackageDescriptor(metaModelDescriptor);
- }
-
- public void setModelFile(final String modelFile) {
- this.modelFile = modelFile;
- }
-
- public void setOutputSlot(final String outputSlot) {
- this.outputSlot = outputSlot;
- }
-
- public void setFirstElementOnly(final boolean firstElementOnly) {
- this.firstElementOnly = firstElementOnly;
- }
-
- public void checkConfiguration(final Issues issues) {
- loadFile(issues);
- }
-
- @Override
- protected void invokeInternal(final WorkflowContext model, final ProgressMonitor monitor, final Issues issues) {
- final File f = loadFile(issues);
- final URI fileURI = URI.createFileURI(f.getAbsolutePath());
-
- final Resource r = new ResourceSetImpl().createResource(fileURI);
- try {
- r.load(null);
- } catch (final IOException e) {
- throw new ConfigurationException(e);
- }
-
- if (firstElementOnly) {
- model.set(outputSlot, r.getContents().get(0));
- } else {
- model.set(outputSlot, r.getContents());
- }
- }
-
- protected File loadFile(final Issues issues) {
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
- if (modelFile == null) {
- issues.addError("No modelFile specified!");
- return null;
- }
- final URL url = ResourceLoaderFactory.createResourceLoader().getResource(modelFile);
- if ((url == null) || (url.getFile() == null)) {
- issues.addError(this, "cannot find file: " + modelFile);
- return null;
- }
- final File f = new File(URI.decode(url.getFile()));
- if (!f.exists()) {
- issues.addError(this, "cannot find file: " + modelFile);
- return null;
- }
- return f;
- }
-
-
-
+@Deprecated
+public class XmiReader extends AbstractWorkflowComponent {
+
+ private static final String COMPONENT_NAME = "XMI Reader";
+
+ protected String modelFile;
+
+ protected String outputSlot = WorkflowContext.DEFAULT_SLOT;
+
+ protected boolean firstElementOnly = true;
+
+ /**
+ * @see org.openarchitectureware.workflow.lib.AbstractWorkflowComponent#getLogMessage()
+ */
+ @Override
+ public String getLogMessage() {
+ return "file '" + modelFile + "' => slot '" + outputSlot + "'";
+ }
+
+ /**
+ * Sets the name of the metamodel file.
+ *
+ * @param metaModelFile
+ * name of file
+ */
+ public void setMetaModelFile(final String metaModelFile) {
+ new Setup().addEPackageFile(metaModelFile);
+ }
+
+ /**
+ * Sets the name of the metamodel package.
+ *
+ * @param metaModelPackage
+ * name of package
+ */
+ public void setMetaModelPackage(final String metaModelPackage) {
+ new Setup().addEPackageClass(metaModelPackage);
+ }
+
+ /**
+ * Sets the metamodel descriptor.
+ *
+ * @param metaModelDescriptor
+ * the descriptor
+ */
+ public void setMetaModelDescriptor(final String metaModelDescriptor) {
+ new Setup().addEPackageDescriptor(metaModelDescriptor);
+ }
+
+ /**
+ * Sets the name of the model file.
+ *
+ * @param modelFile
+ * name of file
+ */
+ public void setModelFile(final String modelFile) {
+ this.modelFile = modelFile;
+ }
+
+ /**
+ * Sets the name of the output slot.
+ *
+ * @param outputSlot
+ * name of slot
+ */
+ public void setOutputSlot(final String outputSlot) {
+ this.outputSlot = outputSlot;
+ }
+
+ /**
+ * Sets if only the first element will be used or not.
+ *
+ * @param firstElementOnly
+ * If <code>true</code>, only the first element will be used,
+ * otherwise all elements will be used.
+ */
+ public void setFirstElementOnly(final boolean firstElementOnly) {
+ this.firstElementOnly = firstElementOnly;
+ }
+
+ /**
+ * @see org.openarchitectureware.workflow.WorkflowComponent#checkConfiguration(org.openarchitectureware.workflow.issues.Issues)
+ */
+ public void checkConfiguration(final Issues issues) {
+ loadFile(issues);
+ }
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#invokeInternal(org.eclipse.emf.mwe.core.WorkflowContext,
+ * org.eclipse.emf.mwe.core.monitor.ProgressMonitor,
+ * org.eclipse.emf.mwe.core.issues.Issues)
+ */
+ @Override
+ public void invokeInternal(final WorkflowContext model, final ProgressMonitor monitor, final Issues issues) {
+ final File f = loadFile(issues);
+ final URI fileURI = URI.createFileURI(f.getAbsolutePath());
+
+ final Resource r = new ResourceSetImpl().createResource(fileURI);
+ try {
+ r.load(null);
+ }
+ catch (final IOException e) {
+ throw new ConfigurationException(e);
+ }
+
+ if (firstElementOnly) {
+ model.set(outputSlot, r.getContents().get(0));
+ }
+ else {
+ model.set(outputSlot, r.getContents());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected File loadFile(final Issues issues) {
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
+ if (modelFile == null) {
+ issues.addError("No modelFile specified!");
+ return null;
+ }
+ final URL url = ResourceLoaderFactory.createResourceLoader().getResource(modelFile);
+ if ((url == null) || (url.getFile() == null)) {
+ issues.addError(this, "cannot find file: " + modelFile);
+ return null;
+ }
+ final File f = new File(URI.decode(url.getFile()));
+ if (!f.exists()) {
+ issues.addError(this, "cannot find file: " + modelFile);
+ return null;
+ }
+ return f;
+ }
+
+ /**
+ * @see org.openarchitectureware.workflow.WorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiWriter.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiWriter.java
index eaf5d83..c9f3f5f 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiWriter.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XmiWriter.java
@@ -1,17 +1,11 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2005-2006 Sven Efftinge (http://www.efftinge.de) and others.
- * All rights reserved. This program and the accompanying materials
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * Sven Efftinge (http://www.efftinge.de) - Initial API and implementation
- *
- * </copyright>
- */
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf;
import java.io.File;
@@ -41,12 +35,19 @@ import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
*
* @author Markus Völter
* @since 4.0
+ *
+ * @deprecated use org.eclipse.mwe.emf.Writer instead
*/
+@SuppressWarnings("unchecked")
+@Deprecated
public class XmiWriter extends AbstractWorkflowComponent {
-
+
// default save options.
+ @SuppressWarnings("unchecked")
private static final Map saveOptions = new HashMap();
+ private static final String COMPONENT_NAME = "XMI Writer";
+
static {
XMIResource resource = new XMIResourceImpl();
// default save options.
@@ -54,112 +55,158 @@ public class XmiWriter extends AbstractWorkflowComponent {
saveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
}
-
- private String modelFile;
+ private String modelFile;
- private String inputSlot = WorkflowContext.DEFAULT_SLOT;
+ private String inputSlot = WorkflowContext.DEFAULT_SLOT;
private String pathPrefix = ".";
- public void setModelFile(final String modelFile) {
- this.modelFile = modelFile;
- }
-
+ /**
+ * Sets the name of the model file.
+ *
+ * @param modelFile
+ * name of file
+ */
+ public void setModelFile(final String modelFile) {
+ this.modelFile = modelFile;
+ }
+
+ /**
+ * Returns the name of the model file.
+ *
+ * @return name of model file
+ */
public String getModelFile() {
return modelFile;
}
-
+
+ /**
+ * Sets the name of the input slot.
+ *
+ * @param inputSlot
+ * name of slot
+ */
public void setInputSlot(final String inputSlot) {
- this.inputSlot = inputSlot;
- }
+ this.inputSlot = inputSlot;
+ }
- public String getInputSlot() {
+ /**
+ * Returns the name of the input slot.
+ *
+ * @return name of slot
+ */
+ public String getInputSlot() {
return inputSlot;
}
- @Override
- public String getLogMessage() {
- return "slot '"+inputSlot+"' => file '" + pathPrefix + "/" + modelFile+"'";
- }
-
- public void checkConfiguration(final Issues issues) {
- modelFile = modelFile.replace('\\', '/');
- int p = modelFile.lastIndexOf("/");
- if ( p >= 0) {
- pathPrefix = modelFile.substring(0, p+1);
- modelFile = modelFile.substring(p+1);
- }
- }
-
- @Override
- protected void invokeInternal(final WorkflowContext ctx, final ProgressMonitor monitor, final Issues issues) {
- final Object slotContent = ctx.get(inputSlot);
- if (slotContent == null) {
- issues.addError(this, "slot '" + inputSlot + "' is empty.");
- return;
- }
- if (!(slotContent instanceof Collection<?> || slotContent instanceof EObject)) {
- issues.addError(this, "slot '" + inputSlot + "' neither contains an EList nor an EObject", slotContent);
- return;
- }
-
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
-
- final URI fileURI = URI.createFileURI(modelFile);// EcoreUtil2.getURI(modelFile);
- ResourceSetImpl rsImpl = new ResourceSetImpl();
- rsImpl.setURIConverter(new XmiWriterURIConverter(pathPrefix));
- Resource r = rsImpl .createResource(fileURI);
- if (r instanceof XMIResource) {
+ /**
+ * @see org.openarchitectureware.workflow.lib.AbstractWorkflowComponent#getLogMessage()
+ */
+ @Override
+ public String getLogMessage() {
+ return "slot '" + inputSlot + "' => file '" + pathPrefix + "/" + modelFile + "'";
+ }
+
+ /**
+ * @see org.openarchitectureware.workflow.WorkflowComponent#checkConfiguration(org.openarchitectureware.workflow.issues.Issues)
+ */
+ public void checkConfiguration(final Issues issues) {
+ modelFile = modelFile.replace('\\', '/');
+ int p = modelFile.lastIndexOf("/");
+ if (p >= 0) {
+ pathPrefix = modelFile.substring(0, p + 1);
+ modelFile = modelFile.substring(p + 1);
+ }
+ }
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#invokeInternal(org.eclipse.emf.mwe.core.WorkflowContext,
+ * org.eclipse.emf.mwe.core.monitor.ProgressMonitor,
+ * org.eclipse.emf.mwe.core.issues.Issues)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void invokeInternal(final WorkflowContext ctx, final ProgressMonitor monitor, final Issues issues) {
+ final Object slotContent = ctx.get(inputSlot);
+ if (slotContent == null) {
+ issues.addError(this, "slot '" + inputSlot + "' is empty.");
+ return;
+ }
+ if (!(slotContent instanceof Collection<?> || slotContent instanceof EObject)) {
+ issues.addError(this, "slot '" + inputSlot + "' neither contains an EList nor an EObject", slotContent);
+ return;
+ }
+
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
+
+ final URI fileURI = URI.createFileURI(modelFile);// EcoreUtil2.getURI(modelFile);
+ ResourceSetImpl rsImpl = new ResourceSetImpl();
+ rsImpl.setURIConverter(new XmiWriterURIConverter(pathPrefix));
+ Resource r = rsImpl.createResource(fileURI);
+ if (r instanceof XMIResource) {
XMIResource xmiRes = (XMIResource) r;
xmiRes.getDefaultSaveOptions().putAll(saveOptions);
}
- r.setURI(URI.createFileURI(modelFile));
-
- if (slotContent instanceof Collection<?>) {
- r.getContents().addAll((Collection) slotContent);
- } else {
- r.getContents().add((EObject)slotContent);
- }
- try {
- // Fix: EMF-Resource builds wrong file name, if used on a file
- // on windows (it places the Device-Carater immediately before
- // the last Slash). So we write explicitly to the path if the
- // URI is a file URI.
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=173604
- if (r.getURI().isFile()) {
- File file = new File (pathPrefix + "/" + modelFile);
- OutputStream os = new FileOutputStream(file);
- r.save(os, null);
- os.close();
- }
- else {
- r.save(null);
- }
- } catch (final IOException e) {
- throw new ConfigurationException(e);
- }
-
- }
-
- class XmiWriterURIConverter extends URIConverterImpl {
- private String pathPrefix;
- public XmiWriterURIConverter( String pathPrefix ) {
- this.pathPrefix = pathPrefix;
- }
- @Override
- protected OutputStream createFileOutputStream(String filename) throws IOException {
- if ( pathPrefix != null ) {
- pathPrefix = pathPrefix.replace('\\', '/');
- if ( !pathPrefix.endsWith("/")) pathPrefix += "/";
- filename = filename.replace('\\', '/');
- int lastSlashPos = filename.lastIndexOf("/");
- if ( lastSlashPos >= 0 ) {
- filename = filename.substring(0,lastSlashPos+1)+pathPrefix+filename.substring(lastSlashPos+1);
- }
- }
- return super.createFileOutputStream(filename);
- }
- }
-
+ r.setURI(URI.createFileURI(modelFile));
+ if (slotContent instanceof Collection<?>) {
+ r.getContents().addAll((Collection) slotContent);
+ }
+ else {
+ r.getContents().add((EObject) slotContent);
+ }
+ try {
+ // Fix: EMF-Resource builds wrong file name, if used on a file
+ // on windows (it places the Device-Carater immediately before
+ // the last Slash). So we write explicitly to the path if the
+ // URI is a file URI.
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=173604
+ if (r.getURI().isFile()) {
+ File file = new File(pathPrefix + "/" + modelFile);
+ OutputStream os = new FileOutputStream(file);
+ r.save(os, null);
+ os.close();
+ }
+ else {
+ r.save(null);
+ }
+ }
+ catch (final IOException e) {
+ throw new ConfigurationException(e);
+ }
+
+ }
+
+ class XmiWriterURIConverter extends URIConverterImpl {
+ private String pathPrefix;
+
+ public XmiWriterURIConverter(String pathPrefix) {
+ this.pathPrefix = pathPrefix;
+ }
+
+ @Override
+ protected OutputStream createFileOutputStream(String filename) throws IOException {
+ if (pathPrefix != null) {
+ pathPrefix = pathPrefix.replace('\\', '/');
+ if (!pathPrefix.endsWith("/")) {
+ pathPrefix += "/";
+ }
+ filename = filename.replace('\\', '/');
+ int lastSlashPos = filename.lastIndexOf("/");
+ if (lastSlashPos >= 0) {
+ filename = filename.substring(0, lastSlashPos + 1) + pathPrefix
+ + filename.substring(lastSlashPos + 1);
+ }
+ }
+ return super.createFileOutputStream(filename);
+ }
+ }
+
+ /**
+ * @see org.openarchitectureware.workflow.WorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
index 6fee3ac..2ec74df 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckEValidatorAdapter.java
@@ -1,14 +1,10 @@
/*******************************************************************************
- * <copyright>
- * Copyright (c) 2008 itemis AG and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
- * </copyright>
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckFileWithContext.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckFileWithContext.java
index 6868c7b..b137681 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckFileWithContext.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckFileWithContext.java
@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
import java.util.ArrayList;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
index 1d3bdba..dcbd524 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
@@ -1,14 +1,10 @@
/*******************************************************************************
- * <copyright>
- * Copyright (c) 2008 itemis AG and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
- * </copyright>
*******************************************************************************/
package org.eclipse.xtend.typesystem.emf.check;
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java
index ab7e71c..f0ae07e 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.xtend.util.stdlib/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtend.util.stdlib/META-INF/MANIFEST.MF
index 616e33f..6938b39 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.xtend.util.stdlib/META-INF/MANIFEST.MF
@@ -12,8 +12,9 @@ Require-Bundle: org.eclipse.emf.ecore,
org.apache.commons.logging,
org.eclipse.xtend,
org.eclipse.emf.mwe.utils,
- org.eclipse.xpand;resolution:=optional
-Eclipse-LazyStart: true
+ org.eclipse.xpand;resolution:=optional,
+ org.eclipse.emf.ecore.xmi
+LazyStart: true
Export-Package: org.eclipse.xpand.util.stdlib,
org.eclipse.xtend.util.stdlib,
org.eclipse.xtend.util.stdlib.texttest,
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xpand/util/stdlib/TracingOutput.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xpand/util/stdlib/TracingOutput.java
index 4ad9036..b711cbb 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xpand/util/stdlib/TracingOutput.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xpand/util/stdlib/TracingOutput.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xpand.util.stdlib;
@@ -16,18 +14,29 @@ import org.eclipse.xpand2.output.OutputImpl;
import org.eclipse.xtend.util.stdlib.TraceComponent;
public class TracingOutput extends OutputImpl {
-
+
+ /**
+ * @see org.eclipse.xpand2.output.OutputImpl#pushStatement(org.eclipse.internal.xtend.expression.ast.SyntaxElement,
+ * org.eclipse.xpand2.XpandExecutionContext)
+ */
@Override
public void pushStatement(SyntaxElement stmt, XpandExecutionContext ctx) {
super.pushStatement(stmt, ctx);
}
-
+
+ /**
+ * @see org.eclipse.xpand2.output.OutputImpl#openFile(java.lang.String,
+ * java.lang.String)
+ */
@Override
public void openFile(String path, String outletName) {
super.openFile(path, outletName);
- TraceComponent.reportFileOpen( path );
+ TraceComponent.reportFileOpen(path);
}
-
+
+ /**
+ * @see org.eclipse.xpand2.output.OutputImpl#closeFile()
+ */
@Override
public void closeFile() {
super.closeFile();
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CloningExtensions.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CloningExtensions.java
index 067b983..c93dec6 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CloningExtensions.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CloningExtensions.java
@@ -1,18 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
+/**
+ * Java helper class for Stdlib extension <tt>org::openarchitectureware::util::stdlib::cloning</tt>.
+ */
public class CloningExtensions {
public static Object clone(Object original) {
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CounterExtensions.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CounterExtensions.java
index 2afde71..4744317 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CounterExtensions.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/CounterExtensions.java
@@ -1,18 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import java.util.HashMap;
import java.util.Map;
+/**
+ * Java helper class for Stdlib extension <tt>org::openarchitectureware::util::stdlib::counter</tt>.
+ */
public class CounterExtensions {
private static int globalCounter = 0;
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinder.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinder.java
index 31a5026..4756eb1 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinder.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinder.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -24,6 +22,7 @@ public class DanglingRefFinder {
private Set<EObject> set = new HashSet<EObject>();
+ @SuppressWarnings("unchecked")
public void handle(EObject o, Issues issues) {
if ( set.contains( o ) || shouldIgnore(o) ) return;
set.add( o );
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinderComponent.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinderComponent.java
index fddaae8..b35abef 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinderComponent.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DanglingRefFinderComponent.java
@@ -1,40 +1,51 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
-public class DanglingRefFinderComponent extends AbstractWorkflowComponent {
-
+public class DanglingRefFinderComponent extends AbstractWorkflowComponent2 {
+
+ private static final String COMPONENT_NAME = "Dangling Reference Finder";
+
private String modelSlot;
- public void setModelSlot( String slot ) {
+ /**
+ * Sets the model slot.
+ *
+ * @param slot
+ * name of slot
+ */
+ public void setModelSlot(String slot) {
this.modelSlot = slot;
}
-
- public void checkConfiguration(Issues issues) {
- if (modelSlot == null ) issues.addError(this, "'modelSlot' not specified,");
+
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if (modelSlot == null) {
+ issues.addError(this, "'modelSlot' not specified,");
+ }
}
-
+
@Override
- protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor,
- Issues issues) {
- EObject root = (EObject)ctx.get(modelSlot);
+ protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
+ EObject root = (EObject) ctx.get(modelSlot);
DanglingRefFinder finder = new DanglingRefFinder();
finder.handle(root, issues);
}
-
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DuplicateHelper.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DuplicateHelper.java
index f8c7128..d72cac2 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DuplicateHelper.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DuplicateHelper.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DynamicEcoreHelper.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DynamicEcoreHelper.java
index 90cde4b..5a46c85 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DynamicEcoreHelper.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/DynamicEcoreHelper.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -61,6 +59,7 @@ public class DynamicEcoreHelper {
object.eSet( object.eClass().getEStructuralFeature(feature) , newValue);
}
+ @SuppressWarnings("unchecked")
public void add(EObject object, String feature, EObject newValue) {
((Collection)object.eGet( object.eClass().getEStructuralFeature(feature) )).add(newValue);
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ElementPropertiesExtensions.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ElementPropertiesExtensions.java
index 5717cbb..671db25 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ElementPropertiesExtensions.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ElementPropertiesExtensions.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -15,21 +13,21 @@ import java.util.Map;
public class ElementPropertiesExtensions {
- private static Map<Object, Map> outerMap = new HashMap<Object, Map>();
+ private static Map<Object, Map<String,Object>> outerMap = new HashMap<Object, Map<String,Object>>();
public static void setProperty( Object element, String name, Object value ) {
- Map innerMap = getInnerMap(element);
+ Map<String,Object> innerMap = getInnerMap(element);
innerMap.put( name , value );
}
public static Object getProperty( Object element, String name ) {
- Map innerMap = getInnerMap(element);
+ Map<String,Object> innerMap = getInnerMap(element);
Object value = innerMap.get( name );
return value;
}
- private static Map getInnerMap( Object element ) {
- Map innerMap = outerMap.get(element);
+ private static Map<String,Object> getInnerMap( Object element ) {
+ Map<String,Object> innerMap = outerMap.get(element);
if ( innerMap == null ) {
innerMap = new HashMap<String, Object>();
outerMap.put(element, innerMap);
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/EmfUtils.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/EmfUtils.java
index e88a838..0c85f69 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/EmfUtils.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/EmfUtils.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -19,9 +17,15 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer;
+import org.eclipse.emf.ecore.xmi.XMLResource;
public class EmfUtils {
+ /**
+ * Retrieves objects that reference a given object
+ * @param target The target object
+ * @return A list of objects referencing the target
+ */
public static final List<EObject> getReferencingObjects(EObject target) {
LinkedList<EObject> result = new LinkedList<EObject>();
Collection<EStructuralFeature.Setting> settings = CrossReferencer.find(target.eResource().getContents()).get(target);
@@ -33,4 +37,17 @@ public class EmfUtils {
}
return result;
}
+
+ /**
+ * Retrieves an object's identifier. The object must be read from a
+ * XMLResource.
+ *
+ * @param obj An object
+ * @return The object's id.
+ * @since 4.3.1
+ */
+ public static String getID(EObject obj) {
+ return (obj.eResource() != null && obj.eResource() instanceof XMLResource) ? ((XMLResource) obj.eResource()).getID(obj) : null;
+ }
+
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ExtIssueReporter.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ExtIssueReporter.java
index 259d878..2e1cabc 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ExtIssueReporter.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/ExtIssueReporter.java
@@ -1,69 +1,118 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import org.eclipse.emf.mwe.core.WorkflowContext;
+import org.eclipse.emf.mwe.core.WorkflowInterruptedException;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+/**
+ * Java helper class for Stdlib extension
+ * <tt>org::openarchitectureware::util::stdlib::issues</tt>.
+ */
+public class ExtIssueReporter extends AbstractWorkflowComponent2 {
+ private static final String ERROR_CONFIGURE = "You must run the org.eclipse.xtend.util.stdlib.ExtIssueReporter component before using the issue reporting utilities.";
-public class ExtIssueReporter extends AbstractWorkflowComponent {
+ private static final String COMPONENT_NAME = "External Issue Reporter";
- static ThreadLocal tl = new ThreadLocal();
-
+ static ThreadLocal<Issues> tl = new ThreadLocal<Issues>();
+
+ @Override
protected void checkConfigurationInternal(Issues arg0) {
}
+ @Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor mon, Issues issues) {
- tl.set( issues );
+ tl.set(issues);
}
-
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getLogMessage()
+ */
@Override
public String getLogMessage() {
return "setting up issue logging from within .ext and .xpt files";
}
-
- public static String reportError( String message ) {
- getIssues().addError( message );
+
+ /**
+ * Reports an error.
+ *
+ * @param message
+ * the error message
+ * @return the passed in error message
+ */
+ public static String reportError(String message) {
+ getIssues().addError(message);
return message;
}
private static Issues getIssues() {
- return ((Issues)tl.get());
+ Issues issues = tl.get();
+ if (issues == null)
+ throw new WorkflowInterruptedException(ERROR_CONFIGURE);
+ return issues;
}
- public static String reportWarning( String message ) {
- getIssues().addWarning( message );
+ /**
+ * Reports a warning.
+ *
+ * @param message
+ * the warning message
+ * @return the passed in warning message
+ */
+ public static String reportWarning(String message) {
+ getIssues().addWarning(message);
return message;
}
- public static String reportError( String qfn, String message ) {
- if ( tl.get() == null ) {
- System.err.println("you've forgotten to run the org.eclipse.internal.xtend.util.stdlib.ExtIssueReporter component before using the issue reporting utilities.");
+ /**
+ * Reports an error.
+ *
+ * @param qfn
+ * a qualified filename
+ * @param message
+ * the error message
+ * @return the passed in error message
+ */
+ public static String reportError(String qfn, String message) {
+ if (tl.get() == null) {
+ System.err.println(ERROR_CONFIGURE);
}
- getIssues().addError( "["+qfn+"] "+message );
+ getIssues().addError("[" + qfn + "] " + message);
return message;
}
- public static String reportWarning( String qfn, String message ) {
- if ( tl.get() == null ) {
- System.err.println("you've forgotten to run the org.eclipse.internal.xtend.util.stdlib.ExtIssueReporter component before using the issue reporting utilities.");
+ /**
+ * Reports a warning.
+ *
+ * @param qfn
+ * a qualified filename
+ * @param message
+ * the warning message
+ * @return the passed in warning message
+ */
+ public static String reportWarning(String qfn, String message) {
+ if (tl.get() == null) {
+ System.err.println(ERROR_CONFIGURE);
}
- getIssues().addWarning( "["+qfn+"] "+message );
+ getIssues().addWarning("[" + qfn + "] " + message);
return message;
}
- public void checkConfiguration(Issues issues) {
-
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
}
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/GlobalVarExtensions.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/GlobalVarExtensions.java
index 605eb2b..7a50bdb 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/GlobalVarExtensions.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/GlobalVarExtensions.java
@@ -1,28 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import java.util.HashMap;
import java.util.Map;
+/**
+ * Java helper class for Stdlib extension <tt>org::openarchitectureware::util::stdlib::globalvar</tt>.
+ */
public class GlobalVarExtensions {
- private static Map vars = new HashMap();
+ private static Map<String,Object> vars = new HashMap<String,Object>();
public static void storeGlobalVar(String s, Object o){
+ if (o != null) {
vars.put(s, o);
+ } else {
+ vars.remove(s);
+ }
}
public static Object getGlobalVar(String s){
return vars.get(s);
}
+ public static Object removeGlobalVar(String s){
+ return vars.remove(s);
+ }
+
+
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/IOExtensions.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/IOExtensions.java
index c531d0b..da2cc45 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/IOExtensions.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/IOExtensions.java
@@ -1,18 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/**
+ * Java helper class for Stdlib extension <tt>org::openarchitectureware::util::stdlib::cloning</tt>.
+ * Contains extension functions for logging messages and errors.
+ */
public class IOExtensions {
private final static Log log = LogFactory.getLog(IOExtensions.class);
@@ -35,5 +37,8 @@ public class IOExtensions {
public final static void error(final Object s) {
log.error(s);
}
+ public final static void throwError(final Object s) {
+ throw new IllegalStateException(""+s);
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/MessageLogger.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/MessageLogger.java
index 6a7878a..b058775 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/MessageLogger.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/MessageLogger.java
@@ -1,35 +1,54 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
-public class MessageLogger extends AbstractWorkflowComponent {
-
+/**
+ * Prints a message to the log.
+ */
+public class MessageLogger extends AbstractWorkflowComponent2 {
+ private static final Log LOG = LogFactory.getLog(MessageLogger.class);
+
+ private static final String COMPONENT_NAME = "Message Logger";
+
private String message;
- public void setMessage( String m ) {
- message = m;
+ /**
+ * Sets the message.
+ *
+ * @param msg
+ * the message
+ */
+ public void setMessage(String msg) {
+ message = msg;
}
-
- public void checkConfiguration(Issues issues) {
+
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
}
-
+
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
- System.err.println(message);
+ LOG.info(message);
}
-
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PlatformHelper.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PlatformHelper.java
index 83b2eec..536d491 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PlatformHelper.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PlatformHelper.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesExtension.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesExtension.java
index 81c3d73..c0cdf36 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesExtension.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesExtension.java
@@ -1,18 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
import java.util.Properties;
import java.util.Map.Entry;
+/**
+ * Java helper class for Stdlib extension <tt>org::openarchitectureware::util::stdlib::properties</tt>.
+ */
public class PropertiesExtension {
private static final Properties p = new Properties();
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesReader.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesReader.java
index ee097c9..29ac670 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesReader.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/PropertiesReader.java
@@ -1,51 +1,130 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
-import java.io.File;
-import java.io.FileInputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+import org.eclipse.emf.mwe.core.resources.ResourceLoader;
+import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory;
-public class PropertiesReader extends AbstractWorkflowComponent{
+/**
+ * Reads a property file and makes it accessible through the
+ * <tt>org::openarchitectureware::util::stdlib::properties</tt> extensions.
+ *
+ * <h2>
+ * Properties</h2>
+ * <table>
+ * <tr>
+ * <th>Property</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><tt>propertiesFile</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>The properties file to read.</td>
+ * </tr>
+ * </table>
+ *
+ * <h2>Example</h2> Workflow configuration:
+ *
+ * <pre>
+ * &lt;component class=&quot;oaw.util.stdlib.PropertiesReader&quot;&gt;
+ * &lt;propertiesFile value=&quot;src/config1.properties&quot;/&gt;
+ * &lt;propertiesFile value=&quot;src/config2.properties&quot;/&gt;
+ * &lt;/component&gt;
+ * </pre>
+ *
+ * Config file <tt>config.properties</tt>:
+ *
+ * <pre>
+ * shapes = box,polygon,ellipse,point
+ * </pre>
+ *
+ * Usage in an extension file:
+ *
+ * <pre>
+ * extension org::openarchitectureware::util::stdlib::properties;
+ *
+ * cached List[String] SHAPES () : getProperty(&quot;shapes&quot;).split(&quot;,&quot;).trim();
+ * </pre>
+ *
+ */
+public class PropertiesReader extends AbstractWorkflowComponent2 {
+ private static final Log LOG = LogFactory.getLog(PropertiesReader.class);
+ private static final String COMPONENT_NAME = "Properties Reader";
-
-
- private String propertiesFile;
+ private List<String> propertiesFile;
- public void checkConfiguration(Issues issues) {
- if (propertiesFile==null || ! new File(propertiesFile).exists()){
- issues.addError("Propertiesfile not set or file does not exist: " + propertiesFile);
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if (propertiesFile == null || propertiesFile.isEmpty()) {
+ issues.addError("propertiesFile not set. ");
+ }
+ else {
+ for (String uri : propertiesFile) {
+ URL url = ResourceLoaderFactory.createResourceLoader().getResource(uri);
+ if (url == null) {
+ issues.addError("propertiesFile '" + uri + "' not found.");
+ }
+ }
}
}
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
- try {
- Properties p = new Properties();
- p.load(new FileInputStream(propertiesFile));
- PropertiesExtension.setProperties(p);
-
- } catch (Exception e) {
- issues.addError(e.getMessage(), e);
+ ResourceLoader rl = ResourceLoaderFactory.createResourceLoader();
+ for (String uri : propertiesFile) {
+ try {
+ Properties p = new Properties();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Reading properties file " + uri);
+ }
+ p.load(rl.getResourceAsStream(uri));
+ PropertiesExtension.setProperties(p);
+ }
+ catch (Exception e) {
+ issues.addError(e.getMessage(), e);
+ }
}
-
}
-
- public final void setPropertiesFile( String propertiesFile ) {
- this.propertiesFile = propertiesFile;
+
+ /**
+ * Adds a properties file.
+ *
+ * @param propertiesFile
+ * A properties file
+ */
+ public final void addPropertiesFile(String propFile) {
+ if (propertiesFile == null) {
+ propertiesFile = new ArrayList<String>();
+ }
+ this.propertiesFile.add(propFile);
+ }
+
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
}
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotCopier.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotCopier.java
index df6e9b6..2d2347f 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotCopier.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotCopier.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -16,10 +14,44 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
-public class SlotCopier extends AbstractWorkflowComponent {
+/**
+ * This component copies an element from one slot to another. The slot content
+ * is <i>not cloned</i>. <h2>Properties</h2>
+ * <table border="1">
+ * <tr>
+ * <th>Property</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><tt>fromSlot</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>Source slot name.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>toSlot</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>Destination slot name.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>removeTopLevelList</tt></td>
+ * <td>boolean</td>
+ * <td>no</td>
+ * <td>If <code>true</code> the source slot must contain a list and the top
+ * level list is removed (i.e. the first element from the list is copied to the
+ * destination slot), otherwise it is not removed.</td>
+ * </tr>
+ * </table>
+ */
+public class SlotCopier extends AbstractWorkflowComponent2 {
+
+ private static final String COMPONENT_NAME = "Slot Copier";
private String fromSlot;
private String toSlot;
@@ -27,49 +59,78 @@ public class SlotCopier extends AbstractWorkflowComponent {
private Log log = LogFactory.getLog(getClass());
-
- public void checkConfiguration(Issues issues) {
- if ( (fromSlot == null) || fromSlot.trim().equals("") ) {
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if ((fromSlot == null) || fromSlot.trim().equals("")) {
issues.addError(this, "fromSlot not specified");
}
- if ( (toSlot == null) || toSlot.trim().equals("") ) {
+ if ((toSlot == null) || toSlot.trim().equals("")) {
issues.addError(this, "toSlot not specified");
}
}
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getLogMessage()
+ */
@Override
public String getLogMessage() {
- return "slot '"+fromSlot+"' -> slot '"+toSlot+"'";
+ return "slot '" + fromSlot + "' -> slot '" + toSlot + "'";
}
-
+
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor mon, Issues issues) {
Object content = ctx.get(fromSlot);
- if ( content == null ) {
+ if (content == null) {
issues.addWarning(this, "fromSlot is null!");
- } else {
- if ( (content instanceof List) && removeTopLevelList ) {
- log.info("copying first element of "+content+" ["+content.getClass().getName()+"]");
- ctx.set( toSlot , ((List)content).get(0));
- } else {
- log.info("copying "+content+" ["+content.getClass().getName()+"]");
- ctx.set( toSlot , content);
- }
- }
+ }
+ else {
+ if ((content instanceof List) && removeTopLevelList) {
+ log.info("copying first element of " + content + " [" + content.getClass().getName() + "]");
+ ctx.set(toSlot, ((List<?>) content).get(0));
+ }
+ else {
+ log.info("copying " + content + " [" + content.getClass().getName() + "]");
+ ctx.set(toSlot, content);
+ }
+ }
}
+ /**
+ * Sets the source slot.
+ *
+ * @param fromSlot
+ * name of slot
+ */
public void setFromSlot(String fromSlot) {
this.fromSlot = fromSlot;
}
-
-
+ /**
+ * Sets the destination slot.
+ *
+ * @param toSlot
+ * name of slot
+ */
public void setToSlot(String toSlot) {
this.toSlot = toSlot;
}
+ /**
+ * Enables or disables the removal of the top level list.
+ *
+ * @param removeTopLevelList
+ * If <code>true</code>, the top level list is removed, otherwise
+ * it is not removed.
+ */
public void setRemoveTopLevelList(boolean removeTopLevelList) {
this.removeTopLevelList = removeTopLevelList;
}
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotListAdder.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotListAdder.java
index 93339a1..050ed81 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotListAdder.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotListAdder.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -18,71 +16,139 @@ import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
-public class SlotListAdder extends AbstractWorkflowComponent {
+/**
+ * This component copies an element from one slot to a list contained in another
+ * slot.
+ *
+ * <h2>Properties</h2>
+ * <table border="1">
+ * <tr>
+ * <th>Property</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <td><tt>modelSlot</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>Source slot name.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>listSlot</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>Target slot name. This slot contains a list of elements.</td>
+ * </tr>
+ * <tr>
+ * <tr>
+ * <td><tt>uniqueNames</tt></td>
+ * <td>boolean</td>
+ * <td>no</td>
+ * <td>If <code>true</code>, names have to be unique, otherwise not. Requires
+ * that <tt>modelSlot</tt> contains an <tt>EObject</tt>.</td>
+ * </tr>
+ * </table>
+ */
+public class SlotListAdder extends AbstractWorkflowComponent2 {
+
+ private static final String COMPONENT_NAME = "Slot List Adder";
private String modelSlot;
private String listSlot;
- private Set nameSet = new HashSet();
+ private Set<String> nameSet = new HashSet<String>();
private boolean uniqueNames;
-
+
+ /**
+ * Sets the list slot.
+ *
+ * @param listSlot
+ * name of slot
+ */
public void setListSlot(String listSlot) {
this.listSlot = listSlot;
}
-
+
+ /**
+ * Sets the model slot.
+ *
+ * @param modelSlot
+ * name of slot
+ */
public void setModelSlot(String modelSlot) {
this.modelSlot = modelSlot;
}
-
- public void setUniqueNames( boolean b ) {
- uniqueNames = b;
+
+ /**
+ * Sets if names have to be unique.
+ *
+ * @param uniqueNames
+ * If <code>true</code>, names have to be unique, otherwise not.
+ */
+ public void setUniqueNames(boolean uniqueNames) {
+ this.uniqueNames = uniqueNames;
}
-
- public void checkConfiguration(Issues issues) {
- if ( modelSlot == null ) {
+
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if (modelSlot == null) {
issues.addError(this, "no modelSlot specified.");
}
- if ( listSlot == null ) {
+ if (listSlot == null) {
issues.addError(this, "no listSlot specified.");
}
}
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getLogMessage()
+ */
@Override
public String getLogMessage() {
- return "adding contents of slot '"+modelSlot+"' to the list of stuff in '"+listSlot+"'";
+ return "adding contents of slot '" + modelSlot + "' to the list of stuff in '" + listSlot + "'";
}
-
+
+ @SuppressWarnings("unchecked")
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor mon, Issues issues) {
Object listContent = ctx.get(listSlot);
- if ( listContent == null ) {
- issues.addWarning(this, "'"+listSlot+"' is empty, creating a new list.");
+ if (listContent == null) {
+ issues.addWarning("'" + listSlot + "' is empty, creating a new list.", this);
listContent = new ArrayList();
- ctx.set( listSlot , listContent);
+ ctx.set(listSlot, listContent);
}
- if ( !(listContent instanceof Collection) ) {
- issues.addError(this, "contents of '"+listSlot+"' slot is not a collection, but rather a '"+listSlot.getClass().getName()+"'");
+ if (!(listContent instanceof Collection)) {
+ issues.addError("contents of '" + listSlot + "' slot is not a collection, but rather a '"
+ + listSlot.getClass().getName() + "'", this);
return;
}
Object modelContent = ctx.get(modelSlot);
- if ( modelContent == null ) {
- issues.addWarning(this, "'"+modelSlot+"' is empty; not adding anything to the '"+listSlot+"' slot.");
+ if (modelContent == null) {
+ issues
+ .addWarning("'" + modelSlot + "' is empty; not adding anything to the '" + listSlot + "' slot.",
+ this);
return;
}
- if ( uniqueNames ) {
- EObject eo = (EObject)modelContent;
- DynamicEcoreHelper h = new DynamicEcoreHelper( eo );
- String name = h.getName( eo );
- if ( !nameSet.contains(name) ) {
- ((Collection)listContent).add( modelContent );
- nameSet.add( name );
- }
- } else {
- ((Collection)listContent).add( modelContent );
+ if (uniqueNames) {
+ EObject eo = (EObject) modelContent;
+ DynamicEcoreHelper h = new DynamicEcoreHelper(eo);
+ String name = h.getName(eo);
+ if (!nameSet.contains(name)) {
+ ((Collection) listContent).add(modelContent);
+ nameSet.add(name);
+ }
+ }
+ else {
+ ((Collection) listContent).add(modelContent);
}
}
-
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotPrinter.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotPrinter.java
index d9d4464..9508823 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotPrinter.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SlotPrinter.java
@@ -1,47 +1,137 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
+import java.util.Arrays;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.mwe.core.WorkflowContext;
import org.eclipse.emf.mwe.core.issues.Issues;
-import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
-public class SlotPrinter extends AbstractWorkflowComponent {
-
+/**
+ * This component prints a workflow context slot content to the log. <h2>
+ * Properties</h2>
+ * <table border="1">
+ * <tr>
+ * <th>Property</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><tt>slotName</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>The name of a slot whose content should be dumped.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>message</tt></td>
+ * <td>String</td>
+ * <td>no</td>
+ * <td>An optional message that will be prefixed to the log output.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>level</tt></td>
+ * <td>String</td>
+ * <td>no</td>
+ * <td>The log level for the message. Valid values are
+ * <tt>TRACE, DEBUG, INFO, WARN</tt>.</td>
+ * </tr>
+ * </table>
+ */
+public class SlotPrinter extends AbstractWorkflowComponent2 {
+ private static final Log LOG = LogFactory.getLog(SlotPrinter.class);
+ private static final int TRACE = 0;
+ private static final int DEBUG = 1;
+ private static final int INFO = 2;
+ private static final int WARN = 3;
+ private static final String[] LEVELS = { "TRACE", "DEBUG", "INFO", "WARN" };
+
+ private static final String COMPONENT_NAME = "Slot Printer";
+
private String slotName;
private String message;
-
- public void setMessage( String m ) {
- this.message = m;
+ private int level = INFO;
+
+ /**
+ * Sets the message.
+ *
+ * @param msg
+ * the message
+ */
+ public void setMessage(String msg) {
+ this.message = msg;
}
-
- public void setSlotName( String name ) {
+
+ /**
+ * Sets the slot name.
+ *
+ * @param name
+ * name of slot
+ */
+ public void setSlotName(String name) {
this.slotName = name;
}
-
- public void checkConfiguration(Issues issues) {
- if ( slotName == null ) {
+
+ /**
+ * Sets the log level
+ *
+ * @param lvl
+ * The log level (TRACE, DEBUG, INFO, WARN, ERROR, FATAL).
+ */
+ public void setLevel(String lvl) {
+ int i = Arrays.binarySearch(LEVELS, lvl);
+ if (i == -1)
+ throw new IllegalArgumentException(lvl);
+ level = i;
+ }
+
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if (slotName == null) {
issues.addError(this, "slotName not specified");
}
}
-
+
@Override
protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
StringBuffer b = new StringBuffer();
- if ( message != null ) b.append(message+": ");
- b.append("(slot: "+slotName+")");
- b.append( ctx.get(slotName) );
- System.err.println(b.toString());
+ if (message != null) {
+ b.append(message + ": ");
+ }
+ b.append("(slot: " + slotName + ")");
+ b.append(ctx.get(slotName));
+
+ switch (level) {
+ case TRACE:
+ LOG.trace(b);
+ break;
+ case DEBUG:
+ LOG.debug(b);
+ break;
+ case INFO:
+ LOG.info(b);
+ break;
+ case WARN:
+ LOG.warn(b);
+ break;
+ }
}
-
+ /**
+ * @see org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent#getComponentName()
+ */
+ @Override
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SystemCommand.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SystemCommand.java
new file mode 100644
index 0000000..10b9b9a
--- /dev/null
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/SystemCommand.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *******************************************************************************/
+package org.eclipse.xtend.util.stdlib;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.mwe.core.WorkflowContext;
+import org.eclipse.emf.mwe.core.issues.Issues;
+import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2;
+import org.eclipse.emf.mwe.core.monitor.ProgressMonitor;
+
+/**
+ * This component executes a system command. <h2>
+ * Properties</h2>
+ * <table border="1">
+ * <tr>
+ * <th>Property</th>
+ * <th>Type</th>
+ * <th>Mandatory</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><tt>command</tt></td>
+ * <td>String</td>
+ * <td>yes</td>
+ * <td>The command to execute.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>directory</tt></td>
+ * <td>String</td>
+ * <td>no</td>
+ * <td>Execution directory.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>arg</tt></td>
+ * <td>String</td>
+ * <td>no</td>
+ * <td>(multiple) command arguments.</td>
+ * </tr>
+ * <tr>
+ * <td><tt>env</tt></td>
+ * <td>String</td>
+ * <td>no</td>
+ * <td>(multiple) additional environment entries. Format: [key],[value]</td>
+ * </tr>
+ * </table>
+ *
+ * <h2>Example</h2>
+ *
+ * <pre>
+ * &lt;component class=&quot;oaw.util.stdlib.SystemCommand&quot;&gt;
+ * &lt;directory value=&quot;src-gen&quot;/&gt;
+ * &lt;command value=&quot;sh&quot;/&gt;
+ * &lt;arg value=&quot;processdot.sh&quot;/&gt;
+ * &lt;/component&gt;
+ * </pre>
+ *
+ * @author Karsten Thoms
+ * @since 4.3.1
+ */
+public class SystemCommand extends AbstractWorkflowComponent2 {
+ private final static Log log = LogFactory.getLog(SystemCommand.class);
+
+ /**
+ * The execute command.
+ */
+ private String command;
+
+ private File directory;
+
+ private boolean inheritEnvironment = false;
+
+ private List<String> args = new ArrayList<String>();
+ private List<String> enventry = new ArrayList<String>();
+
+ @Override
+ protected void checkConfigurationInternal(Issues issues) {
+ if (command == null) {
+ issues.addError("command not specified");
+ }
+ }
+
+ @Override
+ protected void invokeInternal(WorkflowContext ctx, ProgressMonitor monitor, Issues issues) {
+ try {
+ int rc;
+ List<String> pbArgs = new ArrayList<String>();
+ pbArgs.add(command);
+ pbArgs.addAll(args);
+ ProcessBuilder pb = new ProcessBuilder(pbArgs);
+ if (directory != null) {
+ pb.directory(directory);
+ }
+ for (String env : enventry) {
+ String[] keyvalue = env.split(",");
+ pb.environment().put(keyvalue[0], keyvalue[1]);
+ }
+ if (inheritEnvironment) {
+ log.debug("Inheriting system environment.");
+ pb.environment().putAll(System.getenv());
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Environment:");
+ log.debug(pb.environment());
+ log.debug(System.getenv());
+ }
+ log
+ .info("Running command '" + pb.command() + "' in directory " + pb.directory().getAbsolutePath()
+ + " ...");
+ Process p = pb.start();
+ BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+
+ String lineRead;
+ while ((lineRead = br.readLine()) != null) {
+ log.info(lineRead);
+ }
+
+ br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ while ((lineRead = br.readLine()) != null) {
+ log.error(lineRead);
+ }
+ rc = p.waitFor();
+ if (rc != 0) {
+ issues.addError("Error running '" + command + "'");
+ return;
+ }
+ rc = p.exitValue();
+ if (rc != 0) {
+ issues.addError("Execution of command failed with error.");
+
+ }
+ else {
+ log.info("Execution of command was successful.");
+ }
+ }
+ catch (Exception re) {
+ issues.addError("Runtime error: " + re.getMessage());
+ }
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public void setDirectory(File directory) {
+ this.directory = directory;
+ }
+
+ public void addArg(String arg) {
+ args.add(arg);
+ }
+
+ public void addEnv(String entry) {
+ if (!entry.matches("\\A[^,]+,.+\\z"))
+ throw new IllegalArgumentException(entry);
+ enventry.add(entry);
+ }
+
+}
diff --git a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/TraceComponent.java b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/TraceComponent.java
index e67845a..c55a831 100644
--- a/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/TraceComponent.java
+++ b/plugins/org.eclipse.xtend.util.stdlib/src/org/eclipse/xtend/util/stdlib/TraceComponent.java
@@ -1,12 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 committers of openArchitectureWare and others.
+ * Copyright (c) 2005-2009 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors:
- * committers of openArchitectureWare - initial API and implementation
*******************************************************************************/
package org.eclipse.xtend.util.stdlib;
@@ -31,70 +29,72 @@ import org.eclipse.xtend.util.stdlib.tracing.TraceStore;
public class TraceComponent extends AbstractEMFWorkflowComponent {
+ private static final String COMPONENT_NAME = "Trace Component";
+
private String traceModelSlotName;
private String traceName;
private static TraceStore traceStore = new TraceStore();
private static Stack<String> fileStack = new Stack<String>();
private static int tokenValue = 0;
private static MapList cache = new MapList();
-
+
public static void createTrace(Object from, Object to, String kind) {
- TraceElement t = new M2MTraceElement( kind, (EObject)from, (EObject)to );
- traceStore.add( t );
+ TraceElement t = new M2MTraceElement(kind, (EObject) from, (EObject) to);
+ traceStore.add(t);
}
-
+
public static void createTrace(Object from, Collection to, String kind) {
- TraceElement t = new M2MTraceElement( kind, (EObject)from, (Collection<EObject>)to );
- traceStore.add( t );
+ TraceElement t = new M2MTraceElement(kind, (EObject) from, (Collection<EObject>) to);
+ traceStore.add(t);
}
-
+
public static void createTrace(Collection from, Object to, String kind) {
- TraceElement t = new M2MTraceElement( kind, (Collection<EObject>)from, (EObject)to );
- traceStore.add( t );
+ TraceElement t = new M2MTraceElement(kind, (Collection<EObject>) from, (EObject) to);
+ traceStore.add(t);
}
-
- public static String createCodeTrace( Object from, String kind ) {
- if ( !fileStack.isEmpty() ) {
+
+ public static String createCodeTrace(Object from, String kind) {
+ if (!fileStack.isEmpty()) {
String currentFile = fileStack.peek();
String token = createNewToken();
- TraceElement t = new M2CTraceElement( kind, (EObject)from, currentFile, token );
- traceStore.add( t );
+ TraceElement t = new M2CTraceElement(kind, (EObject) from, currentFile, token);
+ traceStore.add(t);
return token;
}
return "<unknown>";
}
private static String createNewToken() {
- return "TRACE_"+(tokenValue++);
+ return "TRACE_" + (tokenValue++);
}
public static Object getSingleTraceTarget(Object from, String kind) {
- List traces = traceStore.getTraces( from, kind );
- if (traces.size() == 0 ) return null;
- M2MTraceElement e = (M2MTraceElement)traces.get(0);
+ List traces = traceStore.getTraces(from, kind);
+ if (traces.size() == 0)
+ return null;
+ M2MTraceElement e = (M2MTraceElement) traces.get(0);
return e.getTargets().get(0);
}
public static Object getTraceTargets(Object from, String kind) {
- List traces = traceStore.getTraces( from, kind );
+ List traces = traceStore.getTraces(from, kind);
List targets = new ArrayList();
for (Iterator iterator = traces.iterator(); iterator.hasNext();) {
M2MTraceElement te = (M2MTraceElement) iterator.next();
- targets.addAll( te.getTargets() );
+ targets.addAll(te.getTargets());
}
return targets;
}
@Override
public String getLogMessage() {
- return "building trace model in slot '"+traceModelSlotName+"'";
+ return "building trace model in slot '" + traceModelSlotName + "'";
}
- public static void clearTrace(Object p) {
+ public static void clearTrace() {
traceStore.clear();
}
-
public void setTraceModelSlot(String slot) {
this.traceModelSlotName = slot;
}
@@ -105,26 +105,30 @@ public class TraceComponent extends AbstractEMFWorkflowComponent {
@Override
public void checkConfiguration(Issues issues) {
- if (traceModelSlotName == null)
+ if (traceModelSlotName == null) {
issues.addError(this, "you have to specify a traceModelSlot");
- if (traceName == null)
+ }
+ if (traceName == null) {
issues.addError(this, "you have to specify a traceName");
+ }
}
-
- protected void invokeInternal(WorkflowContext ctx, ProgressMonitor mon, Issues issues) {
- setUseSingleGlobalResourceSet( true );
+ @Override
+ public void invokeInternal(WorkflowContext ctx, ProgressMonitor mon, Issues issues) {
+ setUseSingleGlobalResourceSet(true);
try {
StandaloneSetup setup = new StandaloneSetup();
- setup.addRegisterEcoreFile("platform:/resource/org.eclipse.internal.xtend.util.stdlib/src/org/openarchitectureware/util/stdlib/trace.ecore");
+ setup
+ .addRegisterEcoreFile("platform:/resource/eclipse.xtend.util.stdlib/src/org/openarchitectureware/util/stdlib/trace.ecore");
EPackage pack = setup.getPackage("http://openarchitectureware.org/trace");
DynamicEcoreHelper h = new DynamicEcoreHelper(pack);
EObject model = h.create("Trace");
createElementList(h, model);
createBySource(h, model);
ctx.set(traceModelSlotName, model);
- } catch (Exception e) {
- issues.addError(this, e.getMessage() );
+ }
+ catch (Exception e) {
+ issues.addError(this, e.getMessage());
}
}
@@ -136,7 +140,7 @@ public class TraceComponent extends AbstractEMFWorkflowComponent {
Collection traces = cache.get(source);
for (Iterator iterator = traces.iterator(); iterator.hasNext();) {
EObject item = (EObject) iterator.next();
- h.add( bySource, "items", item);
+ h.add(bySource, "items", item);
}
h.add(model, "traceBySource", bySource);
}
@@ -144,39 +148,44 @@ public class TraceComponent extends AbstractEMFWorkflowComponent {
private void createElementList(DynamicEcoreHelper h, EObject model) {
EObject list = h.create("TraceList");
- h.set( model , "list", list);
+ h.set(model, "list", list);
for (Iterator iter = traceStore.getAllTraces().iterator(); iter.hasNext();) {
- TraceElement element = (TraceElement)iter.next();
+ TraceElement element = (TraceElement) iter.next();
EObject item = null;
- if ( element instanceof M2MTraceElement ) {
- M2MTraceElement