Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Custom Property View Widget for Operation Result Parameter
Custom Property View Widget for Operation Result Parameter [message #1712162] Wed, 21 October 2015 15:40 Go to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Hello,

we are implementing some custom property views and custom widgets for
our needs, e.g. provide text fields for Code behavior which will be
handled automatically as OpaqueFunctionBehavior with a code body and set
it as behavior for the feature. This works great so far and the
extensibility of the Papyrus framework is awesome.
Many thanks to all guys who are working on that!

Now, we try to implement a custom widget which allows the user to see
and edit the return parameter of an operation. Therefore, our widget
uses the ReferenceDialog. Then we want to filter the parameters list of
the operation to an entry, which has the direction set to "return".

We already did some research in the Papyrus sources of other Editors and
Widgets and read many lines about several (Content)Providers, but we
could not figure out a proper solution for our problem. The main idea is
a kind of filtered content provider, but how should we map the multiple
reference (parameters list) to a single reference (filtered/selected
parameter)?

I would be glad to get any hints even in some short key points.

Regards
Joachim
Re: Custom Property View Widget for Operation Result Parameter [message #1712356 is a reply to message #1712162] Fri, 23 October 2015 09:22 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Joachim,

The best solution would be to use a custom IObservableValue (Rather than the standard IObservableList), that does the binding from single- to multi-valued (For both read & write)

So:

- Define a new property "return" for Operation in your properties view configuration
- Associate your custom ModelElement/ModelElementFactory for this property
- In ModelElement, you need to override both doGetObservable() and getContentProvider(). You also need to override "isEditable()", otherwise the widget will appear grayed, as "return" is not a known property for Operation in the default UML metamodel

The observable must implement the getValue() to return the first parameter with direction = return, and the setValue() to add a parameter with direction = return (And remove the existing one if any)

Please feel free to ask, if you need a more detailed answer or even an example.

Regards,
Camille


Camille Letavernier
Re: Custom Property View Widget for Operation Result Parameter [message #1712887 is a reply to message #1712356] Thu, 29 October 2015 08:28 Go to previous messageGo to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Hi Camille,

thank you very much for your advice. We actually did it very similar to
what you have mentioned. We use the ValueObservable which transforms the
ListObservable to only one value.

Finally, the widget itself works as expected.

But there is another issue. The property view still contains the widget
for all parameters including the return parameter which is also used by
the return widget. If you change the value using the return widget edit
view, then the appropriate entry of the parameters list will not update
until the whole property views is reloaded, e.g. after selecting another
model element and return back to the operation.

Does the list widget (MultipleReferenceView) not listen on changes on
the model to perform an update of its contents?

Kind regards,
Joachim
Re: Custom Property View Widget for Operation Result Parameter [message #1712897 is a reply to message #1712887] Thu, 29 October 2015 08:53 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Quote:
Does the list widget (MultipleReferenceView) not listen on changes on
the model to perform an update of its contents?


Indeed, that's a general issue for labels in the Papyrus properties views. LabelProviders do not install proper listeners, so labels are not refreshed when a change occurs. The refresh only occurs when elements are added or removed (e.g. adding a new parameter should trigger the refresh, but changing the name of a parameter doesn't)

Regards,
Camille


Camille Letavernier
Re: Custom Property View Widget for Operation Result Parameter [message #1712964 is a reply to message #1712897] Thu, 29 October 2015 16:14 Go to previous message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

> Indeed, that's a general issue for labels in the Papyrus properties
> views. LabelProviders do not install proper listeners, so labels are not
> refreshed when a change occurs. The refresh only occurs when elements
> are added or removed (e.g. adding a new parameter should trigger the
> refresh, but changing the name of a parameter doesn't)

I see. Is this issue planned to be resolved in the future?
Is there another proper way to perform an update of the labels in other
widgets in general?

Regards,
Joachim
Previous Topic:OCL evaluating derived stereotype attributes
Next Topic:Java code generation for operation bodies
Goto Forum:
  


Current Time: Thu Mar 28 12:22:03 GMT 2024

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

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

Back to the top