eclipse autocomplete - eclipse

I have noticed that qtCreator handles the auto-completion much better than eclipse.
For example, if I have a line that says object.firstItem() and put my cursor between . and f, and then delete the first word (thus becoming object.|item()) and then press ctrl+space and choose secondItem(), qtCreator guesses object.secondItem();, whereas eclipse chooses object.firstItem()Item().
There could well be other features that are present in qtCreator, too, but not in eclipse, though it's the only one I really noticed. But why not share all good ideas since they all are open source ? I would be interested in all good features of qtCreator and eclipse combined.
Is there a way to have such a behaviour in eclipse too, through configuration or through a plugin ?

This feature is supported by Eclipse, too. (Or more specifically, the Eclipse Java Development Tools.)
Just hold down the ctrl key when selecting the item from the list of proposed completions to toggle between inserting and overwriting completion mode.
To change the default behaviour, go to Preferences -> Java -> Editor -> Content Assist and change the top-most radio button from "Completion inserts" to "Completion overwrites".

Related

How to disable eclipse4 built-in keyboard shortcut?

Eclipse 4.2 seem has some built-in shortcuts, such as Ctrl+P, Alt+C, Alt+X etc, you can not find them from "Window->preferences->General->Keys". I'd like to re-define these shortcuts, e.g. bind Alt+X to run maven build, but when i press Alt+X, at the bottom right corner of Eclipse, it flashes quickly and my mouse is out of control, i think this is because of shortcut conflict.
Anyone who know how to disable the built-in shortcuts? Thanks.
Edit:
Ctrl+p is only bind to one action.
When i click Ctrl+p, the bottom right corner show, this message is from from eclipse:
Well, the above is the good situation--at least you can choose which action to run. for Alt+P, Alt+c you have no chance to choose, eclipse is flipping and you are out of control.
Are you certain there isn't something in your OS or another application that is handling those keyboard triggers? If you assign a keyboard shortcut in Eclipse's Preferences, it will indicate when there is a conflict; if you don't see that, then it's not an Eclipse shortcut.
I found the root cause of this problem, i import all my keys from Eclipse 3.7 to 4.2, most of them works, however some of them conflict but Eclipse fails to show the conflict shortcuts, Let's say, Ctrl+P, this is print shortcut for eclipse by default, in eclipse 3.7 i bind Ctrl+p to another command, after import, eclipse 4.2 shows just like 3.7(see above), however in fact it still has conflict even though it does not show the conflict. I think this might be an eclipse bug. I'm the one who use shortcut extensively. Hope this help others with migrating shortcuts.

Equivalent of Komodo's "show unsaved changes" in Aptana Studio?

I've been using Komodo Edit for the last few years, but am once again thinking of switching to Aptana Studio because of it's built in refactoring tools for Python.
One of the features I use all the time in Komodo Edit is "show unsaved changes". This simple feature pops up a window with a diff of the text in the current editor window vs. the saved file on disk.
There must be a way of doing this in Aptana Studio (or more to the point, there must be a way of doing this in Eclipse, since Aptana is built on top of it.)
How do I get a diff show unsaved changes?
Windows -> Preferences -> General -> Editors -> Quick Diff.
Check the 'Show Differences in overview ruler'. Set the combo on 'Version on disk'. Select nicer colors for the diff ;) and OK the dialog.
Now, every change in your file will be visible on the 'Overview Ruler' and on the 'Annotation Ruler' (the editor left and right bars). The marks will be visible until you save the file.
Not an exact match to the Komodo feature, but this, along with the local history feature of Eclipse, can provide a lot of control.
Hope that helps.

How Do I Switch Between Multiple Eclipse Windows (in "Split Screen" Mode)

