Not seeing superclasses in Eclipse new java class wizard - java

I'm trying to learn some Android and java programming in Eclipse. I can run sample projects and tutorials fine, but when I try to create a new java class with File->New->Class and press the Browse button to look for superclasses to use, nothing shows up in the "Matching items:" area, even when I delete the "java.lang.Object" default type. I should be seeing lots of class names there, shouldn't I?
The same lack of results happens when I try to add and interface or an enclosing type. I'm new to Eclipse and java. I suppose that I have some setting messed up? I'm running the most recent Eclipse on Linux:
Version: Indigo Service Release 1
Build id: 20110916-0149

I eventually realized that code completion was not working either. I checked the settings in 'Windows > Preferences > Java > Editor > Content Assist > Advanced' and they seemed OK. I then re-ran with 'eclipse -clean'. After I did that, code completion and the new class wizard are working.
Thanks

You have to type some characters and then it will start looking for classes that start with those characters. Also, check that you don't have any filters set that you don't expect. You will see a tiny upside-down triangle on the upper right, click on that and go to the filters dialog.

No. Every public and non final class could be your superclass. Proposing them all would force Eclipse to show thousands of classes, and would not really help you. You're supposed to know which class you want to extend. Just type its name, the beginning of its name, or the first letter of each of its words (ATM for AbstractTableModel, for example), and Eclipse will then show you matching classes.

Related

Eclipse proposals missing methods

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

Eclipse: Disable auto completion but keep showing suggestions

After a long period of creating apps with Android Studio I returned to Eclipse to program a pure Java application. Of course, I have noticed large differences in terms of auto completion between IntelliJ IDEA and Eclipse but IntelliJ is no alternative for me because of various reasons.
That is why I started to change the settings in Eclipse, inter alia, for the content assist. I want to have suggestions for variable names too, without having to write a dot first. As you can see in this image, I have changed the auto activation triggers to ._#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ as suggested in another thread on Stack Overflow.
The problem is, if I write short variable names like d it completes them automatically to something different (in this case DEFAULT_CURSOR) when I press the dot key. To avoid this, I have to choose the variable first, before pressing the dot key.
However, having to do it this way is a large waste of time. Is there a possibility to use the suggested variables or methods only when I have pressed the enter key, just like in IntelliJ?
Maybe there is an option to bind the dot key to the closing of the content assist?
No, Eclipse and IntelliJ are different and IntelliJ's level of auto completion is unique to itself. If you are comfortable with it, you should use it and then copy and paste to eclipse for windowbuilder. Also FYI there is a free alternative to windowbuilder for IntelliJ, you can read about it here: WindowBuilder equivalent for IntelliJ?

Intellij Idea resource bundle + annotation in javadoc prompt

I started using Intellij Idea for some time after working for a few years in Eclipse and I'm missing few features in Idea. First one is about resource bundle prompt. When I'm editing java file and I have some string literal in my class when I move my mouse over this string Eclipse is showing a prompt with values that are defined in resources files (for all languages) for this literal string key. Another very similar feature is when I'm move my mouse over a static field imported form other class. In eclipse I can see all annotation for this field so I don't have to enter that other class to see it. In Idea this information is not present. Does similar features exists in Idea or in Idea plugins ?
Hold down the Ctrl key while hovering your mouse over the variable to see the value. The same thing works with resource bundles if there's only a single instance of the key in the bundle, however if you have translations IntelliJ shows "multiple implementations" on hover and requires you to click and pick the one you want to see. There are a few tickets open with JetBrains to fix this usability issue, however they haven't gone anywhere, for example: https://youtrack.jetbrains.com/issue/IDEA-76594

Motodev won't lookup methods - can it be configured to do so?

