|Detect Part moved to different PartStack [message #1766582]
||Fri, 23 June 2017 09:47
| Roman Flueckiger
Registered: January 2015
I'm trying to achieve the following:|
Whenever a Part moves or is moved (e.g. by the user via drag an drop) to a different PartStack, certain SWT widgets in the part need to change their style (currently only the background color) to match the "style" of the PartStack.
There seems to be no way of detecting when a Part has moved to a new PartStack!
What I tried:
- Using events from the EPartService. However, the events are not suitable to detect the required cases. In many cases of moving a Part there is no event at all generated by this service.
- Using events from subscribing to the IEventBroker. Most notably I tried to subscribe to the topic UIEvents.UIElement.TOPIC_PARENT and waited for SET events. For a short time, this seemed to be the solution. But it turns out that there are certain cases, where NO event is sent (i.e. when a Part is moved in a way that a new PartStack with a PartSashContainer is generated). Additionally, in many cases the SET event only contained an "old value" which was null, but no new value. In other words, at the point in time when I receive the event the parent of the Part (the PartStack) is null. However, to figure out which style I should apply to the Part I need the new PartStack stack at this time...
- I also tried to cast the Part to an EObject to somehow "listen" directly to the event when the parent is set on the Part. But, as far as I could tell there is no event sent their either...
So what is my question:
- What am I doing wrong? Is there really no way of receiving an event when a Part is "added" to a new PartStack? What am I missing?
- Is there some other way of achieving the same thing? I thought along the lines of somehow "binding" my widgets background color directly a specific css property of the parent MParkStack (note, that this would have to be the completely resolved css properties for the specific PartStack that is the current parent of the Part). So that the style would be "automatically" up to date whenever the part's rendering is updated? If this is even possible, how would I do something like this?
Thanks for any input.
Powered by FUDForum
. Page generated in 0.06295 seconds