Automatic Insertion Trigger in Netbeans - Code Completion - netbeans

I am using Netbeans 13 and whenever I type anything in the editor an autocomplete popup show up instantly.
This is really what I want.
But once I continue typing it choses the first suggestion which I don’t want. Then I have to delete the suggested object/method/variable…etc and write my own.
I am looking for a feature like the one in Eclipse IDE which only triggers insertion once ‘Enter’ key is pressed.
Also I don’t want to apply the delay approach.
Note: I tried Netbeans 12 but I faced same issue.

Related

How do you make Eclipse not edit all the occurrences found by "Find Next"?

When I use Cmd+K to go to the next occurrence of the selected word, Eclipse leaves behind these red "cursors" right before the copies of the word that I navigate through. If I then edit the last occurrence that I find, Eclipse "helpfully" edits all the occurrences that I've navigated through in the same way. This leaves corruption in parts of my file that I'm not currently looking at, which is really infuriating.
I want to disable this "feature", but I haven't got a clue what to call it, so I don't know how to find the setting that turns it off. Searching the Eclipse preferences for "occurrence" only gives various versions of "Mark Occurrences" for each editor plugin, which doesn't disable this behavior when unchecked.
EDIT: Here's a video displaying the behavior I'm talking about: https://youtu.be/8xeKRLyGSLg
This isn't really given by PyDev, it's a feature added by LiClipse (http://www.liclipse.com/multi_edition_video.html).
After the link is done with Ctrl+K, you can press ESC to remove those links if you don't want the multi-edition to happen (so that when you edit one occurrence you don't edit the others).
I must say this is the first request to have that turned off... I'm pretty certain as I just took a look and there's no setting to do that -- so, unfortunately, until the next release, you have to either live with it, remembering to press ESC if you don't want the multi edition to happen or use a plain Eclipse install with PyDev, but you'd also be without other LiClipse benefits, such as textmate bundles, vertical indent guides, theming integration, etc.
Still, note that ideally, I'd say you should get used to it as it can be a real time-saver -- although I'll implement the setting to turn it off for the next release anyways, as it's something that should really be there ;)

Why is the "Mark Occurrences" feature in Eclipse automatically disabling itself?

I never had this issue with Eclipse before (Eclipse Classic 4.2.2, Indigo) but it started happening on my new iMac recently, that it stops highlighting similar occurrences or variable names, etc. Then it automatically starts working just fine.
Needless to say its a pain when it doesn't show the multiple occurrences of variable names and I have to find them using Find.
I was wondering if there is a sequence of keys which I press by mistake which causes it? I haven't find an answer to this anywhere else yet.
Attached is the screenshot from the Preferences. As I edit this question, again the Mark Occurrences is greyed out and I'll have to check it again to make it work.
A work around for this is to click on e.g. the Outline view, and then click back on the editor. The mark occurrences should start working again. I don't know of a long term fix.

About usability issues for Eclipse's auto completion

Recently, I need to use Eclipse instead of Netbeans.
I find the following issues is annoying in my case. Say, I key in the following wrong method name.
So, I tend to fix the error, by deleting the wrong method name (But not parameter, as I know I want to pass in true), including the dot. I key in dot again, Eclipse auto completion will prompts me list of methods
I am happy with the suggestion. I press ENTER. However, this is what I am getting.
Now, I need to manually deleted the uselesss (checked). This is pretty annoying, especially when the method takes in 4 to 5 parameters. I have to delete them 1 by 1.
I consider this a usability defect. I do not have such issue in Netbeans. Anyone of you know any workaround to overcome this usability issues? Is there any options I can turn on or turn off?
You can also press Ctrl+Enter to insert the completion which will 'replace' the incorrect typed word.
Look for "Toggle between inserting and replacing content assist" in http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.jdt.doc.user/tips/jdt_tips.html

Validate Autocomplete in Eclipse

