Eclipse. How to activate tooltip popup using shortcut? - java

for example we have following method:
...
public void method1(){
method2();
}
...
method2 can throws exception and Eclipse offer either wrap by try catch or declare throws declaration.
Each time I need pick up the mouse and hover mouse cursor to this row.
Is it possible select wrap or throws without using mouse?

I think that 'F2' is the right key to see the tooltip visible when hoovering mouse over an item in Eclipse editor. It may contain suggestions of fixing if there's a problem with the item being hoovered over. The functionality is called "Show Tooltip Description".
Mentioned in other answers shortcut Ctrl+1 shows a "Quick Fix" tooltip which is slightly a different trick than "Show Tooltip Description". I would say that both tooltip provide user with some common functionalities but both offer also their own options.

Yes, use Ctr+1keyboard shortuct. In your case, it is called quick fix and it works errors and warnings. With the same shortcut you can use quick assists, they are used for local code manipulations. Read more HERE.
Regards

Move your cursor to the method and press Ctrl+1, then use your arrowkeys. This trick (ctrl+1) can help you speed up development for a lot of things, like automaticly assign statements to variables.

Press F2 for focus,
Using Ctrl + 1 for proposal table,

Related

Keyboard shortcut to preview method code in a popup

What is the keyboard shortcut to preview a method's code as a pop-up?
I'm looking to preview the code inside of a given method much like one would preview the javadoc by placing the caret on the method and pressing F1.
I used to know this shortcut, but my memory is failing me harder than the various search algorithms and mom isn't home right now. ;-)
Is Ctrl+Shift+I what you're looking for? Found it here
I think you need the shortcut keys to Quick Definition. So jos76's idea is correct. But we have to map it to your keymap.
As I found from Settings -> Keymap, these are the keyboard shortcuts for Mac OS 10.5+. You may change as your convenience.
And you can also try
Place cursor on the method.
From Main menu View -> Quick Definition(2nd row under view, You can also see shortcut key combinations appearing there). So there would be a pop up appearing with method implementation view as you suggested :))
So it looks like this.

How do I jump to the method that will be run in Intellij-IDEA?

Is there a keyboard shortcut I can use to jump to the method that would get run if I clicked the run button?
In this case, how can I jump my keyboard cursor to JustATest.testName()?
You can jump to a specific method or field by adding a pound character (#) when you do a class search.
Depending on your keyboard setup, a class search is done with Command+N or Ctrl+N.
So, you'd want to type in the pop-up dialog TestClassTest#testMethod, and it will take your cursor straight to it. There might be a bit of shakiness with split panes, but for the most part, this is a simple solution that works in the general case.
The other way involves placing a bookmark on that line of code, and recalling it either through the Favorites bar or through the provided shortcuts.
Outside of that, you don't have many other options. IntelliJ wouldn't be able to divine that this method will for sure be run, since any manner of exceptions could occur before it gets to that method. At that point, you're left with just breakpoints in your code.

Eclipse parameter dialog/hint when using functions in code

By default In Eclipse when you use a function or create objects it helps with parameters like this:
But once it's done, it'll never show up again. Is there any way to call this parameter helper on code that's already written when I point the cursor on the method?
The Image I uploaded only appears while writing code.
Ctrl + Shift + Space will do the trick. It is named Context information in Key preferences.
Place the cursor just inside the left parenthesis and press Ctrl+Space (Command+Space on Mac) again; Eclipse will show Content Assist again.
When the mouse cursor is in the paranthesis, click Ctrl+Space. It will pop up menu (content assist). If you enter it, it will show the context information as it was at the beginning.
You can't get place holders again once they disappeared. But you can get content assist help as said by #E-Riz
Check this answer What is Eclipse shortcut key to turn on feature that allows when pressing TAB key, for cursor to go to expected position? and also this What's this box around my function input?
i was looking for the same shortcut and didn't find it ;
now i'm using
*ctrl+Arrows to move between words
*alt+shift+arrows to select the world and replace it
JDT-Codemining is a new project (as of Aug 2018) that supports parameter hints, along with many other features, such as:
General
Show references
Show implementations
Show method parameter names
Show method parameter types
Show end statement
JUnit
Show JUnit status
Show JUnit run
Show JUnit debug
Debugging
Show variable values inline while debugging

Changing the behavior of the Eclipse auto-complete (Content Assist)

When I am programming in Eclipse, the auto-complete \ suggestions box usually opens when typing a dot (for example after typing System. or SomeObject., and stays open while typing a similar code to any of the suggested.
This is what I'm talking about:
I often use the auto-complete \ suggestions box to my advantage, and there are couple of changes I would like to make in order to improve my productivity while programming, if possible;
Is there any way to make the suggestions box visible all the time,
showing suggestions in real-time (and showing a blank box when there
are no available suggestions) ?
Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?
Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
FYI, in Eclipse terminology this feature is called Content Assist.
Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ?
No, that's not possible. You can invoke it any time you want via Ctrl+Space (Command+Space on Mac)
Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?
Yes, you can add your own templates via Preferences > Java > Editor > Templates
Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?
Not really. There is some control of the order for "cycling" through proposal types via Preferences > Java > Content Assist > Advanced, but it's not really what you're looking for. The order of proposals is, I think, based on the current context of when Content Assist is invoked.
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
All of the customization option are available under Preferences > Java > Content Assist; color options are available under Preferences > General > Appearance > Color and Fonts, but I think the colors for that pop-up might come from your operating system color settings.
If you're using (or willing to use) Eclipse Juno (4.2) then there is a new project call Code Recommenders that you might find interesting.
E-Riz already answered all your other questions but for getting content assist in real-time there is a workaround
Under Preferences > Java > Editor > Content Assist there is an option for "Auto activation triggers for Java". By default it's set to ".". You can append to that all the alphabets (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz) and then it should work.
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
Just when the auto-suggestion box pops up, if you hover your mouse pointer to its botton-right corner, you'll be able to see mouse pointer turn into resize pointer. Resize it the way you like and next time when it pops up, it will be of the same size. Hope this helps. :-)

Send accelerator with mouse to perform selection of text

I need to make selection of text using mouse instead of ctrl+A
I tried:
sendAcceleratorKey(MouseEvent.BUTTON1, "");
but I don't know which argument could I set to say make a click with mouse and let the mouse enforced to select the text.
If the text is in a JTextComponent, selectAll() may be a suitable choice in your MouseListener.
Addendum: You may also be able to leverage the select-all Action, which is bound to control-A or meta-A by default on various platforms.
Your sscce may be helpful in deciding. There's a related example here.

Categories

Resources