How to change source and target of a link in the generated code? [message #227791] |
Tue, 28 April 2009 03:49  |
Eclipse User |
|
|
|
Hi everybody,
I want to create a component diagram with components diagrams and ports
like this:
_____________ ______________
| |___ _____| |
| Component1 |P1 |___Connector___|P2 |Component 2 |
| |___| |____| |
|____________| |______________|
P1,P2 ports
The problem is that in the UML model I don't have a direct connection
between port and connectors,
I have
SourcePort ---ConnectorEnd1--Connector---ConnectorEnd2------TargetPort
but I don't want to represent graphically the ConnectorEnd.
I try to modify the genererated code in order to solve this.I can save the
port and the connector with the good references between them,
but I don't have the ConnectorEnd in my xmi file but most of all the
connector figure does not appear in my diagram!
I try to follow the examples and the book Eclipse Modeling Project in
order to know where I can add modified code in order to make appear the
connector but I don't understand very well all the mechanisms used.
I use ConnectorEnd like source and target for connector link in the
gmfmap and
in the class ConnectorCreateCommand generated in edit.commands I have
changed doDefaultElementCreation() to this :
/**
* @generated NOT
*/
protected EObject doDefaultElementCreation() {
org.alkante.generic_editor.uml.Connector newElement =
org.alkante.generic_editor.uml.UmlFactory.eINSTANCE
.createConnector();
// Creation ConnectorEnd
ConnectorEnd ce1 = org.alkante.generic_editor.uml.UmlFactory.eINSTANCE
.createConnectorEnd();
ConnectorEnd ce2 = org.alkante.generic_editor.uml.UmlFactory.eINSTANCE
.createConnectorEnd();
// add connectorEnds to the connector
newElement.getOwnedElement().add(ce1);
newElement.getOwnedElement().add(ce2);
// Links between Ports and ConnectorEnd
ce1.setRole(getSource());
ce2.setRole(getTarget());
getSource().getEnd().add(ce1);
getTarget().getEnd().add(ce2);
// Links between Connector and ConnectorEnd
newElement.getEnd().add(ce1);
newElement.getEnd().add(ce2);
//ce1.setOwner(newElement);
//ce2.setOwner(newElement);
getContainer().getOwnedElement().add(newElement);
UmlElementTypes.init_Connector_4001(newElement);
return newElement;
}
Moreover,I change the references in ConnectorCreateCommand ,
ConnectorReorientCommand ,UmlBaseEditSemanticPolicy ,UmlDiagramUpdater
in order to match with that.
However, in generated method doExecuteWithResult() after the line
ICommand configureCommand = elementType.getEditCommand(configureRequest)
configureCommand stay at null whereas configureRequest isn't null.
So my questions are :
Where is the best location for adding code in order to make appear
the conector in the diagram?
What I have missed in my modifications?
Thank you in advance
Marie
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.39139 seconds