Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » OCl to check whether link is coming form source feature defined(Please Help))
OCl to check whether link is coming form source feature defined(Please Help)) [message #220849] Tue, 10 March 2009 07:56 Go to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi All

I have many link mappings defined
1. LinkMapping <LINK{LINK.Asource:A->LINK.Adestination:A}/LINK>

Element EClass LINK


SourceFeature :ERefrenceAsource
TargetFeature :ERefrenceAdestination

DIagram Link Connection LINK

2. LinkMapping <LINK{LINK.Bsource:B->LINK.Bdestination:B}/LINK>
Element EClass LINK


SourceFeature :ERefrenceBsource
TargetFeature :ERefrenceBdestination

DIagram Link Connection LINK

how can i add a constraint to check that the link created is always from
Asource to Adestination when i connect Asource to Adestination . similarly
link create is from BSource to BDestination when i connect Bsource to
Bdestination

Since same class LINK is used to connect.

Without constraint it always ececutes first link mapping.

Please help.

Thanks and Regards
Govind
Re: OCl to check whether link is coming form source feature defined(Please Help)) [message #221098 is a reply to message #220849] Tue, 10 March 2009 16:21 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello govind,

Try creating source and target and link constraints for both links like:
"self.oclIsKindOf(A)", "self.oclIsKindOf(B)"

-----------------
Alex Shatalin
Re: OCl to check whether link is coming form source feature defined(Please Help) [message #221106 is a reply to message #221098] Tue, 10 March 2009 16:46 Go to previous message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi Alex,

Thanks for the suggestion.
This i had thought that i have specify the OCL.

This the same Linking Mapping Issue which i had posted which is working
now with below code.

I added some constraints and checks

if (XXXPackage.eINSTANCE.getLink().isSuperTypeOf(
domainElement.eClass())&& (domainElement == null ||
isLinkWithClassLink_3001((LINK) domainElement))) {
return LINKEditPart.VISUAL_ID;
}

I added && condition check as it was always checking in first if-block
,now with && the condition its working.

private static boolean isLinkWithClassLINK_3001(LINK element) {
if(element.getAsrc()!= null&& element.getBdest()!=null){
return true;
}else{
return false;
}
}


For the all the links in
public static int getLinkWithClassVisualID(EObject domainElement) method
of XXXVisualIDRegistry.


Now All the link are working properly.
Is it the right approach

Regards
Govind R
Previous Topic:How to define Top and Bottom for TopDownLayoutProvider?
Next Topic:how to create first topic on canvas in Mindmap example
Goto Forum:
  


Current Time: Thu Apr 25 06:52:32 GMT 2024

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

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

Back to the top