Skip to main content



      Home
Home » Modeling » Papyrus » Accessing object name or attributes in comments
Accessing object name or attributes in comments [message #1268726] Mon, 10 March 2014 19:07 Go to next message
Eclipse UserFriend
Hello all.

I'm trying to add some documentation in the comments text fields of some sysml objects. I was wondering if it was possible to insert some aspects of objects from the model in the text, like using some magic keywords, syntax or even browsing the model...
It's just that when documenting I'd like to have any text referencing other parts of the model automatically updated on any changes...
Otherwise is it the right place to document the model ?

Thx !

David

[Updated on: Mon, 10 March 2014 19:08] by Moderator

Re: Accessing object name or attributes in comments [message #1268941 is a reply to message #1268726] Tue, 11 March 2014 03:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi

For the purposes of auto-generating the OCL 2.5 specification, the
Eclipse OCL pivot support uses an xDoc-like markup in comments enabling
styling, name-references and OCL-expressions to be exploited. This is
already in use in Papyrus since the Essential OCL editor uses as part of
its hovertext displays.

It would seem that Papyrus just needs to

- use the org.eclipse.ocl.examples.xtext.markup.Markup.xtext editor to
edit comment text

- use the org.eclipse.ocl.examples.xtext.markup.MarkupToHTML renderer
when displaying comments

Examples of marked up comments can be found in
/org.eclipse.ocl.examples.library/model/OCL-2.5.oclstdlib

e.g.

"heading:1[Introduction]" for major document styling. Also
bullet/figure/figureref/footnote

"oclText[null->notEmpty()]" for program font with syntactic validation
of the content. Also oclCode/oclEval

"e[unlimited]" for emphasis also b

Regards

Ed Willink


On 10/03/2014 23:07, David Vandergucht wrote:
> Hello all.
>
> I'm trying to add some documentation in the comments text fields of
> some sysml objects. I was wondering if it was possible to insert some
> aspects of objects from the model in the text, like using some magic
> keyword or event browsing the model... It's just that when documenting
> I'd like to have any text referencing other parts of the model
> automatically updated on any changes...
> Otherwise is it the right place to document the model ?
>
> Thx !
>
> David
Re: Accessing object name or attributes in comments [message #1268955 is a reply to message #1268941] Tue, 11 March 2014 03:25 Go to previous messageGo to next message
Eclipse UserFriend
Sounds great ! Thanks !
Re: Accessing object name or attributes in comments [message #1268993 is a reply to message #1268955] Tue, 11 March 2014 04:48 Go to previous messageGo to next message
Eclipse UserFriend
OK I haven't tried the OCL syntax yet but I just discovered the little "@" button on the top right corner of the comment UML body editor, which is used to add a dynamic link to a node in the model.
Link appears "encoded" in the text editor but shows up correctly in the model or in the diagrams.

There is one thing fishy though: we can only link elements of the model when writing in the body pane of the "UML property" of the "comment node" (not the "Comments property" in the "comment node").
Actually, all "Comments" property in nodes should be converted to "comment node" in the model to be able to link other elements of the model.

[Updated on: Tue, 11 March 2014 04:50] by Moderator

Re: Accessing object name or attributes in comments [message #1269035 is a reply to message #1268993] Tue, 11 March 2014 05:48 Go to previous message
Eclipse UserFriend
Hi David,


Quote:
There is one thing fishy though: we can only link elements of the model when writing in the body pane of the "UML property" of the "comment node" (not the "Comments property" in the "comment node").
Actually, all "Comments" property in nodes should be converted to "comment node" in the model to be able to link other elements of the model.


This looks like a bug which should have been fixed by this task:

402525: [Widgets / Transactions] Papyrus dialogs should be transactional
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402525

However, the bug's still here.

The workaround is:

- Create a new comment
- Press OK
- Edit the comment (Blue pencil)
- Now it works

I've filled Bug 430077: [Widgets / Transactions] Cannot add NamedElement references to newly created comments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430077


Regards,
Camille
Previous Topic:Component diagram and displaying required and provided interfaces
Next Topic:Hyperlinks for Diagram Elements
Goto Forum:
  


Current Time: Fri Jul 04 02:07:53 EDT 2025

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

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

Back to the top