How to Make The Text Cursor Automatically Switch to Console in Eclipse? - eclipse

Often when I am running a program in Eclipse which requires input from the user the text cursor does not move automatically from the code in my Java source file to the console to take user input.
I have to manually click within the console to switch. Often I find myself thinking the cursor has switched automatically when it hasn't and I type my entry for the program into the code instead of the console.

There's a feature that can get you part of the way there, but it doesn't satisfy your request 100%. As described here, the Console view has options that will force it to be shown when either System.out or System.err are written to. If you enable one or both of those options (either in the Console toolbar or the global Preferences), then close the Console view, the next time your program writes to System.out the Console will show and take focus (at least on Windows).
The downside is that if Console is already open when your program writes to System.out, then it does not grab keyboard focus.

Related

How can I configure Eclipse to save console out for my build?

I specifically only want console out for Building my code, which is primarily C++. Every search for this leads me to configuring Run Configuration(s) to output the console. I'm not trying to RUN my program, just want the additional detail from console-out when I build and get warnings, some of which I'm not getting filepath info in the "Problems" window. Thanks!
This might already be set up by default. It was for me, once I found the solution I realized this. Check if the following filename exists:
<workspace_name>/.metadata/.plugins/org.eclipse.cdt.ui/global-build.log
If it's there, you might already be setup with build output saved to a file. It should be saved in this file. If you don't have this file, and/or you want to change the file location, do the following: click Window context menu->Preferences. Expand the triangle next to C/C++ on the left sidebar, then under that sub-menu, expand the triangle next to the Build menu, then click Logging. Inside the Logging window, ensure the checkbox next to Enable global build logging is checked, then click the Change... button next to the Log file location text box and select your log file. (In Linux, this part may not be so easy if you don't have a log file already touched. In this case, navigate to the directory in which you want to save your log file, then click the button in the top left that looks like a piece of paper with a pencil over it (when hovering over this button it says "Type a file name"), and then type the name of the log file you wish to use. Click Ok.) Then in the Preferences window, click Apply and/or Ok. Next time you build, this log file should be populated automatically with your Console output.

Import/export Chrome devtools breakpoints & settings between computers

Quoting the original idea:
I came across a problem where I need to share all my debugger breakpoints to my colleague to debug the issue at his end. So thought of implementing something like export the debugger points from one system and import at other system.
Since devtools doesn't provide a built-in import/export feature, is there another way?
Use devtools-on-devtools:
open devtools and switch its Dock side in the menu to a detached (floating) window
in the now detached devtools press CtrlShifti or ⌘⌥i on MacOS,
which will open devtools-on-devtools in a new window
UI method:
in this new window switch to Application tab, expand Local Storage, then devtools://devtools on the left
double-click breakpoints value on the right and copypaste it
Now do the same on the target computer and reopen the main devtools window afterwards.
Console method (especially useful if the value is too long):
run copy(localStorage.breakpoints) in devtools-on-devtools console on the source computer to copy the value to clipboard
run localStorage.breakpoints=prompt() on the target computer
(the prompt will appear in the main devtools window).
Console method to export everything:
run copy(JSON.stringify(localStorage)) in devtools-on-devtools console on the source computer to copy the value to clipboard
run Object.assign(localStorage, JSON.parse(prompt())) on the target computer
(the prompt will appear in the main devtools window).
P.S. Next time you can quickly toggle the detached state of devtools by pressing CtrlShiftD

unnecessary shift of cursor to console log

I am using eclipse on Ubuntu. When there is log being shown in console and I am moving cursor up or down in JAVA file to see the code, the cursor shifts itself to the console log and and I am having problem to investigate my code. My cursor shifts to console log even if I disable the console view from windows-> Show View. Is there any way that I am not forced to see the console.
I just got rid of this issue. Right click in console window, select preferences and then unchecked the checkBox "show when program writes to standard out" and also unchecked the checkBox "show when program writes to standard error".

Eclipse Luna Console View - how to lock Console View to console output

In Eclipse Luna I opened two Console Views. I attached output from a external build tool to the first one and Liferay server output to the second one. Whenever I run the external build tool, both Console Views start to display the output of the external Build tool and I have to manually switch the content of the second Console View every time. Is it possible to bound the Console View with the specific output permanently? I did not find this feature in the Eclipse documentation.
If I understand your question, there is a button on the console window which is "Show console on any output":
Enable this button on the console you want to capture, and disable it and the button next to it, (which is "Show console on any error") for the console you don't want to show. This usually works for me on Luna SR1.
There is a button with a "+" sign on the top right. click it to open a new console.
Once you have two consoles, use the Pin console (console with a board pin icon on the top right) button to pin the newly opened console to the liferay server console.

Is there a keyboard shortcut for stopping the current console in Eclipse?

I'm developping a Java application with a class containing main. I can start the application using Ctrl+Alt+X J subsequently the application can be re-run by hitting Alt+R T Enter to choose the menu option for the first item in the Run history.
But to stop the application, I have to click on the small red square in the console view. This is annoying, because it forces me to use the mouse, type Alt+R T Enter then re-focus the editor using the mouse again.
Eclipse being so configurable, there must be a keyboard shortcut to stop the application run in the current console I haven't found. There are an entry in Window > Preferences > Keys called Terminate and Terminate and Relaunch but no matter what binding I assign or what when conditions I set and no matter if I use the Debug perspective or not, they don't seem to fire.
Please help an Eclipse newbie avoiding the mouse :)
Go to Preferences -> General -> Keys
Find "Terminate" Set your binding to whatever you want.
Then change "When" from "Debugging" to "Editing Java Source".