Extract method dialog not opening in Intellij Idea - java

Whenever I try to refactor any code by extracting a method whether from the 'Refactor Menu' or use the shortcut - 'ctrl + alt + M', the method directly gets crated with name as 'extracted' and the dialog box doesn't open wherein I could do changes to name and privacy of method. Also, it doesn't replace any duplicate code block with the method newly created. Is there any reason why the dialog box isn't opening?
Thanks

This is a new feature in the most recent version of IntelliJ Idea (2021.3). When you extract a method there is now a small settings icon next to the replaced code to click (or you can use CTRL+SHIFT+O) and see some of the old menu-style method extraction tools.

Related

How to make Spring/Eclipse IntelliSense autocomplete like in Visual Studio?

I am a .net developer and from last year I started learning Java. But something make me sad, and that is the Java autocomplete IntelliSense. After I choose something from IntelliSense, a method name for example, it put the method name with the default parameter as well. I don't want that!!! I want to work like in Visual Studio, just to put there the name and that's it because usually when I do that I already copy paste a line from above and I want to change only the class method name...
How to change how this autocomplete works?
I attached a photo after I choose a method from that object, but that line was copied from above before choosing.
Do one of the following:
Press Ctrl while selecting a code completion proposal
Configure overwrite instead of insert code completion behavior as default:
In Window > Preferences: Java > Editor > Content Assist in the first section choose Completion overwrites
Your question was already asked here. Basically the gist of it:
Eclipse already has its own sort of Intellisense that only gets triggered by a "." by default. You can change the settings under:
Window -> Preferences -> Java/Editor/Content Assist
A problem, if you want the Intellisense to be always active. The "fix" would be to always use "ctrl"+"space" to open the Intellisense GUI. (Or, even better, to add every letter and character to the Intellisense triggers under: Window -> Preferences -> Java/Editor/Content Assist)

How to show method parameters hint in Intellij IDEA?

int beginIndex, int endIndex
is important when we invoke methods.
How to show this when the cursor is in the brackets?
Got the final answer.
Just Ctrl +P in Windows/Linux
or ⌘ +P in macOS.
JetBrains reference: Parameter Info
To view the method parameters
Place the caret anywhere within the call of the desired method or function.
Choose View | Parameter Info on the main menu or press Ctrl+P.
To configure the behavior of the view parameter information functionality
Open the IDE Settings and click Code Completion below the Editor node.
In the Parameter info section, define the following options:
To have a complete method or function signature shown rather than a list of required types, select the Show full signatures check box.
Make sure to include the required third-party libraries in the project source path. Otherwise, names of the parameters will not be displayed.
To have the list of parameter types for the called method or function shown automatically after a certain delay, select the Auto pop-up (in ms) check box and specify the time period in milliseconds.
If you have non-standard bindings (or want to change what this is bound to), then look here:
Settings > Keymap > Main menu > View > Tool Windows > Parameter Info
And see what the binding is and/or change it to what you want.
Default shortcut to show parameter info in IDEA is ctrl+P.
Here is a sheet from JetBrains with this and other useful keyboard shortcuts: https://resources.jetbrains.com/storage/products/intellij-idea/docs/IntelliJIDEA_ReferenceCard.pdf
This tooltip appears on mouse over events.
Workaround with keyboard:
Try to use quick documentation pop-up CTRL+Q .

MATLAB : access uigetdir's internal java methods

When using the standard dir dialog box from MATLAB uigetdir, double-clicking on a directory leads to the dialog box entering it and displaying its contents. To actually select it, you have to click on the "select directory" button.
What I would like is a way to add specific rules on what to do when double-clicking on a directory : basically, I would like to change/override the internal 'method/callback' associated to this action.
Problem is, said dialog box is NOT your usual Matlab figure - that I would know how to do easily (retrieve the handle, look at properties and edit/modify the corresponding callback). This looks like a raw Java object and I find no way to access this information from Matlab.
Thanks for your help.
You could try this, instead of uigetdir:
fc = javax.swing.JFileChooser('/initial/path')
% then customise the dialog using Java methods, as you please!
fc.setFileSelectionMode(javax.swing.JFileChooser.FILES_AND_DIRECTORIES)
chosenfile = fc.showOpenDialog([])
You could even add listener callback to handle specific events if needed.

Can't show method definition if Eclipse recognizes a warning on the method

In Eclipse, when I mouse hover over a built-in method, it displays a method definition including stuff like what the method does, input objects, return objects etc.
If I have a yellow line (warning) under the method I'm trying to use, I can't get the mouse-over to show the definition.
If I try hitting F3, I get a "The Jar of this class file belongs to container "Android 1.6" blah blah blah."
How do I show the definition of the method I am using when there is a warning?
Those informations are named "javadoc". To show it, juste type <alt+shift+Q then J> or go in menu Window > Show View > Javadoc

How to get back auto-completion after misspelling a method name in Eclipse?

When I am coding Java in Eclipse I like the auto-completion feature. With that I mean the popup with method-names that comes when you start typing in a method name for an object. Or maybe it's called something different, i.e. method-suggestions?
But the popup is hidden if I misspells a method name, and it doesn't come back if I delete the misspelled part of the method name. Is there any way to get back the popup after a misspelling without starting to type in the hole method name again?
Press Ctrl+ (Blank). For a complete list of keyboard shortcuts have a look in the eclipse "Preferences" and there "General/Keys".
You should also check out Preferences->Java->Editor->Content Assist. You'll be able to select how it acts; things like if you use it in the middle of a word should it insert or overwrite, should it show deprecated methods, the delay before it automatically appears, and it can even (try to) guess your method parameters based on the variables in the current scope.
I think you're after the Ctrl-Space keyboard shortcut.
(In Eclipse this is called Content Assist. In Visual Studio it's called IntelliSense.)

Categories