ServerPushSession
instead
to enable/disable server push.@Deprecated
public final class UICallBack
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
activate(java.lang.String id)
Deprecated.
Use
ServerPushSession.start() instead. |
static void |
deactivate(java.lang.String id)
Deprecated.
Use
ServerPushSession.stop() instead. |
static void |
runNonUIThreadWithFakeContext(Display display,
java.lang.Runnable runnable)
Deprecated.
Use
UISession.exec(Runnable) instead. You can obtain a reference to the UI
session for a display by RWT.getUISession(Display) . Example:
RWT.getUISession( display ).exec( runnable ) . |
@Deprecated public static void runNonUIThreadWithFakeContext(Display display, java.lang.Runnable runnable)
UISession.exec(Runnable)
instead. You can obtain a reference to the UI
session for a display by RWT.getUISession(Display)
. Example:
RWT.getUISession( display ).exec( runnable )
.display
- the display that is bound to the UI session which the runnable needs to accessrunnable
- the runnable to execute in the UI session context of the given displaySingletonUtil
@Deprecated public static void activate(java.lang.String id)
ServerPushSession.start()
instead.Display.asyncExec()
}.
The UI callback must be activated from the UI thread before the background thread starts.
Each activation is given a session-unique id to allow reference-counting activation and
deactivation.
If not deactivated explicitly, any active UI callbacks are released when the session terminates.
Note: this method must only be called from the UI-Thread of an RWT application.
Example code:
final String callbackId = "callback id"; Runnable bgRunnable = new Runnable() { public void run() { // do some work... // schedule the UI update display.asyncExec( new Runnable() { public void run() { if( !widget.isDisposed() ) { // update the UI } } } ); // Deactivate the UI call-back UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() { public void run() { UICallBack.deactivate( callbackId ); } } ); } }; UICallBack.activate( callbackId ); Thread bgThread = new Thread( bgRunnable ); bgThread.setDaemon( true ); bgThread.start();
id
- a session unique identifier to trace the activation and
deactivation. Must not be null
.
SWTException
- null
Display.syncExec(java.lang.Runnable)
,
Display.asyncExec(java.lang.Runnable)
,
Display.getThread()
,
Display.wake()
@Deprecated public static void deactivate(java.lang.String id)
ServerPushSession.stop()
instead.activated
UI callback
with the same id
.
Calling this method with an id that wasn't activated before has no effect.
For each id, the system maintains a reference counter so that multiple activations of the same id must be followed by the same number deactivations in oder to actually stop the UI callback.
Note: this method must only be called from code that is associated with a session.
That is, either code running in the UI thread or executed via
runNonUIThreadWithFakeContext(Display, Runnable)
id
- A session unique identifier to trace the activation and
deactivation. Must not be null
SWTException
- null
Display.syncExec(java.lang.Runnable)
,
Display.asyncExec(java.lang.Runnable)
,
Display.getThread()
,
Display.wake()
Copyright (c) EclipseSource and others 2002, 2014.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0