Autocomplete only when Enter is pressed in Eclipse - eclipse

I'm using Eclipse Kepler 4.3 with the latest Grails plugin (nightly version).
It is very unconfortable the autocomplete tool as it gets the first item when we click the Space key or the . key. For example, if we type:
params.property1...
Eclipse will actually write:
ParamsAction.property1...
How could we get the suggested item only if we press Enter?
My solution so far is to activate the autocomplete tool only if I press Alt + Space. It could be done here:
Windows - Preferences - Java - Editor - Content Assist > Uncheck:
Enable auto activation

I know this is an old question, but for anyone that might be still having this question: Windows -> Preferences -> Java -> Editor -> Content Assist: check -Disable insertion triggers except 'Enter'. This won't disable auto-activation, so you'll still get suggestions.

As long as i know, the best solution for this would be:
Windows - Preferences - Java - Editor - Content Assist > Uncheck:
Enable auto activation

Related

Java code completion in Eclipse IDE

A few years ago i set up my first Eclipse IDE env at work to begin studying the language. As i remember, it was some Luna build and it had a specific and really addictive code completion, which understood skipping some letters... like "p l n" would find "println".
Now i'w installed Mars build(the Luna's one has gone with the past harddrive), and cant find this option. Some code completion works, but it looks only by the current character.
Could someone tell me where to look.
Eclipse does understand skipping some letters in code complete, for example, if I have:
System.out.pln
with my cursor after the n and I press Ctrl+Space I am presented with all the println choices:
If it is not working for you I suspect that you don't have Code Recommenders installed or enabled. It should come by default with Eclipse IDE for Java Developers.
To check to see if it is installed and enabled, in Preferences, choose Java -> Editor -> Code Assist -> Advanced and see if Java Proposals (Code Recommenders) is listed and checked:
If it is not installed, install it from the Mars update site:
From Help menu, choose Install New Software
Choose Work With: as Mars - http://download.eclipse.org/releases/mars . from the drop-down list.
Choose Code Recommenders for Java Developers from the list. You may need to uncheck Group items by category to find it.
Complete the wizard, restart, check setting about and away you go.
In Eclipse just press ctrl + space bar. to auto code completion

Eclipse f3 not opening declaration

I have Eclipse (Mars) web development tools installed on a MacBook Air. Recently, hitting f3 stopped opening the declaration.
The key mapping in Eclipse (Mars) - web development tools:
In another Eclipse install (Luna) - Android development tools, where the f3 function is working, the key mapping is:
What is wrong with the Mars version? What do I need to add to get it to work in the Java editor?
I have seen this post, but I don't have the exact same issue. Nothing happens when I hit f3.
Additionally
Other short cut keys work.
Opening the declaration with the context menu does work.
But there is no key short cut listed in the context menu.
Did this key mapping change with Mars? In my Luna verion, the context menu has the key map listed:
I've the same issue. You can use "Ctrl + Left mouse click" instead.
Make sure your function lock key is not pressed. I apparently hit mine and didn't notice given that F3 is the only function key I use.
Seems stupid but this literally happened to me and the other suggestion didn't help.
In eclipse mars goto:
window
preferences
General
Keys to open the key mapping view.
type 'open declaration' in the filter text.
copy one of the commands that are already there Copy Command
Enter 'F3' in the Binding.
In the drop down menu of the combo box of 'When' select Editing
Then whatever Language You Are Using
Source
Apply
and press Ok
I had the same issue after installing Apache Directory Studio.
Go to Window->Preferences, General->Keys. Filter for F3 and you'll see all the different ways that F3 is bound. I got it to work again by disabling F3 in the LDAP windows (i.e. deleting the binding).
Some suggestions to try:
1) Try creating a new workspace, and check if F3 works
2) Try switching to a different perspective
3) Try downloading a different eclipse release, maybe the java developers release, check that F3 works, then install whatever you need for web development.
Good luck :)
Right Click on the project -> Properties -> Project Facets -> Click on the Configuration Link -> Click on Apply Button -> Click on OK button.
The above steps should set your project as a Java project.
Looking at the comparison of the preferences that work vs what does not work, the issue is clear.
Go to: Window/preferences/General/Keys to open the key mapping view.
Type 'Open declaration' in the search box
Enter 'F3' in the Binding textbox.
If you are editing for C++, Java any language, you need to have a specific F3 binding for that language!
Example for Java source code select 'Editing Java Source' in the 'When' dropbox.
Apply and press Ok
Even I faced the same issue in windows,I was using cucumber and was unable to navigate using F3. I solved by doing the following:
Click on Help in Eclipse >
Eclipse MarketPlace
type "Natural" in search and press enter
Install "Natural 0.9" plugin
Restart Eclipse
This should work, if not working even after that, uninstall cucumber plugin in Eclipse Marketplace
You will be able to navigate from Gherkins, even after this if you are finding issues do the following:
Go to Window ->Preferences, General->Keys > Click on "Restore Defaults"
I had a similar problem today - Unable to open Declarations in Java Editor using F3 or CTRL+Left Click.
Solution :
STEP1: Selected any java file in Eclipse Explorer.
STEP2: Clicked the - sign at the top of the Eclipse explorer. This compressed view of all modules in Eclipse.
STEP3: Right click on the empty space on the Eclipse Java Explorer and chose Refresh Option (F5) .
STPE4 : Happily the navigate options like F3, F2 , CTRL + Right Click all started working.
Solution :
1. Download and install this eclipse
eclipse-jee-2019-12-R-win32-x86_64
F3 shortcut key is worked for java file and Testng.xml.
i am able see package name and class name and also it navigate methods.

