Eclipse proposals missing methods - java

I have recently installed the latest version of Java, JDK 17, and the latest version of Eclipse, 2021-09. I had to do a fresh start because my previous version was bugging out, and unfortunately this one is too. The autofill/proposals is not working correctly.
For example, let's say I have a JFrame called f. I have already initialized it and I am setting it up. Originally, if I wanted to call "f.setSize()", I could just type in "f.set" and a list would pop up with that method on it. This method, among many others, no longer shows up. "setLocationRelativeTo," "setVisibleTo," "setSize," "setTitle," and some more no longer show up.
I also discovered that if I try to implement KeyListener in a class, I cannot use the shortcut ctrl + shift + o to auto-import KeyListener. Instead, Eclipse says that that interface doesn't exist and suggests to change it to MenuKeyListener.
I have looked at similar questions and videos and everyone says that it has to do with the proposals in the editor. I have checked and unchecked all of them, testing each one. No mixture of ons and offs fixes my problem.
This is a fresh version of Eclipse with no addons, plugins, or mods. I also have only made one project in the new version and have not imported any old ones, mostly because they all got accidentally deleted. I don't know why this is happening, but I can't make any more projects without having to look up the spelling and inputs for each method.
Any help would be appreciated.

Try Preferences-->Java-->Appearance-->Type Filters and disable all

Related

Scrolling through Netbeans code assistance list without mouse or keyboard arrows

This is basically the same question as this except for Netbeans 8.0.2 (running under jMonkeyEngine SDK 3.1-alpha1) instead of Visual Studio.
Honestly, the aforemetnioned link says it better than I can, but basically I'm a vim key binding user, and have the netbeans jVi plugin installed and want to map, for example, alt-j and alt-k to scroll through the code completion list instead of the arrow keys:
I've searched through Tools->Options->Keymap, as well as the the JVi configs at Tools->Options->jViConfig. I don't see anything at all under jViConfig, so I think the standard NetBeans key bindings are the way to go.
I have tried modifying most of the obvious down keys e.g insertion point down, scroll down, page down etc, but they all affect the underlying text in the editor, never the completion list.
And:
Does anyone know of a way to do this?
Or maybe a plugin to provide the functionality?
It simply appears that the raw arrow key movements are not mappable by netbeans (?).
Note: this is possible to do in Visual Studio 2015, so I'm hoping it's possible in NetBeans as well.
Many Thanks.
AFAIK, there is no way to do this in NetBeans. At least there wasn't in 2010, when I filed the NetBeans bug hint completion makes assumptions about associated editor pane bindings. I maintain jVi. I filed the bug since I was having trouble with completion bindings for some special keys. In the NB source take a look at
editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java
And you'll see a bunch of hardcoded stuff.
In the jVi source
nbvi/nbvi-module/src/org/netbeans/modules/jvi/KeyBindings.java
method fixupKeypadKeys, you see what jVi does (given the fix for the bug I filed). This is part of some arcane code that depends on being friend with some NB editor package.
You could file a bug with NB. If you provided NB a patch, they might incorporate it. If you file a NB bug, cc me (err at netbeans.org)
Alternately, you could try adding some code to the jVi file to add your keybindings.

IntelliJ find usage no longer prompting to search for base method instead

I have used IntelliJ for many projects and recently, when I try to find usages of an overridden method by pressing ALT+F7, it usually brings up a prompt asking if I want to search for the base method instead.
It is no longer doing that.
Is there an option to re-enable that back? I don't remember if there were any recent plugins or updates installed that disabled this.
I found the problem. There was a plugin called Gauge that was installed and a month ago, they released a version that "enhanced find usages functionality". I disabled that plugin, restarted IntelliJ and I have my find usages back to normal! I don't remember installing this plugin and I don't think I need it or use it. It is possibly a plugin that came with IntelliJ. Nevertheless, that was the cause of the issue.
Using Ctrl+Shift+Alt+F7 should show the prompt.
See: https://www.jetbrains.com/help/idea/find-usages-method-options.html
When you search for usages of a method implementation with this dialog Ctrl+Shift+Alt+F7, IntelliJ IDEA will ask whether or not you want to search for the base method. With any other find usages actions such as Alt+F7 or Ctrl+Alt+F7, the base method will be included in the search results automatically.

Ctrl+Arrow keys, multiword variable names and eclipse pydev

Caveat: I'm not sure if this post might be better suited for SuperUser or some other forum in the SE Family. If you know of a more appropriate place for this post, please let me know, and I will migrate it.
I know that eclipse for Java extends the Ctrl+Left, Ctrl+Right shortcuts to move the cursor within camelCased multiword variable names. This is a feature I really like about eclipse.
However, this feature seems to be absent when I use the PyDev plugin for python programming on eclipse.
Does anyone know how I can get/enable this feature in PyDev (or does it just not exist right now)
Thank you
There is an open feature request for exactly this on PyDev's sourceforge page, see here. I guess this confirms that it "does not exist right now".
The request is originally from 2010 but apparently hasn't received much attention yet. Maybe you can add your voice to the feature request to get it done sooner though.

changing switches to "if-else" statements

