Skip to main content



      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 18:19 Go to next message
Eclipse UserFriend
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 00:46 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Wed, 13 September 2017 01:05] by Moderator

Re: How to specify an array value in mwe2 [message #1772611 is a reply to message #1772609] Wed, 13 September 2017 00:57 Go to previous message
Eclipse UserFriend
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
}
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: Sat Jul 05 06:51:56 EDT 2025

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

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

Back to the top