Eclipse allows you to open more than one text editing "window" at a time to get a "split screen" effect. This is great, but the problem I'm having is that there doesn't seem to be any way to switch between these windows, directly.
Now, you can use the usual commands (Ctrl+Page Down, CTRL+e, ALT+RIGHT, etc.) to switch between specific buffers. In other words, if I have window 1 with A.java and B.java open, and window 2 with C.java open, I can use Ctrl+Page Down to go from A, to B, to C. However, I can't just go from A or B (ie. from window 1) in to C (ie. to window 2), unless I use CTRL+e and type in "C.java".
There are half a million Eclipse commands though, and they're certainly not all labeled consistently, so it's quite possible I'm just failing to find the relevant command. Does anyone out there in SO-land happen to know it?
By default, its Ctrl+F6. However, its useful if you map you keys to Ctrl+Tab to switch between open editors like Windows.
You can change your preferred keys in Window>Preferences>General>Keys and change "Next Editor" to any key of your choice(Ex: Ctrl+Tab). Hope this is what you needed.
This can be achieved easily if you are using Vrapper in Eclipse. Vrapper
is a Vim plugin for Eclipse. If you are trying to maximize your productivity in Eclipse like we all are, it's well worth the try.
Once you got it installed, check out the Split Editor Plugin for Vrapper. You can then create splits on the fly and switch between them using the standard Vim shortcut: Ctrl-w w
Bonus: don't forget to maxmize your editors using Ctrl-m. If your editor ever loses focus for some reason, regain it by pressing Ctrl-F12
Finally open any file in your project using Ctrl-Shift-r
Edit from anula comment:
A useful thing to mention here: Ctrl-w by default binds to closing window, so if you want to use it as in Vim you need to first go to Window->Preferences->General->Keys and unbind "Close".
You can install the HandySplit plugin from Eclipse Marketplace and bind its 'Toggle focus between split editors' command to any keyboard shortcut you like.

Eclipse help box

I am using Eclipse to program Android apps and I love how the little helper box thing comes up when you start to type and suggests things to you.
However, this only happens sporadically and I was wondering if there was a way to keep it visible for longer or, even better, a key combo I could press to bring it up. If I start to type something, it either helps me by suggesting things or doesn't appear.
Try Ctrl+Space. The feature is known as "content assist," "code completion," "auto-complete." In the Visual Studio world, I think it's called "Intellisense."
If you want the suggestions to appear immediately (I prefer this) you can change the delay by going to Window → Preferences → Java → Editor → Content Assist and change the Auto activation delay to 0. In my version of Eclipse (Helios for Java EE), that field is third from the bottom.
An easier way of finding this preference screen is to use the search box in the upper-left-hand corner of the prefs (as before, Window → Preferences), and typing completion. From there you can see all of the different content assist preferences that Eclipse offers. Mine has Java, JavaScript, CSS, HTML, JSP, and XML - most of those because I'm using a fancier version of Eclipse.
By default, when writing Java code, the . (period) key triggers auto-activation of content assist. You can change this setting in the same screen as the auto-activation delay.
I think its Control+Space for Code completion. Try that
Also go easy with the code completion popup delay. Dont set it to 0, i remember a strange behaviour in Eclipse where there was no popup at all.
Ctrl+Space is the shortcut for Content Assist.
Ctrl+1 is the shortcut for Quick Fix.
Ctrl+2 is the shortcut for a menu of Quick Assists. (Ctrl+2, F is the shortcut for Quick Assist - Assign to var/field, and in place of F you can also type L or R for other options.)
To see and/or modify available shortcuts you can go to Window > Preferences > General > Keys.

How to turn off the Javadoc hover in Eclipse (or selectively enable it)?

A fellow developer dislikes the Eclipse hovering Javadoc and would like to disable it (one option), or, better yet, only selectively enable it (other option). He's using Eclipse 3.3. Is this possible?
Not sure what you mean by "selectively" enabling it. Based on what?
Directions below are for 3.5, I don't have 3.3 lying around to check but I'm pretty sure same settings were available.
Go to Window - Preferences; select Java -> Editor -> Hovers on left hand side. You'll have to uncheck the Combined Hover option on the right; you can then either uncheck Javadoc option or check it but specify a modifier key for it (in the edit box below). In the latter case javadoc hover would only appear if you hold that key.
I've got to say, though, that the inconvenience of not having Combined Handler makes this really not worth it in my opinion.
You could go to
Preferences / Java / Editor / Hover
and untick the "Combined Hover" option: no more popup.
Then you would have:
Shift+F2: open the external javadoc if javadoc archive or directory has been associated with your project (and if some javadoc has been generated)
Alt+Shift+Q, followed by J: open the javadoc view, with the same content than the popup previously seen on mouse hovering.
In Eclipse 3.6 you can now specify a modifier key to be pressed down for the Combined Hover to be activated. This way, you can have the old behavior without the automatic popups. The automatic popups were driving me crazy, often obscuring something I was trying to read.