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()
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 =)
source share