file Create a custom link

5 years 5 months ago #2966 by Nico42
Hello,

I've an issue with the ILinkCommand interface, more precisly with the acceptFirstElement()

I override it and did only the necessary steps to arrive at this point:
@Override
	public boolean acceptFirstElement(IDiagramHandle arg0, IDiagramGraphic arg1) {
		System.out.println("First element returns true");
		return true;
	}

	@Override
	public boolean acceptSecondElement(IDiagramHandle arg0,	IDiagramGraphic arg1, IDiagramGraphic arg2) {
		System.out.println("Second element returns true");
		return true;
	}

As you can guess, the console is full of "First element returns true" but the element still stays colored in red, and wont allow to click to start a link.

I'd like your help on this.

Modelio version : 3.1

Please Log in or Create an account to join the conversation.

5 years 5 months ago - 5 years 5 months ago #2969 by ebr
Hi Nico,

Maybe the issue does not come from this part of your code.

When you register your command you provide a Metaclass, e.g. Link.class, am I right? This metaclass will also play a role on the behaviour of your command...

For example a Connector can only be created between two bindableInstances so all ILinkCommand registered with this Connector.class metaclass will not be able to connect two classes even if I override the acceptFirstElement and acceptSecondElement methods.

Hoping it is clear and helpful.

Regards,

EBR

Please Log in or Create an account to join the conversation.

5 years 5 months ago #2970 by Nico42
Thx for your answer ebr.

For the Link.class, i wansn't clear sorry. I'm using the metaclass Association.

To make it clearer, the same code was working on modelio 2.2, so maybe there are a few things that have changed that i didn't identify ?

I'm quite lost for now, as you mentioned, I tried different kind of metaclass (Link, Association, NaryAssociation, etc..) but with the same result. I don't need to specifically use Association.class, just to link two elements with the less possible constraints.

Hoping there is enough elemnts to solve the problem,

thanx.

Please Log in or Create an account to join the conversation.

5 years 5 months ago - 5 years 5 months ago #2971 by ebr

just to link two elements with the less possible constraints

=> Dependency metaclasse definitely.

Please Log in or Create an account to join the conversation.

5 years 5 months ago #2972 by Nico42
It was the solution!

But there is another little thing, i tried to play with the properties but without success for removing this:


I bet it's another single line to put somewhere, but well, i don't know where :(
Attachments:

Please Log in or Create an account to join the conversation.

5 years 5 months ago #2973 by ebr
I am not sure to understand your issue.
You applied a unnamed stereotype to your link and now you stille want to have it but you do not want to see the <<>>, am I right?
Have you tried to play with the Stereotypes display mode field in the symbol view?
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: tmachmaab
Time to create page: 0.317 seconds
^ Back to Top