PhaseListener
implementation. PhaseListeners are objects that are registered to be notified at the beginning and ending of each phase of the request processing lifecycle (see LifeCycle
). Extensions should provide a class that implements org.eclipse.rap.rwt.lifecycle.PhaseListener
.
<!ELEMENT extension (listener+)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED
><!ELEMENT listener EMPTY>
<!ATTLIST listener
class CDATA #REQUIRED
><extension id="org.eclipse.rap.demo.phaselistenerextension" point="org.eclipse.rap.ui.phaselistener"> <entrypoint id="org.eclipse.rap.demo.phaselistener" class="org.eclipse.rap.demo.DemoPhaseListener" /> </extension>
org.eclipse.rap.rwt.lifecycle.PhaseListener
interface.
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.lifecycle.*;
public class DemoPhaseListener implements PhaseListener {
public void beforePhase( PhaseEvent event ) {
// ...
RWT.getLifeCycle().removePhaseListener( this );
}
public void afterPhase( final PhaseEvent event ) {
// ...
}
public PhaseId getPhaseId() {
return PhaseId.RENDER;
}
}
As PhaseListener
s are attached to the RWT lifecycle and thus available globally, you need to make sure to remove them properly if you do not need them anymore (see RWT.getLifeCycle().removePhaseListener()
.
In case that the PhaseListener needs to access any UI-related objects (e.g. Widgets), you have to make sure
that you compare the current display with the one attached to the current session.
Copyright (c) 2007, 2013 EclipseSource and others.
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html