No completions available, strange Eclipse behavior - java

I think I tried every suggested solution, but this Eclipse auto-complete problem is quite particular:
I launch Eclipse, content assist works fine;
I want to create a LineBorder in my Swing project;
I type LineBorder panelBorder = new Li and hit Ctrl+Space;
No popup appears and in the status bar it writes in red "No completion available";
I try Ctrl+Space on the elements where content assist worked fine 2 secs earlier, it doesn't work anymore.
I try the same thing on other project, on the same project after closing and reopening it, after cleaning it and content assist works just fine before I try using LineBorder constructor, then it crashes.
What I tried:
Reset to defaults in 'Preferences->Java->Editor->Content Assist->Advanced';
Check every single checkbox in the same menu;
Create a new workspace and try it there;
Delete .index files and 'savedIndexNames.txt' in .metadata/.plugins/org.eclipse.jdt.core;
Check for the duplicate libraries.
What I didn't try is reinstalling Eclipse. The version I use is Eclipse IDE for Java Developers (Juno).
Nothing seems to work.
UPDATE:
Checked the logs as iGili suggested.
There are some exceptions raised at the time of failure:
org.eclipse.e4.core.di.InjectionException: org.eclipse.core.commands.ExecutionException: While executing the action, an exception occurred
Caused by: org.eclipse.core.commands.ExecutionException: While executing the action, an exception occurred
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findConstructorParameterNames(InternalCompletionProposal.java:257)
at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findParameterNames(InternalCompletionProposal.java:1456)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.appendUnboundedParameterList(CompletionProposalLabelProvider.java:113)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createMethodProposalLabel(CompletionProposalLabelProvider.java:272)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createStyledLabel(CompletionProposalLabelProvider.java:570)
at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.computeDisplayString(LazyJavaCompletionProposal.java:262)
at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getStyledDisplayString(LazyJavaCompletionProposal.java:238)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.handleSetData(CompletionProposalPopup.java:841)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$24(CompletionProposalPopup.java:831)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$3.handleEvent(CompletionProposalPopup.java:593)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Table.checkData(Table.java:1166)
at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:6749)
at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5534)
at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1896)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2440)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
and it goes on, I don't know what is the convention for posting long stack traces

I had the same. Windows -> Preferences -> Java -> Editor -> Content Assist -> Advanced. Make sure "Java Proposals" checkbox is ticked at default content assist list (1st panel of the pop up).
By clicking "Restore Defaults" button at the bottom "Java Proposals" could be checked automatically.

Go back to the Advanced Content Assist preference page and Restore Defaults. Close the dialog using the OK button.

I had the same problem. Actually I had the content assist pop up, but that was smaller than a couple of pixels.(Who shrunk this and why was it shrunk no idea whatsoever...)
But if you see something strange(in my case, that was the letters 'Rp', but I guess it can be anything) where normally the content assist should appear, try to expand it, and you might get it back. Good luck.

None of these answers helped me: Java Proposals was ticked, and restoring defaults didn't do anything. It started working only after I restarted Eclipse.

Windows -> Preferences -> Java -> Editor -> Content Assist -> Advanced ( Java Proposals) need to be choosen.

What worked for me was to create a new workspace and copy all the projects to that workspace. The issue now only occurs on the previous workspace.

I think you are running into a known defect in 3.6. see here
try to download a newer release- it is fixed since 3.7
[edit] I just realized that you've wrote 'Juno'- are you using the latest (4.2.2)?

I just fixed the same problem in Juno switching workspace and then switching back. Other solutions didn't work.

I had the same problem but in only one particular file in my project (completion worked fine on other files). I'm also using Eclipse Juno.
I fixed the problem by removing some warnings due to unused imports in the file where completion failed... and it started working again!

This checkbox "java proposals" will be ticked until I have failed and got "No completions available". After that, it will show as unticked the next time I am opening the settings.

Go to
Eclipse → Preferences → Java → Editor → Content Assist → Restore Defaults
and then
Project → Clean

I couldn't expand sysout this morning. After a couple of wasted hours, I found that I was trying to put System.out.println() outside a method. When I did it inside a method, it all worked perfectly.

I had the same issue just now with Eclipse version 2019-06 (4.12). For me a Project clean solved the problem.

Related

How to fix Eclipse autocomplete not working

