Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Can't create a Node with Border Nodes
Can't create a Node with Border Nodes [message #1716182] Wed, 02 December 2015 01:15 Go to next message
Vladimir Ilievski is currently offline Vladimir IlievskiFriend
Messages: 8
Registered: October 2015
Junior Member
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.

index.php/fa/24127/0/

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.
  • Attachment: 1.jpg
    (Size: 456.14KB, Downloaded 228 times)

[Updated on: Wed, 02 December 2015 01:15]

Report message to a moderator

Re: Can't create a Node with Border Nodes [message #1716542 is a reply to message #1716182] Fri, 04 December 2015 16:44 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 505
Registered: May 2011
Senior Member
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
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 Go to previous message
Vladimir Ilievski is currently offline Vladimir IlievskiFriend
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

Previous Topic:How to find if a diagram is already created for an element ?
Next Topic:Evaluating Sirius
Goto Forum:
  


Current Time: Wed Jan 27 08:03:08 GMT 2021

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

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

Back to the top