Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Discouraged access of RWTLifeCycle.setSessionDisplay(Display)
Discouraged access of RWTLifeCycle.setSessionDisplay(Display) [message #547331] Fri, 16 July 2010 06:16 Go to next message
Eclipse UserFriend
Hi,

I would like to extend org.eclipse.swt.widgets.Display with some custom
features, so I subclassed it and call
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.setSessionDi splay(Display)
before the initial call to org.eclipse.ui.PlatformUI.createDisplay().
This way org.eclipse.swt.widgets.Display.getCurrent() always returns my
Display-Subclass.

1) I know this way is kind of a hack, but I could not find a straighter
way to achieve my target. Any comments?

2) In eclipse the call to
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.setSessionDi splay(Display)
shows a warning "Discouraged access". Can you please comment on this
warning? Why is it marked as discouraged? Can I ignore the warning?

Regards,
Philipp
Re: Discouraged access of RWTLifeCycle.setSessionDisplay(Display) [message #547335 is a reply to message #547331] Fri, 16 July 2010 07:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Philipp,

> 1) I know this way is kind of a hack, but I could not find a straighter
> way to achieve my target. Any comments?

If you want to store data per session you could use a SessionSingleton.
What's your use case?

> 2) In eclipse the call to
> org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.setSessionDi splay(Display)
> shows a warning "Discouraged access". Can you please comment on this
> warning? Why is it marked as discouraged? Can I ignore the warning?

The reason is that you access internal API which might change in
upcoming releases. The convention is that all API with an "internal"
within the package name is internal :-)

Regards,
Stefan.
Re: Discouraged access of RWTLifeCycle.setSessionDisplay(Display) [message #547338 is a reply to message #547335] Fri, 16 July 2010 07:16 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.07.2010 13:01, schrieb Stefan Roeck:
> Hi Philipp,
>
>> 1) I know this way is kind of a hack, but I could not find a
>> straighter way to achieve my target. Any comments?
>
> If you want to store data per session you could use a SessionSingleton.
> What's your use case?

Views in our application may receive events to notify them of available
udates.
The common base class we derive all our views from, shows a dialog to
notify the user, but as you can imagine, this dialog should only be
shown once per update.
So i decided to use a semaphore and I thought the display would be a
convenient place to store it. Of course I could put it directly into the
session, but still I think it fits nicely into the Display ;)

You have any other recommendations?

Regards,
Philipp
Re: Discouraged access of RWTLifeCycle.setSessionDisplay(Display) [message #547355 is a reply to message #547338] Fri, 16 July 2010 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Hi Philipp,

subclassing Display is a misuse of the SWT API. You should definitely
not do that. If you need to attach application data to the Display, you
can use Display#setData. But I'd also feel that the session is the right
place to store it.

Regards, Ralf

Philipp Leusmann wrote:
> Am 16.07.2010 13:01, schrieb Stefan Roeck:
>> Hi Philipp,
>>
>>> 1) I know this way is kind of a hack, but I could not find a
>>> straighter way to achieve my target. Any comments?
>>
>> If you want to store data per session you could use a SessionSingleton.
>> What's your use case?
>
> Views in our application may receive events to notify them of available
> udates.
> The common base class we derive all our views from, shows a dialog to
> notify the user, but as you can imagine, this dialog should only be
> shown once per update.
> So i decided to use a semaphore and I thought the display would be a
> convenient place to store it. Of course I could put it directly into the
> session, but still I think it fits nicely into the Display ;)
>
> You have any other recommendations?
>
> Regards,
> Philipp
Re: Discouraged access of RWTLifeCycle.setSessionDisplay(Display) [message #547356 is a reply to message #547355] Fri, 16 July 2010 08:23 Go to previous message
Eclipse UserFriend
Ok guys, you convinced me. A SessionSingleton is even cooler ;)

Am 16.07.2010 13:50, schrieb Ralf Sternberg:
> Hi Philipp,
>
> subclassing Display is a misuse of the SWT API. You should definitely
> not do that. If you need to attach application data to the Display, you
> can use Display#setData. But I'd also feel that the session is the right
> place to store it.
>
> Regards, Ralf
>
> Philipp Leusmann wrote:
>> Am 16.07.2010 13:01, schrieb Stefan Roeck:
>>> Hi Philipp,
>>>
>>>> 1) I know this way is kind of a hack, but I could not find a
>>>> straighter way to achieve my target. Any comments?
>>>
>>> If you want to store data per session you could use a SessionSingleton.
>>> What's your use case?
>>
>> Views in our application may receive events to notify them of available
>> udates.
>> The common base class we derive all our views from, shows a dialog to
>> notify the user, but as you can imagine, this dialog should only be
>> shown once per update.
>> So i decided to use a semaphore and I thought the display would be a
>> convenient place to store it. Of course I could put it directly into the
>> session, but still I think it fits nicely into the Display ;)
>>
>> You have any other recommendations?
>>
>> Regards,
>> Philipp
Previous Topic:Request.js add some codes in RAP1.3 and UICallBackServiceHandler without any response
Next Topic:[menu] menu contributions not updated/shown if they have a visibleWhen expression
Goto Forum:
  


Current Time: Thu Jul 03 09:17:47 EDT 2025

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

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

Back to the top