|
Re: Can't create a Node with Border Nodes [message #1716542 is a reply to message #1716182] |
Fri, 04 December 2015 16:44 |
|
Hello,
Your method generateConnectorDeclarationPortParameters() calls
getPortParameters() and getPortParameters() calls
generateConnectorDeclarationPortParameters() so it looks like a loop
that explain why Eclipse is not responding.
However, I do not think that you need java code to do this. In the Node
creation tool that creates your ConnectorDeclaration element, you can
ask a "for" operation with expression "connectorType.getPorts().size()".
Inside this "for" operation you add a CreateInstance operation typed
PortDeclarationReferenceParameter with referenceName "portParameters".
Regards,
Steve
Le 02/12/2015 02:15, Vladimir Ilievski a écrit :
> Hello everyone,
>
> I have a problem when I want to create a Node in the way I will describe below.
>
> In my meta-model I have a class named ConnectorDeclaration which contains a list of objects of the class PortDeclarationReferenceParameter (named portParameters), and an object of class ConnectorType (named type). In the ConnectorType class there is a list of objects of the class ConnectorPortParameterDeclaration (named ports). See next picture for all of this.
>
>
>
> When I want to create a Node which will represents and instance of the class ConnectorDeclaration, in the same time I want to fill the list portParameters and this objects to show as a Border Nodes. The size of this list is the same with the size of the list ports in the ConnectorType class.
>
> I am doing this using Service, and call the function getPortParameters in the Semantic Candidate Expression when creating the Border Node. The Java code for the service is:
>
>
> public void generateConnectorDeclarationPortParameters(ConnectorDeclaration connectorDeclaration) {
>
> /* The Port Factory */
> PortFactory portFactory = new PortFactoryImpl();
> /* The resulting list */
> List<PortDeclarationReferenceParameter> result = new LinkedList<PortDeclarationReferenceParameter>();
>
> /* Get the type of the connector */
> ConnectorType connectorType = connectorDeclaration.getType();
>
> if (connectorType != null) {
> /*
> * The number of Port Declaration Reference Parameters to be created
> */
> int numOfPortParams = connectorType.getPorts().size();
>
> for (int i = 0; i < numOfPortParams; i++) {
> PortDeclarationReferenceParameter temp = portFactory.createPortDeclarationReferenceParameter();
> connectorDeclaration.getPortParameters().add(temp);
> }
> }
> }
>
> public EList<PortDeclarationReferenceParameter> getPortParameters(ConnectorDeclaration connectorDeclaration) {
> this.generateConnectorDeclarationPortParameters(connectorDeclaration);
> return connectorDeclaration.getPortParameters();
> }
>
>
>
>
> The problem is, when I do this the Eclipse is not responding, which means there is a problem.
>
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Can't create a Node with Border Nodes [message #1716705 is a reply to message #1716542] |
Mon, 07 December 2015 16:13 |
Vladimir Ilievski Messages: 8 Registered: October 2015 |
Junior Member |
|
|
Hello,
thank you for the answer. But, in fact there is another problem. In the time when I will create an instance of the ConnectorDeclaration the type is not set. So after creating an instance, in the Properties window I set the type of the ConnectorDeclaration. I implemented your solution, but because of this issue the Border Nodes are not appearing. I tried to put a fix number in the Expression in the for loop (let's say 1), and it worked. So, I think the problem is how to do the same, but after seting the type in the Properties window.
[Updated on: Mon, 07 December 2015 16:14] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03320 seconds