Focus application windows

Hi! 

How can I focus on Idea windows like in debug mode (Focus application on breakpoint in settings)?

0
4 comments
Avatar
Permanently deleted user

Try this simple code:

JFrame frame = WindowManager.getInstance().getFrame(project);
if (frame != null) frame.toFront();

0
Avatar
Permanently deleted user

Hi Vassiliy! Thanks for reply.

Unfortunately, the code above doesn't switch to idea window.

0
Avatar
Permanently deleted user

I see, sorry. But this code below works for me, please try. (It's macos case)

          JFrame frame = WindowManager.getInstance().getFrame(e.getProject());
          if (frame instanceof IdeFrame) {
            AppIcon.getInstance().requestFocus((IdeFrame)frame);
          }

0
Avatar
Permanently deleted user

Yes, it works great!

Thank you!

0

Please sign in to leave a comment.