diff --git a/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/window/Window.java b/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/window/Window.java index 77e2e9ad164..32762e82270 100644 --- a/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/window/Window.java +++ b/ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/window/Window.java @@ -224,6 +224,7 @@ public void show(@Nullable final Focusable selectAndFocusElement) { setBlocked(false); if (isShowing) { + setFocusOn(selectAndFocusElement);//the window is displayed but focus for the element may be lost return; } @@ -247,14 +248,22 @@ public void show(@Nullable final Focusable selectAndFocusElement) { public void execute() { // The popup may have been hidden before this timer executes. view.setShowing(true); - if (selectAndFocusElement != null) { - selectAndFocusElement.setFocus(true); - } + setFocusOn(selectAndFocusElement); } }); } } + /** + * Sets focus on the given element. + * If {@code elementToFocus} is {@code null}, no element will be given focus + */ + private void setFocusOn(@Nullable Focusable elementToFocus) { + if (elementToFocus != null) { + elementToFocus.setFocus(true); + } + } + private void handleViewEvents() { view.setDelegate(new ViewEvents() { @Override