Home » Modeling » GMF (Graphical Modeling Framework) » UML2 associations, again
UML2 associations, again [message #60612] |
Mon, 09 October 2006 21:03 |
Eclipse User |
|
|
|
Originally posted by: alexander.schwartzonline.de
Hi,
I am working on a tiny UML2 Use Case Editor using the
UML2 model (yes, I know about the MDT project)
-- and I have problems to create a link for an Association.
I know I'm not the first one asking about it, but unfortunately
I was not able to find a solution in the previous discussion
threads.
I tried to reproduce the solution in the the old UML clazz example by
Alex Shatlin, but I assume catched up only a small portion of it.
I modelled the link in my gmfmap as follows:
<links>
<domainMetaElement
href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Assoc iation "/>
<labelMappings
readOnly="true"
viewPattern=""
editPattern="">
<diagramLabel
href="usecase.gmfgraph#ExtendLabel"/>
</labelMappings>
<containmentFeature
href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Packa ge/packagedElement "/>
<tool
xsi:type="gmftool:CreationTool"
href="usecase.gmftool#//@palette/@tools.1/@tools.1"/>
<diagramLink
href="usecase.gmfgraph#Association"/>
<sourceMetaFeature
xsi:type="ecore:EReference"
href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Names pace/ownedMember "/>
<linkMetaFeature
xsi:type="ecore:EReference"
href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Names pace/ownedMember "/>
</links>
The generated diagram code is customized:
A custom creation command creates the memberEnds of the Association:
protected static abstract class CreateAssociationCommand extends
CreateRelationshipCommand {
public CreateAssociationCommand(CreateRelationshipRequest request) {
super(request);
}
protected EObject doDefaultElementCreation() {
Association newElement = (Association) super
.doDefaultElementCreation();
if (newElement != null) {
Property sourceEnd = UMLFactory.eINSTANCE.createProperty();
sourceEnd.setName("src");
sourceEnd.setType((Type) getSource());
newElement.getOwnedEnds().add(sourceEnd);
Property targetEnd = UMLFactory.eINSTANCE.createProperty();
targetEnd.setName("dst");
targetEnd.setType((Type) getTarget());
newElement.getOwnedEnds().add(targetEnd);
}
return newElement;
}
}
Every CreateIncomingAssociation4004Command uses the custom creation
command as follows:
/**
* @generated NOT
*/
private static class CreateIncomingAssociation4004Command extends
CreateAssociationCommand {
/**
* @generated
*/
public CreateIncomingAssociation4004Command(
CreateRelationshipRequest req) {
super(req);
}
/**
* @generated
*/
protected EClass getEClassToEdit() {
return UMLPackage.eINSTANCE.getPackage();
};
/**
* @generated
*/
protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
/**
* @generated NOT
*/
protected EObject doDefaultElementCreation() {
return super.doDefaultElementCreation();
}
}
With these changes an Association can be created in the diagramm editor,
but an NullPointerException is raised
Caused by: java.lang.NullPointerException
at org.eclipse.draw2d.Figure.add(Figure.java:146)
at org.eclipse.draw2d.Figure.add(Figure.java:179)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addChild Visual(AbstractGraphicalEditPart.java:198)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:197)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at
org.eclipse.gef.editparts.AbstractConnectionEditPart.refresh (AbstractConnectionEditPart.java:221)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art.access$1(ConnectionEditPart.java:1)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art$5.run(ConnectionEditPart.java:915)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.runExclusive(TransactionalEditingDomainImpl.java:258)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art.refresh(ConnectionEditPart.java:912)
at
org.eclipse.gef.editparts.AbstractConnectionEditPart.setTarg et(AbstractConnectionEditPart.java:295)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addTarge tConnection(AbstractGraphicalEditPart.java:261)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refreshT argetConnections(AbstractGraphicalEditPart.java:657)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt.handleNotificationEvent(ShapeNodeEditPart.java:218)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.notifyChanged(GraphicalEditPart.java:1217)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.fireNotification(DiagramEventBroker.java:347)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.handleElementEvent(DiagramEventBroker.java:673)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.resourceSetChanged(DiagramEventBroker.java:305)
at
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramEventBrok erThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe .java:72)
at
org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFac tory$DiagramEditingDomain.postcommit(DiagramEditingDomainFac tory.java:193)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.deactivate(TransactionalEditingDomainImpl.java:471)
at
org.eclipse.emf.transaction.impl.TransactionImpl.close(Trans actionImpl.java:524)
at
org.eclipse.emf.transaction.impl.TransactionImpl.commit(Tran sactionImpl.java:365)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:133)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:509)
... 34 more
The created model file looks alright:
<?xml version="1.0" encoding="UTF-8"?>
<uml:Package xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xmi:id="_epGAcFfYEdux36m_D9W2Kw">
<packagedElement xmi:type="uml:Actor" xmi:id="_e08EEFfYEdux36m_D9W2Kw"/>
<packagedElement xmi:type="uml:UseCase"
xmi:id="_fE4kkFfYEdux36m_D9W2Kw"/>
<packagedElement xmi:type="uml:Association"
xmi:id="_fYp1IFfYEdux36m_D9W2Kw" memberEnd="_fYp1IVfYEdux36m_D9W2Kw
_fYp1IlfYEdux36m_D9W2Kw">
<ownedEnd xmi:id="_fYp1IVfYEdux36m_D9W2Kw" name="src"
type="_e08EEFfYEdux36m_D9W2Kw" association="_fYp1IFfYEdux36m_D9W2Kw"/>
<ownedEnd xmi:id="_fYp1IlfYEdux36m_D9W2Kw" name="dst"
type="_fE4kkFfYEdux36m_D9W2Kw" association="_fYp1IFfYEdux36m_D9W2Kw"/>
</packagedElement>
</uml:Package>
Here is the corresponding section in the notation model:
<edges xmi:type="notation:Edge" xmi:id="_fYp1I1fYEdux36m_D9W2Kw"
type="4004" source="_e08EEVfYEdux36m_D9W2Kw"
target="_fE4kkVfYEdux36m_D9W2Kw">
<children xmi:type="notation:Node" xmi:id="_fYp1KFfYEdux36m_D9W2Kw"
type="6003">
<layoutConstraint xmi:type="notation:Location"
xmi:id="_fYp1KVfYEdux36m_D9W2Kw" y="40"/>
</children>
<styles xmi:type="notation:RoutingStyle"
xmi:id="_fYp1JFfYEdux36m_D9W2Kw"/>
<styles xmi:type="notation:FontStyle"
xmi:id="_fYp1JVfYEdux36m_D9W2Kw"/>
<styles xmi:type="notation:LineStyle"
xmi:id="_fYp1JlfYEdux36m_D9W2Kw"/>
<element xmi:type="uml:Association"
href="default3.uml#_fYp1IFfYEdux36m_D9W2Kw"/>
<bendpoints xmi:type="notation:RelativeBendpoints"
xmi:id="_fYp1J1fYEdux36m_D9W2Kw" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
</edges>
Has anyone a working solution?
Thanks any hints in advance,
Alex
|
|
|
Re: UML2 associations, again [message #60618 is a reply to message #60612] |
Tue, 10 October 2006 06:53 |
Michael Golubev Messages: 383 Registered: July 2009 |
Senior Member |
|
|
Hi,
I am successor of Alexander Shatalin in the UML diagrams implementation and
I have recently added almost complete UML2 association notation into the
editor class diagram (the only difference is that it in actually does not
include "dots" to denote owners of the ends and arrows for navigability).
I am not sure that I comletely understand your sample internals, but I see
some differences in the implementation.
(major one) : I had to change PackageCanonicalEditPolicy to collect
association descriptors in order to be consistent with changes in the
creation code. It looks like your exception is thrown when the creation
command have been already fired, and post-transaction notification is
broadcasted. Thus, I may guess that problem is in the canonical
editpolicy -- in case it is consistent, it should NOT create any new links,
because all edges are already in their places.
(minor one) : In the create command I am creating associations using
Type:createAssociation() uml2 helper method, delegating creation to the
UML2. It allows to setup the owners of association ends based on end
navigability.
Hope this helps,
Michael
//from PackageCanonicalEditPolicy
/**
* @generated NOT
*/
private void storeTypeModelFacetLinks_Association_4005(EObject container,
EClass containerMetaclass) {
if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(containerMe taclass)) {
for (Iterator values = ((org.eclipse.uml2.uml.Package)
container).getPackagedElements().iterator(); values.hasNext();) {
EObject nextValue = ((EObject) values.next());
int linkVID = UMLVisualIDRegistry.getLinkWithClassVisualID(nextValue);
if (AssociationEditPart.VISUAL_ID == linkVID) {
Association association = (Association) nextValue;
if (association.isBinary()) {
Property sourceEnd =
AssociationEndConvention.getSourceEnd(association);
Property targetEnd =
AssociationEndConvention.getTargetEnd(association);
EObject gmfSource = sourceEnd.getType();
EObject gmfTarget = targetEnd.getType();
myLinkDescriptors.add(new LinkDescriptor(gmfSource, gmfTarget,
association, linkVID));
}
}
}
}
}
/**
* @NOT-GENERATED
*/
protected static abstract class CreateAssociationCommand extends
CreateRelationshipCommand {
public CreateAssociationCommand(CreateRelationshipRequest request) {
super(request);
}
protected EObject doDefaultElementCreation() {
Type sourceType = (Type)getSource();
Type targetType = (Type)getTarget();
//due to association end conventiontions (see AssociationEndConvention)
//we need to have member end of type SourceType to be the first one
created
//thus, we are calling UML2 createAssociation() in opposite order
Association result = targetType.createAssociation(//
false, AggregationKind.NONE_LITERAL, "src", 1, 1, //
sourceType, false, AggregationKind.NONE_LITERAL, "dst", 1, 1);
return result;
}
}
public class AssociationEndConvention {
public static Property getMemberEnd(Association association, boolean
sourceNotTarget){
return (Property)association.getMemberEnds().get(sourceNotTarget ? 0 : 1);
}
public static Property getSourceEnd(Association association){
return getMemberEnd(association, true);
}
public static Property getTargetEnd(Association association){
return getMemberEnd(association, false);
}
}
"Alexander Schwartz" <alexander@schwartzonline.de> wrote in message
news:egede6$47l$1@utils.eclipse.org...
> Hi,
>
> I am working on a tiny UML2 Use Case Editor using the
> UML2 model (yes, I know about the MDT project)
> -- and I have problems to create a link for an Association.
>
> I know I'm not the first one asking about it, but unfortunately
> I was not able to find a solution in the previous discussion
> threads.
>
>
> I tried to reproduce the solution in the the old UML clazz example by
> Alex Shatlin, but I assume catched up only a small portion of it.
>
> I modelled the link in my gmfmap as follows:
>
> <links>
> <domainMetaElement
>
> href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Assoc iation "/>
> <labelMappings
> readOnly="true"
> viewPattern=""
> editPattern="">
> <diagramLabel
> href="usecase.gmfgraph#ExtendLabel"/>
> </labelMappings>
> <containmentFeature
> href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Packa ge/packagedElement "/>
> <tool
> xsi:type="gmftool:CreationTool"
> href="usecase.gmftool#//@palette/@tools.1/@tools.1"/>
> <diagramLink
> href="usecase.gmfgraph#Association"/>
> <sourceMetaFeature
> xsi:type="ecore:EReference"
>
> href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Names pace/ownedMember "/>
> <linkMetaFeature
> xsi:type="ecore:EReference"
>
> href=" ../../../plugin/org.eclipse.uml2.uml/model/UML.ecore#//Names pace/ownedMember "/>
> </links>
>
> The generated diagram code is customized:
> A custom creation command creates the memberEnds of the Association:
>
> protected static abstract class CreateAssociationCommand extends
> CreateRelationshipCommand {
>
> public CreateAssociationCommand(CreateRelationshipRequest request) {
> super(request);
> }
>
> protected EObject doDefaultElementCreation() {
> Association newElement = (Association) super
> .doDefaultElementCreation();
> if (newElement != null) {
> Property sourceEnd = UMLFactory.eINSTANCE.createProperty();
> sourceEnd.setName("src");
> sourceEnd.setType((Type) getSource());
> newElement.getOwnedEnds().add(sourceEnd);
>
> Property targetEnd = UMLFactory.eINSTANCE.createProperty();
> targetEnd.setName("dst");
> targetEnd.setType((Type) getTarget());
> newElement.getOwnedEnds().add(targetEnd);
> }
>
> return newElement;
> }
> }
>
>
> Every CreateIncomingAssociation4004Command uses the custom creation
> command as follows:
>
> /**
> * @generated NOT
> */
> private static class CreateIncomingAssociation4004Command extends
> CreateAssociationCommand {
>
> /**
> * @generated
> */
> public CreateIncomingAssociation4004Command(
> CreateRelationshipRequest req) {
> super(req);
> }
>
> /**
> * @generated
> */
> protected EClass getEClassToEdit() {
> return UMLPackage.eINSTANCE.getPackage();
> };
>
> /**
> * @generated
> */
> protected void setElementToEdit(EObject element) {
> throw new UnsupportedOperationException();
> }
>
> /**
> * @generated NOT
> */
> protected EObject doDefaultElementCreation() {
> return super.doDefaultElementCreation();
> }
> }
>
> With these changes an Association can be created in the diagramm editor,
> but an NullPointerException is raised
>
> Caused by: java.lang.NullPointerException
> at org.eclipse.draw2d.Figure.add(Figure.java:146)
> at org.eclipse.draw2d.Figure.add(Figure.java:179)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.addChild Visual(AbstractGraphicalEditPart.java:198)
> at
> org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:197)
> at
> org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
> at
> org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
> at
> org.eclipse.gef.editparts.AbstractConnectionEditPart.refresh (AbstractConnectionEditPart.java:221)
> at
> org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art.access$1(ConnectionEditPart.java:1)
> at
> org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art$5.run(ConnectionEditPart.java:915)
> at
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.runExclusive(TransactionalEditingDomainImpl.java:258)
> at
> org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditP art.refresh(ConnectionEditPart.java:912)
> at
> org.eclipse.gef.editparts.AbstractConnectionEditPart.setTarg et(AbstractConnectionEditPart.java:295)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.addTarge tConnection(AbstractGraphicalEditPart.java:261)
> at
> org.eclipse.gef.editparts.AbstractGraphicalEditPart.refreshT argetConnections(AbstractGraphicalEditPart.java:657)
> at
> org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPa rt.handleNotificationEvent(ShapeNodeEditPart.java:218)
> at
> org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.notifyChanged(GraphicalEditPart.java:1217)
> at
> org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.fireNotification(DiagramEventBroker.java:347)
> at
> org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.handleElementEvent(DiagramEventBroker.java:673)
> at
> org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.resourceSetChanged(DiagramEventBroker.java:305)
> at
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramEventBrok erThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe .java:72)
> at
> org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFac tory$DiagramEditingDomain.postcommit(DiagramEditingDomainFac tory.java:193)
> at
> org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.deactivate(TransactionalEditingDomainImpl.java:471)
> at
> org.eclipse.emf.transaction.impl.TransactionImpl.close(Trans actionImpl.java:524)
> at
> org.eclipse.emf.transaction.impl.TransactionImpl.commit(Tran sactionImpl.java:365)
> at
> org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:133)
> at
> org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
> at
> org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
> at
> org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
> at
> org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
> at
> org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:400)
> at
> org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:129)
> at
> org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:509)
> ... 34 more
>
> The created model file looks alright:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Package xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_epGAcFfYEdux36m_D9W2Kw">
> <packagedElement xmi:type="uml:Actor" xmi:id="_e08EEFfYEdux36m_D9W2Kw"/>
> <packagedElement xmi:type="uml:UseCase"
> xmi:id="_fE4kkFfYEdux36m_D9W2Kw"/>
> <packagedElement xmi:type="uml:Association"
> xmi:id="_fYp1IFfYEdux36m_D9W2Kw" memberEnd="_fYp1IVfYEdux36m_D9W2Kw
> _fYp1IlfYEdux36m_D9W2Kw">
> <ownedEnd xmi:id="_fYp1IVfYEdux36m_D9W2Kw" name="src"
> type="_e08EEFfYEdux36m_D9W2Kw" association="_fYp1IFfYEdux36m_D9W2Kw"/>
> <ownedEnd xmi:id="_fYp1IlfYEdux36m_D9W2Kw" name="dst"
> type="_fE4kkFfYEdux36m_D9W2Kw" association="_fYp1IFfYEdux36m_D9W2Kw"/>
> </packagedElement>
> </uml:Package>
>
> Here is the corresponding section in the notation model:
>
> <edges xmi:type="notation:Edge" xmi:id="_fYp1I1fYEdux36m_D9W2Kw"
> type="4004" source="_e08EEVfYEdux36m_D9W2Kw"
> target="_fE4kkVfYEdux36m_D9W2Kw">
> <children xmi:type="notation:Node" xmi:id="_fYp1KFfYEdux36m_D9W2Kw"
> type="6003">
> <layoutConstraint xmi:type="notation:Location"
> xmi:id="_fYp1KVfYEdux36m_D9W2Kw" y="40"/>
> </children>
> <styles xmi:type="notation:RoutingStyle"
> xmi:id="_fYp1JFfYEdux36m_D9W2Kw"/>
> <styles xmi:type="notation:FontStyle"
> xmi:id="_fYp1JVfYEdux36m_D9W2Kw"/>
> <styles xmi:type="notation:LineStyle"
> xmi:id="_fYp1JlfYEdux36m_D9W2Kw"/>
> <element xmi:type="uml:Association"
> href="default3.uml#_fYp1IFfYEdux36m_D9W2Kw"/>
> <bendpoints xmi:type="notation:RelativeBendpoints"
> xmi:id="_fYp1J1fYEdux36m_D9W2Kw" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
> </edges>
>
> Has anyone a working solution?
> Thanks any hints in advance,
>
> Alex
|
|
|
Re: UML2 associations, again [message #60640 is a reply to message #60618] |
Tue, 10 October 2006 18:30 |
Eclipse User |
|
|
|
Originally posted by: alexander.schwartzonline.de
Hello Michael,
thanks for your help!
> I am not sure that I comletely understand your sample internals, but I see
> some differences in the implementation.
>
> (major one) : I had to change PackageCanonicalEditPolicy to collect
> association descriptors in order to be consistent with changes in the
> creation code. It looks like your exception is thrown when the creation
> command have been already fired, and post-transaction notification is
> broadcasted.
yes, my debugging session yield that the exception is throw after the
creation of the association.
Thus, I may guess that problem is in the canonical
> editpolicy -- in case it is consistent, it should NOT create any new links,
> because all edges are already in their places.
> (minor one) : In the create command I am creating associations using
> Type:createAssociation() uml2 helper method, delegating creation to the
> UML2. It allows to setup the owners of association ends based on end
> navigability.
>
I tried to use your suggested solution and added
CreateAssociationCommand to PackageCanonicalEditPolicy.
What I not known exactly is how this new CreateAssociationCommand is to
be used. I examined two approaches:
(1) With the following version CreateIncomingAssociation4004Command
I still run into the problem with my exception.
/**
* @generated NOT
*/
private static class CreateIncomingAssociation4004Command extends
CreateAssociationCommand {
/**
* @generated
*/
public CreateIncomingAssociation4004Command(
CreateRelationshipRequest req) {
super(req);
}
/**
* @generated
*/
protected EClass getEClassToEdit() {
return UMLPackage.eINSTANCE.getPackage();
};
/**
* @generated
*/
protected void setElementToEdit(EObject element) {
throw new UnsupportedOperationException();
}
/**
* @generated NOT
*/
protected EObject doDefaultElementCreation() {
return super.doDefaultElementCreation();
}
}
(2) With the following version the diagram cursor permits to insert an
Association link:
/**
* @generated NOT
*/
private static class CreateIncomingAssociation4004Command extends
CreateAssociationCommand {
/**
* @generated
*/
public CreateIncomingAssociation4004Command(
CreateRelationshipRequest req) {
super(req);
}
}
How you are using the CreateIncomingAssociation4004Command?
Thanks for help,
Alex
|
|
|
Re: UML2 associations, again [message #60641 is a reply to message #60618] |
Tue, 10 October 2006 18:37 |
Eclipse User |
|
|
|
Originally posted by: alexander.schwartzonline.de
Hello Michael,
> I am successor of Alexander Shatalin in the UML diagrams implementation and
> I have recently added almost complete UML2 association notation into the
> editor class diagram (the only difference is that it in actually does not
> include "dots" to denote owners of the ends and arrows for navigability).
it's brilliant that the UML diagrams are still
maintained/supported/extended.
I have some questions about the future and the current state of these
diagrams:
- Is your work part of the MDT project?
- Is your implementation currently available?
- Or will this implementation become publically available in future?
Alex
|
|
| | |
Re: UML2 associations, again [message #62407 is a reply to message #62051] |
Sat, 14 October 2006 14:20 |
Eclipse User |
|
|
|
Originally posted by: alexander.schwartzonline.de
Hello Alex,
> Hello Alexander,
>
> I guess the problem is in incorrect figure specified for this link in
> mapping file. I suppose that to display link label you are using inner
> label figure (ExtendLabel) – label figure created in another figure
> (<LabelParentFigure>) inside usecase.gmfgraph:
>
you are right. I removed the link and now it works correctly!
> <diagramLabel href="usecase.gmfgraph#ExtendLabel"/>
>
> To display link itself you are using Association figure:
>
> <diagramLink href="usecase.gmfgraph#Association"/>
>
> The problem is: if you’ve specified inner label (ExtendLabel) as a
> figure for the link label then you should use its parent
> (<LabelParentFigure>) as a figure for the link. This situation should be
> checked while validating gmfmap model. Please try to correct your
> mapping model (use <LabelParentFigure> for displaying this link) and
> submit bugzilla entry for handling this situation in validation if I’m
> suggesting you correct solution.
>
Indeed my link mapping used an inner label from a different figure.
Thank's for your help,
Alex
|
|
| |
Re: UML2 associations, again [message #63663 is a reply to message #63302] |
Mon, 16 October 2006 21:56 |
Eclipse User |
|
|
|
Originally posted by: alexander.schwartzonline.de
Hallo Alex,
> So, what about bugzilla request to handle this situation in validation
> and produce corresponding error? ;-)
I filed this as issue #161149.
Regards,
Alex Schwartz
|
|
|
Goto Forum:
Current Time: Sat Jul 27 16:31:43 GMT 2024
Powered by FUDForum. Page generated in 0.04776 seconds
|