Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » objects from the model
objects from the model [message #1775101] Tue, 24 October 2017 14:51 Go to next message
Breno Zupeli is currently offline Breno ZupeliFriend
Messages: 8
Registered: October 2017
Junior Member
Hi,

I'd like to access the objects from the model in memory to use in another method. For this, i have to use a extension with External Java Action, like this https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#extensions

in the code bellow, i can access the information about style, but it's not what I want.
@Override
	public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
		for(EObject obj : selections) {
			TreeIterator<EObject> eAllContents = obj.eAllContents();
			while(eAllContents.hasNext()) {
				EObject next = eAllContents.next();
				EList<EAttribute> nameElement = next.eClass().getEAllAttributes();
			}
		}
	}


I want information about the packages, classes, attributes, etc of the model.
How can I do this? It's possible? Sorry, I'm a beginner in sirius.

Thanks
Re: objects from the model [message #1775140 is a reply to message #1775101] Wed, 25 October 2017 08:58 Go to previous messageGo to next message
M V is currently offline M VFriend
Messages: 31
Registered: July 2017
Member
Maybe you must a change context Model Operations https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#goto before you call you extensions.

change context expression:
var:self

Re: objects from the model [message #1775142 is a reply to message #1775101] Wed, 25 October 2017 09:01 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

Can you be more specific about the context?
From where your action is called?


Also external actions are not recommended. Prefer using services: https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#service_methods


Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: objects from the model [message #1775150 is a reply to message #1775142] Wed, 25 October 2017 12:18 Go to previous messageGo to next message
Breno Zupeli is currently offline Breno ZupeliFriend
Messages: 8
Registered: October 2017
Junior Member
I'm using a popup menu to call a Java Action, in the method called I've got to access all the contents of the model to generate code.
Re: objects from the model [message #1775223 is a reply to message #1775150] Thu, 26 October 2017 13:26 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
You have to get the semantic elements from the representation element you get with:
((DRepresentationElement)obj).getTarget()


Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: objects from the model [message #1775309 is a reply to message #1775223] Fri, 27 October 2017 13:08 Go to previous message
Breno Zupeli is currently offline Breno ZupeliFriend
Messages: 8
Registered: October 2017
Junior Member
Pierre Guilet wrote on Thu, 26 October 2017 13:26
You have to get the semantic elements from the representation element you get with:
((DRepresentationElement)obj).getTarget()


Regards,

Pierre


This worked. Thank you!
Previous Topic:[Sirius] generate the representations.aird in XML file
Next Topic:Tools for Tables
Goto Forum:
  


Current Time: Sat Dec 07 05:57:44 GMT 2024

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

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

Back to the top