I've just recently become interested in programming, and I want to create Android apps for phones or tablets. I've come a long way in a couple weeks from knowing almost nothing about java/xml. I'm very serious about this. I'm going to find the answer to this question one way or the other. In fact, I hope to have it figured out before anyone answers this. I've fixed many issues without resorting to asking anyone, but I've just been stuck on this issue too long. I figured I'd give this a shot.
I'm using an older tutorial to build a practice twitter app (the tutorials for these seem to be everywhere, which is why I chose it). I'm using Eclipse for an editor.
The following is an example of code from the tutorial. which relates to my question:
#Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timeline);
Apparently since the intro of ADT 14, you can no longer use the (R.layout.timeline) phrase, which the error message refers to as a "switch statement."
Now, in a post I found on another site, someone who had a similar issue shows a screenshot of the "quick fix" in Eclipse using ctrl+1. in the screenshot, the fix that pops up says "convert switch to 'if-else' statement." This fix does not pop up in my version of Eclipse. My quick fix options are "migrate Android code", "create field 'timeline' in type 'layout'", "create constant 'timeline' in type 'layout'" or "rename in file."
If I choose "migrate Android code", a window pops up informing me of the ADT 14 update, and how switch statements are no longer allowed in library projects. It says to convert the switch statement to an "if-else" statement by pressing ctrl+1 for the quick fix, then choosing "switch to 'if-else' statement" like it does in the screenshot I found. But again, when I do this, that option does not pop up.
I would much rather know what needs to be changed in the code than know how to make the right quick fix pop up. If it isn't too much trouble, an explanation of why exactly these changes are affective would be very helpful. I have many (MANY) errors in my java files right now, but most of them are due to this exact problem in different forms. If I could see just one before/after example I could probably figure it out from there without an explanation. But after hours of searching, I cannot find that so far by googling.
Thanks so much in advance....
And for the record, I don't see any switch classes in any of my java files, if that makes a difference for the answer...
Make sure you click on the switch keyword itself then press Ctrl + 1.
This confused me at first as well...
If it still doesn't show up, what version of Eclipse are you using?
If you are using a Mac select the keyword switch and click Shift + Command + 1.
That will show a prompt to change switch to if else conditions.
I've been having the same issues. For me, I was switching on view.getId(). Before the switch, declare int id = view.getId();. Then switch in id. Then you can ctrl+1 click and the "Convert Switch to If/Else" should pop up.
They made this change to decrease the build speed. My projects now build in roughly 1/10th of the time. I'm glad I upgraded the ADT.
The issue happens because since ADT 14 resource identifiers are no longer final.
The quick solution you can change switch statements with if-else statements.
With Android Studio 4.1.3
Step:1. Just right click on the switch keyword of statement.
Step:2 Click on the first option Show Context Actions.
Step:3 Click replace switch with if.
Done
To me, it looks like you don't have a timeline resource.
Breaking down R.layout.timeline
R refers to Resources
layout refers to the collection of layouts in your application
and timeline refers the specific resource that you are trying to apply setContentView() too.
If my hunch is correct, you don't have the timeline resource.
Create a new XML file in your layout folder in eclipse and name it 'timeline'
That should resolve the issue.
I hope you got things working.
I agree that this sounds like some weird Eclipse error that is not what it seems, and not what Quick Fix says it is. Eclipse has been known to lie from time to time. Cleaning your project (as #Stephen Dubya said), cutting out the offending code, saving the file, pasting it back in, and saving again...these are some of the non-obvious tricks that sometimes get Eclipse to behave.
In general, I think it would be good for you to get more familiar with some of the Java basics like switch; I think it will make your learning of Android a lot easier. Although the tools and documentation keep improving, Android is still young and not always easy to learn using tutorials, especially when you aren't used to writing code at all or using complicated IDEs like Eclipse.
But I digress. It is only in Android library projects, not regular projects, that Android doesn't treat resources as constants (final variables), since ADT 14. That means means that in library projects, you can't use R.layout.timeline or similar resource variables in your switch statements. You can only switch on whole numbers or enum values.
Using if-else all the time may be your best bet, anyway. switch can, especially for beginners, lead to logic errors in your code, and anything you can write using switch can be rewritten using if-else blocks. Personally, I've stopped using switch in Android and other Java code altogether.
You need to place the curse right before the s in the word switch, and the press cmd 1 . If you switch statements have fall-through clauses, the option to convert won't be available.
Somehow I overworked this error. I have deleted my project from workspace. Reverted it's .project files to old ones commited at SVN. Then at Eclipse uninstalling ADT and install it again. Then import my project. - > Libraries are added the old way and as result all fields at R.java are now final. Hope this helps.

Netbeans IDE problem on MacOSX

I installed Netbeans IDE on Mac OS X few weeks ago. In the code-completion window while writing Java code, I always get the proper full list of possible code completions but in the window that pops-up which is supposed to display JDK documentation entry (all details) for each possible completion, it always say that JDK documentation was not found! It never happened to me when I worked on Windows.
I even downloaded and explicitly added JDK docs library to Netbeans library but to no use. Has anybody faced such problem? Please help! Thanks a lot in advance.
Well since nobody else answered and I had the same issue, but wasn't motivated enough to figure it out, I tracked down the way to do it... look here.
The only changes I did was to use the latest JavaDoc instead of the 1.5 one and to use Java Platforms in step 3 (I am using Netbeans 6.5, I guess the menu structure changed from when he did it).

Categories

Resources