Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » adding labels to connectors
adding labels to connectors [message #473357] Sun, 02 March 2008 01:42 Go to next message
nick is currently offline nickFriend
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 17:27 Go to previous message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
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 17:27 Go to previous message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
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: Tue Apr 16 19:26:05 GMT 2024

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

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

Back to the top