The autocomplete of eclipse is not working now and I searched for hours but I couldn't find an answer to solve it. I haven't used it for long time then the first thing after opening it was to install SWT and windows builder even though I had swing installed. What I mean is, it is may possibly be because of some conflict caused by swt and swing(I read something about a conflict but I don't if this is possible).
Strange thing is it doesn't show anything when I press ctrl+space but when I go Edit-> Content Assist -> Default(it says Ctrl+Space nearby it), it shows things needed to be shown/works as desired.
public class Dsada {
String sssss;
public Dsada(){
sss //pressing ctrl+space is not working,Edit->ContentAssist->Default works fine
}
}
The solution is not to tick/untick some stuff under Windows->Preferences->...->Content Assist-> Advanced. I checked if "ctrl+space" is hijacked by some other thing which is not and checked keyboard language which is English(Those are suggested in mkyong).
I read something about a bug but I couldn't understand. I tried to delete eclipse and re-install again but I guess some settings just stayed in the machine so that it didn't work.
This is recurring for me. I'm using Eclipse 2019-03 in Windows 10.
The steps below work for my case, and does not require a restart.
Window->Preferences->Java->Editor->Content Assist->Advanced
The following options are de-selected, and when I set them the autocomplete worked as before. No restart needed.
1. Java Non-Type Proposals
2. Java Proposals
3. Java Type Proposals
4. Java Proposals (Task-focused)
I don't know what's triggering this but it only happens after I've created a new project. Usually doesn't. It simply doesn't happen often enough for me to notice a pattern to follow up on more.
Clearly this problem occurs with a variety of causes, so review the other answers to see if they match your case.
The hot key combination ctrl+space might be conflict with other settings in system if you are using windows.
Try modify this combination like alt+/, i always use this one since the first time i knew eclipse. It works well.
Hope it works for you.
Window->Preferences->Java->Editor->Content Assist->Advanced
The following options have to be selected, then the autocomplete worked . No restart is required.
Java Proposals (must be selected, not sure the follows)
Java Non-Type Proposals
Java Type Proposals
Java Proposals (Task-focused)
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.
I faced hot key problem with use Ctrl+Space. I tried to fix the issue first by Windows->Preferences->...->Content Assist-> Advanced and selected
Select the proposal kinds contained in the 'default' content assist list:
Other Java Proposals,
List item
SWT Template Proposals
Template Proposals
Type Proposals
but didn't help.
Therefore, I tried another solution. There would be multiple languages on your computer which could be eating up your Ctrl command. To solve this Go to Control Panel -> Region and Language -> Keyboards and Languages (tab) and then Change Keyboards.
You’ll see a list of languages installed – remove any that you don’t want (click the language and then click the Remove button) until you only have the ones you want left. That fixed it for me, but you can also check the Advanced Key Settings tab to make sure that none of the keyboard short-cuts that are set include Ctrl-Space.
Once you’ve done that, Ctrl-Space should work nicely!!!!
I had the same Problem on Ubuntu 14.04. The problem for me was that ibus used Ctrl+Space as a shortcut. I solved it by starting the program ibus-setup and chaning the shortcut to something else than Ctrl+Space.
Go to Windows >> Preferences » Java » Editor » Content Assist. Then Check the Auto activation triggers for java, Add this in the text box .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Recently, I also faced this issue. When I install neon version eclipse.
By (1) deleting respective class, (2) restoring defaults appearance and (3) restarting eclipse, solved the problem for me.
Hope it will help someone.
Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked.
I checked windows has no conflict of ctrl+space (of eclipse autosuggestion) with windows.
This is mere configuration issue of eclipse. reinstallation would fix it.
Thanks.
I select all the parameters in Preferences -> Java -> Editor -> Content Assist -> Advanced.
It help me and resolve the my problem.
Cltr+space work using this step.
Saving my work and restarting Eclipse solved this for me. I hadn't shut down Eclipse in a while, maybe weeks.
I had the same problem (MacOS Monterey, Eclipse 06-2022). Turned out it works with pressed fn button.
For Mac user, you can try : Preferences -> Java > Editor > Content Assist and then :
tick the field "Enable auto activation"
in the field Auto activation trigger for Java, you can input the text alphabet ".abcdefghijklmnopqrstuvwxyz"

No syntax highlighting in eclipse for java

There is no syntax highlighting in java files in my eclipse..This happened all of a sudden..Not sure why..
This is how it is looking now..
As mentioned in other posts..i tried to change the color from preferences window and there is nothing when i type java..something really messed up...
AAny suggestions..
Update:
It seems Java plugin is not installed..as per the below screeenshot
And when i try to install java plugin it says new version is already installed as per the below screenshot
Closing the file's tab and re-opening it fixed it for me.
(I actually closed all the tabs...)
I faced the same issue all of a sudden after a commit/update project operation.
The point is, default editor of Eclipse has changed somehow and we have to set it back to normal.
Try the below method,
1. Goto Windows -> Click Preferences
2. From the Preferences window goto General -> Editors -> Click File Associations
3. You can choose the default editor for *.java files here
When I first opened Preferences, 'Text editor' was set as the default editor for .java files and then I changed it back to 'Java Editor'.
Now it works perfectly fine.
You probably have a corrupt installation or you have recently installed a corrupt plugin.
The following steps might help.
In your Install window,
view your "already installed" plugins.
select the "Installation History" tab.
select a previous stable configuration
Click the "Revert" button
TLDR; open another workspace, then come back to the original workspace.
Ok this is odd, but for me, all the highlighting suddenly went away for Java files. I explored all of these ideas here, with no effect. I created a new workspace, planning to move everything to it. I realized that can be a pain to move many projects over, so I went back into the original workspace to look at some settings, and poof - the highlighting was working again.
I have one java class file like a text editor.
I tried following,
Select the respective java class file from eclipse.
Right click on the file and mouse hover on "Open with".
Select java editor.
Now its works.

Eclipse missing action Set

I have a problem while opening Eclipse. In the error log it says:
unable to find action set org.eclipse.wb.core.ui.actionset
org.eclipse.rse.core.search.searchActionSet
org.eclipse.rse.core.search.searchActionSet
org.eclipse.mylyn.doc.actionSet
org.eclipse.mylyn.context.ui.actionSet
I'm using Eclipse juno(version 4.2) and my ADT is version20 and Java 1.6
Do you have any idea what I am supposed to do?
In general this is a leftover from something you have uninstalled. To get rid of the error, close Eclipse, find the workbench.xml (XML) and workbench.xmi (XMI) files in either the
.metadata\.plugins\org.eclipse.ui.workbench\
or
.metadata\.plugins\org.eclipse.e4.workbench\
directories within your workspace and remove ALL corresponding lines (search for the package name you see in the message).
I think that this can happen when features are removed from Eclipse and a workspace is not properly updated. Create a new workspace, import all your projects, and delete the old workspace.
I went to the run configurations for the RCP app I had (created using EMF) and I checked the radio box under the Run--> configurations... dialog to "Clear workspace" before running. This fixed the issue about the missing ActionSets. I tried to find the references to the missing ActionSets per the above method and that did not fix the bug (there were no references to the missing ActionSets in the workbench.xml or workbench.xmi files. I am using Kepler SR2 on Mac OS X 10.9.2.
I had this problem due to a particular view (although I'm not sure what caused it in the first place). I simply closed the view and restarted Eclipse - problem solved!

Eclipse Template Proposals (aka auto completion) not working

recently the proposals (Ctrl+Space) for Eclipse/Java stopped working, as suggested in the wiki I looked at the Preferences of Content Assist for Java, but all options are checked and still not working, any idea?
EDIT: One error is shown while trying to display proposals: Project facet grails.app has not been defined. It is used in plugin com.springsource.sts.server.tc.core.
Somehow the references to the JDK where broken, so no completions could be made!
UPDATE: Solved by going to Window -> Preferences -> Installed JREs and changing the JDK folder to the right one.

AntSecurityException when opening ant-file in eclipse

one in a while eclipse refuses to open antfiles. The error log tells me that an "AntSecurityException" is the cause. The javadoc for org.eclipse.ant.core.AntSecurityException tells me that the exception is thrown when an ant task wants to stop the jvm. But just opening an ant build should not start any targets or tasks. The only solution is to restart eclipse.
Does someone know how to stop this rather irritating behavior of eclipse.
Regards, Jan
I have never come across this exception myself. Just out of interest what version of Eclipse are you using?
I did find a solution on the web regarding this though and it is in the folding option of the Ant editor. Try disabling the folding option for Ant editor by going:
Windows -> Preferences -> Ant -> Editor -> Folding tab. Uncheck 'Enable folding'
For me disabling Folding did not solve the problem. I dig deeper and found Bug 143416 in Eclipse.
I could get rid of this by removing the xercesImpl.jar and xml-api.jar from the Ant installation that I used, not sure if you are facing the exact same problem or if there are multiple things that cause the exception to appear. It seems the version of xerces/xml-apis in my Ant (v. 1.7.1) interferes with the classes in Eclipse/JDK itself.
Windows -> Preferences -> Ant -> Show error dialog when ant fails
I have this problem very often.
Now I saw a setting Window-> Preferences-> Ant-> Editor-> Problems-> Security Problems.
I set it to Ignore and 'll see if it helps. :-)
Close eclipse , go to workspace, delete the .metadata, start the eclipse,
only one drawback you have to do all the manual setting again

Categories

Resources