I am using Motodev, an Eclipse-based development tool for Java ME / Motorola. The problem is when you type a line of code that has a method, such as:
super.
It doesnt give options of what methods it has available?
How do I configure it to do this?
Or I'm guessing the instructions for eclipse would work the same.
#android_king22 MOTODEV Studio should work just like Eclipse does. Pressing '.' or ctrl-space should bring up the list of suggestions. What context are you typing 'super'? Are you able to build your project (i.e. is the SDK path correct)?
Is there a folder inside your SDK called "platforms/android-X/sources"? This is a common workaround to a particularly ugly problem in Eclipse where it takes 20-30 seconds for auto-complete to work. If you do have this folder but no actual source inside, it could be preventing the auto-complete mechanism from working.
You must enable "Java Proposals" and "Java Type Proposals" in Preferences|Java|Editor|Content assist|Advanced
"super" calls a method in the superclass of whatever object you are currently using. If no method is available (or your current class is not a subclass), then it won't show anything. However, if there are methods available, it will automatically show (if you have Intellisense on).

Transitioning from VS2010 to Eclipse IDE for Android/Java dev

I wonder if someone can help me... I've been developing VB.Net for years and C++/VB before that. I've also got some PHP experience. I'm now moving to Java to write an app for my Android mobile. I'm trying to use MOTODev Studio (Which extends eclipse)
I've not developed in Java before so it's a bit of a learning curve anyway. I'm fairly confident I'll be able to work out the important bits but I'm in a new IDE in a new language developing for a new platform.
As I'm new to Java, I was hoping to be able to rely on auto-code generation, intellisense, etc. I'm starting to think this was either very optimistic or I'm using eclipse very poorly.
For example, I know I need to override the OnClickListener() event but am unsure of the exact syntax. In VS, I'd just start typing Override in a class and up would pop intellisense with everything I can override and the appropriate signature, however, in eclipse none of the intellisense options seem to apply when I type public voidor #Override. Is this because I'm doing something wrong/is eclipse intellisense incomplete not very good?
In VS there's a bar at the top of the code page which lists objects in the file on the left and methods of the current object on the right. Does eclipse have an equivalent? If so, where?
I've managed to use the IDE to the extent that I've got a "Hello World" installed on my mob so it's more code generation techniques than windows/dialogues/etc.
I suppose what I really need is for someone to recommend some good resources to help me transition. I'd also appreciate any comments or advice from others that have done similar
Thanks in advance
So you learning three items at once
Language (Java)
Platform (Android)
Tool (Eclipse)
Here are my two cents for each of them:
Java - besides annotations guide already mentioned by Falmarri all java tutorials on oracle site are worth seeing you can find them here
Android - From my point of view very good entering points into android development are Android Developer Dev guide and API Demos project which demonstrates many android aspects ( You can add this project into your workspace in Eclipse via ->New Android Project-> Select from sample ->Choose target version -> Click OK , Voila you have new project in your workspace with a lot of useful android related code, describing many advanced and not so advanced topics). BTW Android developers blog is worth reading but
it usually covers more advanced topics
Eclipse - Falmarri already pointed and pretty good tutorial about Eclipse, I from my side would suggest to start from Help-> Help Contents -> Java Development User Guide
It covers all basic tasks and concepts. For your particular problem with overriding ( actually implementing) an interface method you've to first indicate that your class implements View.OnClickListener via class MyClass implements OnClickListener at this point eclipse will notice that you claiming to implement interface but didn't actually implemented some of it methods ( in this situation onClick(View v)) and will mark class declaration with error marker. Go to your class declaration and press Ctrl + 1 ( also known as "quick fix") and you will get some options to fix broken code. At the other hand if you really want to override parent class method you can press Ctrl + Space in a class body ( e.g not inside the method) and you will get option to override avalible methods.
Hope it helps
http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html
yes, it's the default java perspective. Have you even installed the IDE yet?
http://www.vogella.de/articles/Eclipse/article.html
I'm not entirely sure I fully understand your questions, but if I'm in a Java class in Eclipse that implements some Interface and I want to implement methods I either select the quick fix (Ctrl+1) for the compiler error telling me I'm not implementing the Interface or I trigger content assist (Ctrl+Space) in the class body to get a list of methods to override. And with the bar you mention, do you mean something like the breadcrumb navigation (Alt+Shift+B)?

Categories

Resources