Eclipse Content Helps Not Work In Some Parts Of The Code

I use Eclipse Juno and never experienced any problems with it until its content service stopped working only in some parts of my code. The code below shows what I say:

mWTBatch.setText("Here content assist works"); medCopyBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mWTBatch.setText(mRTBatch.getText()); mWTExp.setText(mRTExp.getText()); mWTName.setText(mRTName.getText()); mWTQuantity.setText(mRTQuantity.getText()); /* Here content assist is not working */ } }); mWTBatch.setText("Here it is working again"); 

This piece of code is only inside one method of my class. The problem is that it works great inside class methods, but inside objects (new ActionListener () {}) it returns "No default suggestions." It has this behavior when I either use "Ctrl + space" or type ".". after the object I want to receive offers. I have already looked for a solution here and searched for it, but could not find a solution. What I already tried:

  • Window->Preferences->Editor->Content Assist->Advanced and check Java Proposals . This did not work. I even tried to test it myself, not using only Restore Defaults . I also tried Java Proposals from another table. Nothing. Finally, I tried to check all fields from Java to them. Nothing worked.
  • Completely deleted the workspace folder, created a new one and imported my project. Since my project is from the SVN repository, I used the project folder in the "trunk" folder, but I did not copy the contents of the folder to the workspace when importing (I need it to be in the repository). Still nothing, he continues with an error.
  • I reproduced the same situation of the above code into another class of another different project, which was also imported into the workspace, but the contents were copied to it. Content helps worked for this.
  • Then I re-imported the project with the source code at the top, but this time copying its contents into the workspace (which means that it no longer relates to the SVN repository). He didn't work .
  • I also checked if ctrl+space tied to setting content in Eclipse settings, and that is normal. I also checked if this has anything to do with the advanced key settings of the Windows 7 language bar. I saw on the Internet what might be the problem, but that was none of my business.
  • I even created a new Java project in the workspace and copied the .java files one by one from the old project, set the entire build path manually and, in the end, it still doesn't work.

For all of the first four cases above, I also cleaned up the projects and closed them and reopened, not forgetting to update them after each action. Can someone tell me how to fix this? I would like to find a solution to this problem so that others may not be like me for 2 days. I think my question is important, because I am collecting here a lot of possible solutions found when searching for the problem and from StackOverflow, and did not solve anything.

+4
source share
2 answers

I came across this question the other day, and when I saw this post, I thought that I would just have to live with it.

However, I found to β€œcrack” it:

 mWTBatch.setText("Here content assist works"); medCopyBtn.addActionListener( //<---------------------- Problem arises because we're inside a function declaration ... new ActionListener() { // <--------------------------------------------- ... yet we're trying to write a function public void actionPerformed(ActionEvent e) { /* Here content assist is not working */ } } ); mWTBatch.setText("Here it is working again"); 

From the perspective of content helpers, this is simply wrong, so we need a little help:

 mWTBatch.setText("Here content assist works"); medCopyBtn.addActionListener( new ActionListener() // <--------------------------------------------- CURLY BRACKET MISSING public void actionPerformed(ActionEvent e) { /* Here content assist IS WORKING */ } } ); mWTBatch.setText("Here it is still working"); 

This will obviously give you an error at compile time, but gives you full access to supporting information for the rest of the function declaration. In addition, it does not matter which curly cattle you delete from within the function declaration, provided that it is an opening curly bracket.

Another point, if you only remove the open curly brace, as I did above, then the eclipse will NOT automatically add to another closing curly brace for most cases (because by the time you enter a new curly brace, the opening vr opening of the close of curly braces will open). You can get around this by also removing the closing curly brace, but then you should remember to return the two curly braces.

I hope this helps the views of 1165 that this question received over the past year =)

+2
source

From the Start menu, search for β€œ Change Display Language .” ' Change keyboard ' See if you have any non-English keyboards in the General section ' ' Installed services . If you have more than just English, then pressing Ctrl + spacebar changes the focus from Eclipse to the language selector on the taskbar. Remove any other keyboard languages ​​from the list if this is your problem.

0
source

Source: https://habr.com/ru/post/1501918/


All Articles