Using Tab key to indent code in Eclipse Kepler under Mac

When I was working under Windows or Linux, pressing Tab key in Eclipse would indent and shif-tab would un-indent code. I work on a Mac now and pressing Tab does nothing (Eclipse Kepler).
More than that: when I press Tab key inside Eclipse editor, the next pressed key is ignored. I tested this in PyDev and PHP environments.
What might be the reason?
Solutions:
1) Try to uninstall your kepler distribution and pull another from here http://www.eclipse.org/kepler/, you must have some key binding that must had came along with your distribution.
2) Also if you go to menu Eclipse > Preferences > General > Keys you can try to understand where is your conflicting command, maybe tab is associated with more commands than just the 'Indent Line', which could cause that behavior.
Note: There is absolutely nothing wrong with Tab Key on Eclipse Kepler, over OSX (I've a Mac too and it works perfectly).
I exported a CSV with my default key bindings, just in case you want to check out an working version .
Also make sure you don't have any specific shortcut on your OSX Keyboard Configuration targeting the Tab Key, you can check this on OSX Settings > Keyboard > Shortcuts.

Ctrl + Space not working for content assist on eclipse

My problem is that the content assist window won't pop up after clicking Ctrl + Space. I checked my shortcuts and the content assist is bound to Ctrl + Space. Sometimes the window automatically pops up making suggestion after typing dot e.g., but this won't happen when using the keys combination.
Eclipse version:
Eclipse Java EE IDE for Web Developers.
Version: Kepler Service Release 1 Build id: 20130919-0819
My OS is Ubuntu 12.04 if that matters.
In my case;
Window>Preferences>Java>Editor>Content Assist>Advanced
Make sure Select the proposal>Template Proposals,SWT Template Proposals,Java Proposals ,Content assist cycling>Template Proposals,SWT Template Proposals,Java Proposals is ticked.
Go to Windows > Preferences > Java > Editor > Content Assist > Advanced > select all Java only. If you select all, then multiple occurrence of same instance would be shown in Suggestion list. which might be annoying some times.
I managed to fix it finally. The problem was that the ibus was overriding the shortcut so I deleted this shortcut configuration.
Type ibus in the dash:
Then select Keyboard Input Methods. From there click on the first three dots next to the Enable or disable textfield. This windows should appear:
If there is something bound to Ctrl + Space simply delete it.
For that Go to
Eclipse --> Windows --> Preferences --> Java --> Editor --> Content Assist --> Advanced --> select all Java & Java Type Proposals.
and check mark : Java Proposals(Code Recommenders)
To enable Ctrl+Space.
Go to Control Panel --> Region and Language --> select Keyboard and Languages tab --> Change Keyboard button --> select General tab --> Under Installed Services --> Remove all languages except English(United States). click apply and ok.
Eclipse --> Windows --> Preferences --> Java --> Editor --> Content Assist --> Advanced --> select all Java & Java Type Proposals.
Eclipse --> Windows --> Preferences --> General keys --> Type Content Assist in right side search box --> Select command Content Assist --> click on Restore To Default --> Apply --> ok
Now you are ready to use ctrl + space feature for content assist.
Earlier I was also facing the same issue : I just followed below steps :
Go to Windows --> Preferences --> Java --> Editor --> Content Assist --> Advanced --> select all Java & Java Type Proposals.
Click on Apply and close it.
Restart the eclipse.
For mac:
By default ˆ+space is assigned for switching inputs of the keyboard.
You can deselect that option by going to
System preference > Keyboard > Shortcuts > Input Sources
check for shortcut that using your key and disable it
It happened to me also,
What I have done is change the workspace folder to
Another folder and problem solved!
Ctrl+space was not working in my eclipse.Somehow it got disabled.
I have tried many options and didnt worked any options.
Finally this was work out
Go to Preferences > Java > Editor > Content Assist > The "Auto activation triggers for Java:" field.
Paste "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz." (note the dot after z) .This is the best solution and no need to even press ctrl+space.
This issue happened to me and none of the stack solutions seemed to resolve it. I finally figured that some other windows task was stealing my hotkey press. If nothing else works, I recommend that you downloaded a free software 'Windows Hotkey Explorer' that reported the registered hotkeys.
In my particular situation, I found ctrl+space was seized by 'blackboard collaborate' (a unpalatable java application for webcasts used by some of my courses).
I closed Eclipse killed all java processes (which included blackboard). Restarted eclipse and my autocomplete was back!
(Note: Hotkey Explorer was incredibly buggy and crashed every time I used it. I was able to get the information I needed before it crashed though so it was useful. Another (shareware) application that I didn't use but noticed online is: Hotkey Commander.
Though I have eclipse proposal settings configured properly it was not working for me. In my case Ctrl+space key combination was hijacked by another background running process (I was running AllwaysOnTop utility for windows). it worked after exit that process. :)
I was facing the same issue. If you use OS X Eclipse Ctrl+Space shortcut can be interfering with OS X system's "Selecting previous input source" using Ctrl+Space shortcut as default.
It is necessary to edit System Preferencies/Keyboard/Shortcuts/Input Source and uncheck the "Selecting previous input source" or change the shortcut on something else. Eclipse should work after that even without restart.

How to configure eclipse to autosave on run?

I'm looking for a configuration or plugin for eclipse that automatically saves files (so I don't have to use Ctrl+S). It could do it on lost focus or over some period of time. I think I saw something like that (I know IDEA has it), but I cant find it now.
Update seven years later (Eclipse Neon 4.6)
Eclipse now has an Automatic Save of dirty editors
The autosave option is disabled by default.
A new autosave preference page (Preferences > General > Editors > Autosave) is available and allows to enable/disable the autosave and change the interval of autosave.
The countdown is reset on keyboard activity, mouse click, or when a popup is displayed (e.g. content assist, preference page, ...).
Original answer (2009)
The OP IAdapter added in the comments:
I bet plugin like I describe exists.
... and you are right!
Eclipse plugin saveDirtyEditor should do just what you need.
Copy the SaveDirtyEditors_1.0.2.jar in your plugin directory.
You will get a new preference page under
General > Editors > Text Editors > Save Dirty Editors
, allowing you to save dirty files like 'myfile.java' under 'myfile.java.snapshot' every 30 seconds (can be less if you want).
Without additional plugin, though, Eclipse does not support natively that feature.
The closest could be:
Window > Preferences > type "build"
> General > Workspace > [x] Save automatically before build
That way, each time you hit CTRL+B for actually building your sources, they would be saved.
But I realize this is not exactly what you are after.
Beware your option would not be very efficient with the "build automatically" option activated... (that would trigger too much builds)
Again, without achieving exactly what you are looking for, you also have:
Run/Debug > Launching > Save required dirty editors before launching
Run/Debug > Launching > [x] Build (if required) before launching
Note: the difference between IntelliJ IDEA and eclipse is the "compile on save" feature:
As mentioned in the IDEA FAQ:
Q:
Can I enable "compile on save" in IntelliJ IDEA?
IntelliJ IDEA currently doesn't support this feature.
However there is an "Eclipse-mode" plug-in which provides similar functionality, so we suggest you to try this plug-in.
Note that by default IntelliJ IDEA saves the files for you, so you don't have to press the Ctrl+S shortcut frequently like you need to do in other IDEs.
However, with Eclipse, the "build on save" is activated by default, hence the absence of that particular feature.
http://code.google.com/p/eclatosa/
"Saves all open editors in eclipse when deactivating the eclipse window (like in IntelliJ)"
No need to install more plugin.
Window -> Preferences -> General -> Workspace
and there you can check:
Save automatically before build + Build automatically
If that doesn't work try this:
Preferences -> Run/Debug -> Launching -> Save dirty editors before launching
I wrote a plugin a long time ago to do this that still seems to work: http://www.stateofflow.com/projects/71/save-me
It saves the editor when it loses focus. However, if you switch away from eclipse it doesn't notice.
Try this
Goto Eclipse Preferences > General > Editors > Autosave
if it not work then try this
Preferences -> Run/Debug -> Launching -> Save dirty editors before launching