I can run the whole Junit test using:
Shift + Alt + X, T
But how I can run a single test? Using the mouse I click on concrete method and Run As -> Junit test
anyone know shortcut for this case ?
Thanks
Shift + Alt + X, T runs one test method if the caret is on the method name.
I find the "Shift-Alt-X" gives me trouble sometimes, sometimes what I think is the last executed command is not always and sometimes I end up running something I did not mean to. Also when doing TDD you rerun the tests so often and sometimes want to rerun the test from one project for a while, then you are on to the next project and want to start running its tests. Or you might be focusing on a specific area and only want to run a single unit test few a while. In this case I find I would like to simply rerun my last tests often and I find "Shift-Alt-X" to be a bit cumbersome.
So what I do is "Windows" > "Preferences" then click "General" > "Keys". Sort the table by "Command" and scroll down until you find "Rerun JUnit Test - Failures First" and "Rerun JUnit Test". Click on one of those and set the "Binding" field to whatever keyboard shortcut you want to use. Personally I set "Rerun JUnit Test" to CTRL+F5 so that its similar to refreshing a browser (plus this give me the quick and easy save/rerun combo of hitting CTRL+S, then CTRL+F5).
If you run the single test method as you described it will be the last entry in the "Run history". To run the test again you can simply click on the run button in the toolbar or press 'Ctrl-F11'.
F11 run test and activate window console.
Ctrl + F11 run test and activate window JUnit.
Years later, for me, what works is ALT+R+T+Enter which would run the last ran test whether it's a specific method or class. CTL-F11 for me only runs the last junit class even if the last run was a specific method of that junit class.
Shortcut: Ctrl+Alt+Shift+R - runs just one unit-test method. Set the caret to the method.
Related
In the worksheet, each time command is executed, it's output is added to "script output" page.
But the result from last executions is not cleared and it is very confusing.
Is there any way to auto clear all other outputs except the last one (instead clear manually each time)?
I did searched for solution but didn't find anything I can try.
Thanks
Attached the screens after first command and second command
First run:
Second run:
As far as I can tell, there's no such option. If you go to "Preferences" and search the whole list, there's nothing like that in there. Or, at least, I don't know it.
What you could do is to type
clear screen
(or even shorter, cl scr) in Worksheet.
Or, if you type fast and don't make much mistakes, press combination of
Alt + PgDn to navigate to script output
Ctrl + Shift + D to clear contents
Alt + PgUp to return up
Or, simply push the eraser icon in the toolbar.
In Eclise debugger, the default step options are:
F5: Step into method
F6: Step over line
F7: Step out of method
Often I do have code like this:
obj.getMember().doStuff();
Or maybe even worse (please don't question the code design, just making this up):
obj.getInstance().createSomething().getMember().doStuff();
Usually I want to inspect doStuff() only, but F6 will not step over individual method calls, but it will step over the entire line. So I end up hitting F5 and F7 until I reach doStuff().
My question is: Is there any option to step over method calls (= do F5 and F7 in one shortcut)? Would be cool, if I had to tap X, X, X, F5 only to reach doStuff().
// Edit for clarification: I'm looking for a keyboard-only solution. I know there are several ways I can reach my method (e.g. breakpoints), but I'm asking for a combined shortcut for F5 + F7, so to say.
You have to select the method you want to step into and then with the right click of the mouse you will find the option Step into Selection :
Select the Step Into Selection command to step into the currently
selected statement in the active editor.
You must have program execution suspended for this command to be available.
As you can see from the image above you can just press OPTION and F5 on a mac once selected the method to step into ...
Shortcut :ALT + F5
You could also place a breakpoint into doStuff() and, when you reach obj.getInstance().createSomething().getMember().doStuff(); just resume execution (keybinding: F8:
All the intermediate frames will be executed and the debugger will pause directly in doStuff() again. This of course means that you cannot decide from run to run like you can do with aleroot's Step into Selection suggestion.
Alright, something completely different, since I think I understand the core of your question a bit better now.
There's no predefined skip-over-this-method command afaik, so you can build one yourself. This touches some advanced topics so I'll only post some pointers here:
Create an Eclipse plugin.
In that plugin, declare a command with a keybinding like Alt+F8 and implement the command's default handler
In the handler of your command, invoke the built-in commands which are bound to the Step into and Step out actions. You can find their IDs by looking into the Eclipse source or trying the Plugin-Spy feature.
Package up your plugin and start your Eclipse with it included.
This way you'll reuse the predefined functionality and automate your F5 plus F7 mashing into a single command with relatively small effort.
I am trying to make eclipse keybindings work.
I tried to make the rename command work.
I looked at some tutorials and experimented. I enabled command and key binding trace in console (http://eclipsesource.com/blogs/2009/07/08/tip-tracing-keybindings-in-rcp/).
I have created a custom command:
com.mycompany.myproduct.command.rename
This is what I got so far:
1) I tried to follow this tutorial,http://www.vogella.com/tutorials/EclipseCommandsKeybindings/article.html, but I came to the conclusion that this is for e3. This is because you need to add commands plugin that recognize only old e3 handlers. No xmi is involved
2) I tried to use xmi binding contexts. I had my command registered in the top level commands tree and connected to a handler in the top level handlers tree.
In the binding tables section I have a bindingTable that works in Dialog and Windows context. I added a key binding. The sequence is "F2" and it is connected to my custom command.
When I hit F2 I get the following message in trace:
COMMANDS >>> execute >>> starting: id=org.eclipse.ui.edit.rename; event=ExecutionEvent(Command(org.eclipse.ui.edit.rename,Rename,
Rename the selected item,
Category(org.eclipse.ui.category.file,File,null,true),
org.eclipse.ui.internal.MakeHandlersGo#1285594,
,,true),{},Event {type=1 Tree {} time=1480412218 data=null x=0 y=0 width=0 height=0 detail=0},org.eclipse.e4.ui.workbench.modeling.ExpressionContext#177fc1a)
In short the default eclipse IDE rename command is fired (my key binding does nothing), and nothing happens on my application.
However, if I change the sequece to "M1+1" and hit ctrl + 1, a little pop up comes up that lets me choose between "quick fix" (eclipse IDE command) and my rename. If I choose rename the handler fires.
Now, how do I disable eclipse IDE default keybindings. The instructions of the tutorial in step 1 definitely don't do it.
Thanks!
You can try to force E4 to read your key binding as an user one, adding the "type:user" tag to the KeyBinding itself :
I swear sometimes it seems like the application just likes to see us suffer. I had the same issue you had; a while ago my key binding was working just fine and today I notice it doesn't work anymore. Thanks for this post I found 2 solutions:
"type:user" from the above comment
remove org.eclipse.ui from the run configurations; it seems this was added when I pressed add required plugins after adding some plugin myself
I'm currently working on a project and an I used several print commands in order to see if all is going well.
But all these prints take some execution time and since the program is running well I was wondering if there is a way to comment or delete all of those commands at once.
Generally you can perform a "Replace in Projects...".
Presuming you code in JAVA:
Goto "Edit > Replace in Projects"
Set "Containing Text" to System.out.print
Set "Match" to Literal
Set "Replace with" to //System.out.print
Choose your Scope (Project)
Hit Continue
It is easy as that. Not even a need for Regular expression.
Have Fun.
I'm running Matlab 2013a, under Linux, using Xmonad (using the XMonad.Config.Xfce package).
This problem occurs whether the command window is docked or not.
The command window prompt does not get the keyboard focus unless the pointer is located
over the command window.
Is there a way to get the Matlab command window to have focus behaviour just like other normal windows, like a terminal?
Most important: I'd like to have the keyboard focus follow the window focus,
and not require any special positioning of the pointer, so that I can just "Alt-Tab" around my windows and have the command window get the keyboard focus. All of the resources I've found so far relate to programmatic control of focus; I'm just trying to improve my user experience in an interactive session.
To get keyboard focus on the Command Window, include the following in your xmonad.hs
import XMonad.Hooks.SetWMName
import XMonad.Hooks.ManageHelpers
and configure your ManageHook as follows
myManageHook = composeAll . concat $
[ [appName =? a --> doCenterFloat | a <- myFloatAS ]
, (your other hooks)
] where
myFloatAS = ["MATLAB"]
Finally, include setWMName "LG3D" in your startupHook. See here for a full xmonad.hs configuration which uses this (this is where I found the solution). If you have other Java apps that don't get focus as they should you can add them to the myFloatAS list.
It's a problem in the built-in java.
If i run:
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre
matlab -desktop
Matlab works as expected.
I ran into this problem, running MATLAB2014a. I set up setWMName "LG3D" but still i couldn't get focus on my window. I had to click on the focused window to get the cursor, and sometimes the situation was even worse and I had to click on random places till i get my cursor back. This wouldn't happen on MATLAB2010. What worked for me was to use the native version of java as describe above.
In the end, i used the following bash script to start matlab8:
#!/bin/bash
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre/
/usr/local/bin/matlab8 -desktop -nosplash