How do I have to configure Eclipse to show me only direct members of a type in an autocomplete proposal?

StackOverflow https://stackoverflow.com/questions/19026344

  •  29-06-2022
  •  | 
  •  

Question

I want to see only direct members - and not derived class members - in the default auto completion popup when I hit Ctrl + Space. What do I need to check / uncheck here to make this work?

Of course I tried a couple of configurations myself, but was not successful.

This is Eclipse Kepler with Android Development Tools 22, by the way.

Était-ce utile?

La solution

You can alter the behavior of content assist by going to Window > Preferences > Java > Editor > Content Assist. The setting 'Hide proposals not visible in the invocation context' will determine which members are 'suggested'.

enter image description here

How this behaves is also determined by the access modifier of the member (private, protected, public).

For example with private members in the super class:

public class Animal {
    private int legs = 0;
    private int arms = 0;
}

The following is available when with content assist (ctrl+space):

enter image description here

Using protected :

public class Animal {
    protected int legs = 0;
    protected int arms = 0;
}

enter image description here

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top