Bug 268608 - find/replace action disabled on first opening of console

Whenever a new console page is opened in the Console View, a
FindReplaceAction is registered for this console page. The target of
this action is set before the new console page is set as active by the
PageBookView. This results in either a disabled find/edit action, if
there was no previous console page, or an action which targets the
previously active console page. I.e. the user either cannot search in
the new console page, or searches in an old one. This is also true when
switching between consoles, or when closing the Console View and
re-opening it.

Two points are important here. First, global actions of TextConsolePage
pages are only updated on creation of the action, or if the selection in
the console's text widget changes. And second, PageBookView.showPageRec
will set the current page only after the SWT control of the new page is
created (i.e. only after the new actions are updated). Therefore the
target of the global find/replace action is updated only when a new
console page is created, and its updated with the wrong current page.

This change ensures that the FindReplaceAction has the correct target
page and its enabled state is correct, both when switching pages and
when opening new ones. Namely, the selection of a TestConsolePage is
"reset" after the new page is created and shown.

Change-Id: I22c368acce902d12f83274c6df12e013fb7afaa3
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
2 files changed