Coming from Visual Studio and starting a project in Java, I realized I couldn't cope with having to press ctrl+space to have the autocomplete panel show up. An easy workaround was to set all keyboard characters to be trigger characters for autocompletion.
My only problem is that, when presented with autocomplete suggestions, a single press on the space bar will write the first proposition. In situations where I'm happy with the suggestions, that's just fine. In situations where I actually want to use what I wrote down initially, I have to press 'escape' first to remove the autocomplete panel before I can press 'space' safely.
Netbeans doesn't use the space bar as a validating key for autocompletion (only 'enter' does that) and I like that behavior. Any way to replicate it in Eclipse?
Thanks in advance for your answers!
EDIT: I should have mentioned I'm using Eclipse on the Mac.
Guillaume
I have the same problem with Eclipse Indigo on Windows XP actually. Coming from intellij idea, I also felt the need to set the whole keyboard to trigger auto-complete.
A quick proof that SPACE key does accept suggestions : type inte on a new line. If the auto-complete menu shows, press SPACE. It goes for Integer.
If anyone knows how to set the SPACE key to "ignore suggestions", it would be great, because the escape key on my keyboard is also too far away :)
Thanks
Edit : actually the best would be to have only the ENTER key validating, because ';' and '(' also seem to validate
I just tried to reproduce your behavior, but couldn't. Here is the configuration I have (and the steps I have done to reproduce):
I have installed Indigo (current version of Eclipse, version number 3.7).
I did not change any configuration there, this is what is the default:
Under Window > Preferences > Java > Editor > Content Assist, I have the following settings:
Completion inserts (instead of overwrite)
Insert single proposal automatically (which is ok most of the time)
not insert common prefix automatically
I have a simple class, go down to a method, and do the following steps:
Enter this.no and wait some time. Sometimes I have to press CTRL + SPACE, sometimes not.
Proposal pops up which includes notify and notifyAll.
I press SPACE and a space is inserted in the text, the autocomplete suggestions are closed without inserting anything.
I do not know if older versions of eclipse have the same behavior.

How can I make my Eclipse RCP app's keyboard shortcuts (accelerators) work immediately after startup?

Our Eclipse RCP application was originally built in the 3.1/3.2 era and was running on 3.2 until we switched to 3.6 recently. Its IApplication runs via PlatformUI.createAndRunWorkbench(...). The WorkbenchAdvisor we pass to that function overridescreateWorkbenchWindowAdvisor(...) to return a WorkbenchWindowAdvisor whose createActionBarAdvisor(...) returns an ActionBarAdvisor.
This ActionBarAdvisor's makeActions(...) creates and register()s a bunch of org.eclipse.jface.action.Actions, many of which do things like setAccelerator(SWT.CTRL | 'O'); in their constructors. The Actions are subsequently installed in the ActionBarAdvisor's fillMenuBar(...) and fillCoolBar(...) methods.
The problem we are having (now that we are on Eclipse RCP 3.6) is that these accelerators don't seem to be active until their menus are shown (even if no action is taken besides closing the menu again).
We see a relevant bug but are having some difficulty understanding how to apply its remedy to our situation. We recognize that instead of Actions we "ought" to be using commands, handlers, and key bindings. But we're hoping we don't have to go down that path just yet.
How can we make our accelerators "live" as soon as the application starts up?
If you don't choose to use o.e.ui.bindings extension point, then there isn't a better way. You should only force update the menuManager yourself as you have done in your answer.
As #Prakash mentioned, if you want to keep down that path in your RCP app you must render all of the main menus to see your accelerators.
There is a partial upgrade path that will get you on the right track to commands without forcing a complete switch over right away. For each action in your menu, define a command with an id and define a binding to the shortcut you want in your plugin.xml. Then, when you create the action in your ActionBarAdvisor, don't set the accelerator. Set the IAction.setActionDefinitionId(*) to the command id, can call register(action);
Then you no longer need to use menuManager.updateAll(true) to eagerly render all of your main menu.
After hunting around and experimenting a bit trying to apply the advice from the bug, we added the following to our WorkbenchWindowAdvisor, which seems to have done the trick:
#Override
public void postWindowCreate() {
getWindowConfigurer().getActionBarConfigurer().getMenuManager().updateAll(true);
}
We have no idea how well this fits with the Workbench's design expectations; there could be a better way.