How can I open a new browser tab from Python in Eclipse Che?

632 Views Asked by At

I am running Eclipse Che v6.18.1 in Google Chrome on MacBook Pro OS v10.10.5 (Yosemite). Eclipse Che workspace runs in a Docker container.

How can I open a new browser tab (in the same browser window as Eclipse Che) from within a Python code executed in Eclipse Che?

So not a new Google Chrome instance from within a Docker container (much too slow) but a new tab in already existing browser window on the host machine.

In Eclipse Che it is possible to preview an HTML file in the project Workspace (right-click => Preview). Then the HTML file opens in the next tab to the Eclipse Che IDE. How could I use that feature from within a Python code to open a new browser tab?

3

There are 3 best solutions below

0
Tony On BEST ANSWER

According to Eclipse Che developers this functionality is currently not available in Eclipse Che. There is always user interaction required for this. See this GitHub post.

4
Dave Neary On

Are you trying to open a preview window similar to the sample nodejs Yeoman application? Or are you trying to open a new tab from the source code in someone's browser?

If it's the latter, then I do not think it is possible (or a good idea!) - Che does not run in a security context that will allow it to instruct the browser to open a new tab or window.

3
sunix On

[che6] You can't really open the preview url from the python code. But you can create a Che command that would run the python code AND show the preview url. Details here: https://www.eclipse.org/che/docs/che-6/commands-ide-macro.html