Auto Activation in Eclipse - java

Here is a problem with MyEclipse. While I input "." after some variables e.g. list.size(), in the past Eclipse automatically suggested me all possible methods and options. But now this function is not working. And also I have already enabled the Auto Activation option in Eclipse preferences.
MyEclipse Version = 10.7.1
If someone knows about this problem, please suggest me how to solve.

Check the value of the content assist trigger.

Since I do not have all your Eclipse setting, I would suggest going to the Preference -> Java->Editor->Content Assist and click Restoring Defaults.

Related

Suggest code corrections in Idea

I've recently moved from Eclipse to Intellij IDEA for java development,
I have some code as shown in the screenshot, and as you can see there is no package called test2, Eclipse used to give suggestion if I want to create/move such a package, what is the IDEA equivalent shortcut for that option ?
Context specific actions can be brought up by alt+enter while having your cursor on the underlined part.
May I also suggest ctrl+shift+a. This brings up a search field for all kinds of menu items and settings.
Edit
Two more tips I always give IntelliJ newcomers:
Regularily check out Help/Productivity Guide. It tells you which features you don't use yet.
Install the Key promoter plugin. It tells you which shortcuts you could have used when you use an IntelliJ-Feature.

How to enable Inspection, after being Disabled in Android Studio?

Problem:
In my manifest my application word was having Yellow Background, when I do Alt+Enter it gives me above options, I clicked Disable inspection just to check it, but when I do Alt+enter, but again after doing alt+enter I didn't get any option for getting it enabled?
After clicking Disable Inspection, I am not getting any option for Enable Inspection, Is there any way to get Enabled again?
You can find and disable/enable all inspections here.
For your situation, you have to find and make selected this two:
If you want to restore all inspections to default, you can go to:
File > Settings > Inspections >
Click on Advanced Settings
and Reset to Default Settings
If your project is under version control, you might notice that .idea/inspectionProfiles/Project_Default.xml and .idea/inspectionProfiles/profiles_settings.xml were either added or changed. You could just reset or remove those files (Making sure to only reset the parts you want to re-enable.)
Go to File -> Setting -> Editor -> Inspection and mark which inspection that you want to enable.
I found this on google, why dont you try this out:
https://www.jetbrains.com/help/pycharm/2016.1/disabling-and-enabling-inspections.html?origin=old_help
If you haven't closed IntelliJ yet,
Menu File→Settings Repository...→Overwrite Local will restore a backup of your settings, including the just disabled inspection.
This is effectively an 'undo' but you need to have prepared a settings repository in advance for it to work. If you haven't done this yet, you're on your own, and I suggest you make one now for future accidents (and as a bonus, for sharing settings among multiple computers).
File->Manage IDE Settings-> Restore Default Settings
My problem is solved

Eclipse Mars is not saving preferences

Ctrl+Space is not showing proposals. e.g sysout or arr. is not working. I tried to restore default from Content Assist-> Advanced.
But, the changes which I make does not get saved and it reverts back to the original settings in preferences. Has anyone encountered this before? Any help will be much appreciated.
This is actually kind of common in eclipse.
Although this link doesn't describe the exact symptoms you have stated, the solution it proposes may be able to solve your issue:
http://mschrag.blogspot.co.nz/2009/01/open-type-cant-find-your-class.html
Quit Eclipse
Go to workspace/.metadata/.plugins/org.eclipse.jdt.core
Remove *.index and savedIndexNames.txt
Restart Eclipse and search Ctrl+T for the offending type. The indexes will be rebuilt.
Try doing that. If it still doesn't work, try to delete the class itself, and re make it. Just copy and paste. Again, you mentioned the default preferences:
Windows > Preferences > Java > Editor > Content Assist > Advanced
The Eclipse help page tells to restore:
Select the proposal kinds contained in the 'default' content assist list:
Other Java Proposals,
SWT Template Proposals,
Template Proposals,
Type Proposals
Now, also go in here:
Window > Preferences > Java > Appearance > Type Filters
And make sure that you didn't filter out random stuff that you don't want to filter out. Also try to just disable everything there.
Let me know if it helped!
I have the same problem on Eclipse Neon.
It may be linked to Code Recommenders because only the "Java Proposals (Code Recommenders)" item will be saved when checked.
But when you uncheck this item it will allow you to save some other items. I don't understand why but some items will still remained unsaved.

Disabling Eclipse auto-complete but keeping auto-activation

I use Eclipse for Java development. I like the auto-activation feature because I can add all the letters and numbers so I can see class members while I'm typing; making it behave similarly to Visual Studio. If I don't add all of the letters and numbers to the auto-activation list, it will only pop up with class information when I'm typing the first letter after the '.' delimiter, and then it disappears.
The real problem arises when I'm typing in a variable name or something else. As soon as I hit space, the auto-complete types a bunch of crap following what I've typed in attempt to complete it. It's driving me crazy!
Any way to turn this off?
The checkbox you have to check is: "Disable insertion triggers exept 'Enter' "
(under Java -> Editor -> Content assist)
I'm on Eclipse 2018-12 and C_H's answer had no effect on the behavior:
I believe what you'll want is to deactivate "Insert single proposals automatically"
EDIT: It seems this answer is now outdated. It may work for old Eclipse versions. For any more recent versions refer to #ChrisP's answer from 2019.
Open menu Window, then Preferences. Follow path Java -> Editor -> Content assist. Now mess around with the settings to find your ideal setup. I believe what you'll want is to deactivate Insert single proposals automatically.
If anyone wants to know how to stop the auto-complete for brackets:
Toggle off: "Edit --> Smart Insert Mode"
Version: Eclipse Photon
In continuation to #G_H's answer :
This worked for me although I am sure there is another and a better way.
Window -> Preferences -> Java -> Editor -> Content Assist -> Set Auto Activation Delay(ms) : 200ms from 0ms in my case.
You may want to increase/decrease the value 200 depending on your typing speed.
The reason this worked is because of the hitting of "Spacebar" before the delay arrives.

Being in Debug View, and after program termination, switch back to Java View in Eclipse

I am looking for a way to come back to the standard Java View in Eclipse after the application I'm debugging is over.
Is it possible to accomplish that? That is the default behaviour in some other IDEs (Visual Studio, for instance) and I'd prefer to have it that way. It's so boring to have to go an manually switch the view again to the initial one :(
Thanks
Eclipse is a generic platform where you can have a dozen type of different launch configurations, so a good and usable 'generic' implementation of this feature is not trivial.
However, there is an open bug report for this feature, which has some activity recently so there is a chance that this feature will be included after Eclipse 3.7.
I wrote a plugin that does what you want. Here's the update site:
http://backtojava.s3-website-us-east-1.amazonaws.com/
I didn't categorize the feature, so when you look for it, unselect the "Group items by category" checkbox.
And here's the project on Eclipse Labs I made to host the source:
https://hg.codespot.com/a/eclipselabs.org/backtojava
I haven't checked the Feature project in; just the plugin.
I personally have never seen such a feature. I also wouldn't consider such a feature desirable. Rare would be the occasion where I would be in debug mode for only a single run. Typically, the editing window provided in the debug mode is sufficient for any edits I would make during a debugging session.
Do you have to use Eclipse? There are other Java IDEs, for example in Intellij IDEA you can set the debug window 'unpinned', so it hides when you click on the editor. Personally I would find that behaviour annoying but it might work for you.

Categories