Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to specify an array value in mwe2
How to specify an array value in mwe2 [message #1772598] Tue, 12 September 2017 22:19 Go to next message
Waqas Ilyas is currently offline Waqas IlyasFriend
Messages: 80
Registered: July 2009
Member
So if my fragment class has a String array data member, or an ArrayList<String> data member, how do I initialize it in mwe2?

for example:
mwe2...
fragment = MyFragment {
	myList = ArrayList {
		// ?????
	}
}
...

fragment...
class MyFragment extends AbstractXtextGeneratorFragment {
	@Accessors ArrayList<String> myList
....
}


I can't seem to find the syntax for filling the ArrayList. Or the only way is to create addMyListItem(String i) method?
Re: How to specify an array value in mwe2 [message #1772609 is a reply to message #1772598] Wed, 13 September 2017 04:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
You usually add a method addXxxx
And the do xxxx = "a" xxxx="b" in the workflow

you might have a look at this hidden treasure that was removed for whyever from the main xtext doc (maybe cause it parially outdated, i dont know)

https://eclipse.org/Xtext/documentation/306_mwe2.html


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 13 September 2017 05:05]

Report message to a moderator

Re: How to specify an array value in mwe2 [message #1772611 is a reply to message #1772609] Wed, 13 September 2017 04:57 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
example:

validator = {
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
composedCheck = "bla.blubb.Validator"
}

val List<String> composedChecks = newArrayList

/**
* Adds a validator that is to be executed additionally.
*
* @param composedCheckValidator
* name of a class extending {@link AbstractDeclarativeValidator}
*/
def void addComposedCheck(String composedCheckValidator) {
composedChecks += composedCheckValidator
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:How to get images from other plug-in using PluginImageHelper
Next Topic:tycho question. postpone xtend source code generation
Goto Forum:
  


Current Time: Tue Apr 23 07:23:07 GMT 2024

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top