Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » adding labels to connectors
adding labels to connectors [message #473357] Sat, 01 March 2008 20:42 Go to next message
nick is currently offline nick
Messages: 6
Registered: July 2009
Junior Member
hi,

I've changed assembly connector so that instead of it connecting between
properties (as is the case right now) to it connecting between ports of
components (if the partWithPort property is set).

Now i'd like to add a label to connector like port/interface etc has.
Connector doesn't have a class like port etc has. So no
ConnectorName2EditPart like PortName2EditPart.

so basically, how can I add labels to Connector?

regards,nick
Re: adding labels to connectors [message #473361 is a reply to message #473357] Tue, 04 March 2008 12:27 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Nick,

You've faced an interesting task.

To implement such link, add a fake label in your mapping first. To do it,
create Feature Label Mapping in your Link mapping, set Diagram Label and
all the required information. You cannot set Features property, so skip it.
Validation will warn you of missing 'feature' property. Generate gmfgen file,
ignoring the warning.

After that, you can find GenLinkLabel LabelEditPart inside your GenLink.
Giving labels smart names is a good style. So, name the label, for example,
AsssemplyConnectorEditPart. Generate UML2Tools diagram.

It's time for the most interesting and difficult part. You have to write
a parser, which implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser,
for your label. UML2Tools parsers are located in org.eclipse.uml2.diagram.clazz.parser.*,
org.eclipse.uml2.diagram.common.parser.* packages. Feel free to use them
as an inspiration. Implementing a parser is the most sophisticated part of
the functionality. After required parser is implemented, it has to be known
by UMLParserProvider. Find appropriate 'create*Parser()' method, tag it as
'generated NOT' and change it to return your newly-implemented parser.
That's all.

Best wishes,
Tatiana.

> hi,
>
> I've changed assembly connector so that instead of it connecting
> between properties (as is the case right now) to it connecting between
> ports of components (if the partWithPort property is set).
>
> Now i'd like to add a label to connector like port/interface etc has.
> Connector doesn't have a class like port etc has. So no
> ConnectorName2EditPart like PortName2EditPart.
>
> so basically, how can I add labels to Connector?
>
> regards,nick
>
Re: adding labels to connectors [message #618454 is a reply to message #473357] Tue, 04 March 2008 12:27 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Nick,

You've faced an interesting task.

To implement such link, add a fake label in your mapping first. To do it,
create Feature Label Mapping in your Link mapping, set Diagram Label and
all the required information. You cannot set Features property, so skip it.
Validation will warn you of missing 'feature' property. Generate gmfgen file,
ignoring the warning.

After that, you can find GenLinkLabel LabelEditPart inside your GenLink.
Giving labels smart names is a good style. So, name the label, for example,
AsssemplyConnectorEditPart. Generate UML2Tools diagram.

It's time for the most interesting and difficult part. You have to write
a parser, which implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser,
for your label. UML2Tools parsers are located in org.eclipse.uml2.diagram.clazz.parser.*,
org.eclipse.uml2.diagram.common.parser.* packages. Feel free to use them
as an inspiration. Implementing a parser is the most sophisticated part of
the functionality. After required parser is implemented, it has to be known
by UMLParserProvider. Find appropriate 'create*Parser()' method, tag it as
'generated NOT' and change it to return your newly-implemented parser.
That's all.

Best wishes,
Tatiana.

> hi,
>
> I've changed assembly connector so that instead of it connecting
> between properties (as is the case right now) to it connecting between
> ports of components (if the partWithPort property is set).
>
> Now i'd like to add a label to connector like port/interface etc has.
> Connector doesn't have a class like port etc has. So no
> ConnectorName2EditPart like PortName2EditPart.
>
> so basically, how can I add labels to Connector?
>
> regards,nick
>
Previous Topic:adding labels to connectors
Next Topic:[Feature label] Edit pattern with references
Goto Forum:
  


Current Time: Sat Jul 26 13:34:10 EDT 2014

Powered by FUDForum. Page generated in 0.06513 seconds