return _viewRoot;
}
public DTUIViewRoot updateViewRoot()
{
DTUIViewRoot viewRoot = null;
final IResource contextResource = _facesContext.adaptContextObject();
// we create this additional exclusion so that we avoid a
// situation
// where two threads enter and start recalculating the same view
// root in parallel. Only one thread may be working on creating
// a new view root for a particular view at any given time. Note
// that due to read/write lock on the value, there is nothing
// to stop readers from simultaneous getting the old value until
// the new value is ready and has been set.
synchronized (_recalcViewRootExclusion)
{
viewRoot = getCachedViewRoot();
if (viewRoot == null || viewRoot.isStale())
{
// if the view root hasn't been created, then do so
// and populate it
final IDTViewHandler viewHandler = _facesContext
.getViewHandler(contextResource);
if (viewHandler != null)
{
final String viewId = viewHandler.getViewId(
_facesContext, contextResource);
try
{
viewRoot = viewHandler.createView(_facesContext,
viewId);
if (viewRoot != null)
{
setCachedViewRoot(viewRoot);
}
// do adds first, let remove trump all
for (final StalenessListener addListener : _waitingToAdd)
{
viewRoot.addListener(addListener);
}
for (final StalenessListener removeListener : _waitingToRemove)
{
viewRoot.removeListener(removeListener);
}
}
catch (final ViewHandlerException e)
{
JSFCorePlugin.log(e,