releaseOnDismiss_.add(docDisplay_.addKeyDownHandler(new KeyDownHandler()
{
public void onKeyDown(KeyDownEvent event)
{
NativeEvent ne = event.getNativeEvent();
int mod = KeyboardShortcut.getModifierValue(ne);
if ((mod == KeyboardShortcut.META ||
(mod == KeyboardShortcut.CTRL && !BrowseCap.hasMetaKey())))
{
if (ne.getKeyCode() == 'F')
{
event.preventDefault();
event.stopPropagation();
findReplace_.showFindReplace(true);
}
else if (ne.getKeyCode() == 'S')
{
event.preventDefault();
event.stopPropagation();
saveFileAs();
}
}
else if (mod == KeyboardShortcut.NONE &&
ne.getKeyCode() == KeyCodes.KEY_ESCAPE)
{
if (findReplace_.isShowing())
findReplace_.hideFindReplace();
else
popupPanel_.close();