content assist [message #260684] |
Thu, 18 June 2009 08:40 |
Uwe Appelt Messages: 1 Registered: July 2009 |
Junior Member |
|
|
Hi JDT-guys,
I've been looking around for more detailed information about the eclipse
content assist functionality for java, however i was constantly facing the
standard documentations. Maybe you could be so kind to answer my
questions?!
I currently prepare (myself and) my projects to migrate from jBuilder 2006
to Eclipse and one thing, that really got used to over the past years, was
the "code insight" funtion of jBuilder2006. Obviously the "content assist"
is the eclipse-pendant.
Question 1: (given the following sample code)
List<String> stringList = new [CTRL-SPACE]
the code assistant proposes 'List<String>' as constructor, which is
obviously senseless/incorrect, since List is a pure interface (hence, it
has no contructors). So the actual question is, how do i get the available
constructors listed? I could press 'a' prior to Ctrl-Space and would end
up with e.g. the ArrayList constructors, but is there any chance, to get
simply all (not only those, that start with an 'a') constructors listed?
jBuilder 2006 being able to list *all* constructors, even refers to the
current import statements, such that ArrayList would only be listed, if it
was included before. So this question clearly refers to the new-operator.
Question 2:
given the following declaration/initialization code:
List<String> stringList = new ArrayList<String>();
[code, filling the list]
String myString = stringList.
The code assistant will now show a list of all methods it knows from the
List-interface. However many of the methods in the list-interface wouldn't
work either within such an assignment. So, is it possible to filter out
methods with inappropriate return types?
Best regards
Uwe
|
|
|
Re: content assist [message #260750 is a reply to message #260684] |
Mon, 22 June 2009 12:32 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
Uwe Appelt wrote:
> Hi JDT-guys,
>
> I've been looking around for more detailed information about the
> eclipse content assist functionality for java, however i was
> constantly facing the standard documentations. Maybe you could be so
> kind to answer my questions?!
> I currently prepare (myself and) my projects to migrate from jBuilder
> 2006 to Eclipse and one thing, that really got used to over the past
> years, was the "code insight" funtion of jBuilder2006. Obviously the
> "content assist" is the eclipse-pendant.
>
> Question 1: (given the following sample code)
> List<String> stringList = new [CTRL-SPACE]
> the code assistant proposes 'List<String>' as constructor, which is
> obviously senseless/incorrect, since List is a pure interface (hence,
> it has no contructors). So the actual question is, how do i get the
> available constructors listed? I could press 'a' prior to Ctrl-Space
> and would end up with e.g. the ArrayList constructors, but is there
> any chance, to get simply all (not only those, that start with an 'a')
> constructors listed?
No, this is not possible but if you select ArrayList once, then Eclipse
will remember this and next time it will also propose ArrayList (or any
other implementation you've chosen).
> jBuilder 2006 being able to list *all* constructors, even refers to
> the current import statements, such that ArrayList would only be
> listed, if it was included before. So this question clearly refers to
> the new-operator.
>
> Question 2:
> given the following declaration/initialization code:
> List<String> stringList = new ArrayList<String>();
> [code, filling the list]
> String myString = stringList.
> The code assistant will now show a list of all methods it knows from
> the List-interface. However many of the methods in the list-interface
> wouldn't work either within such an assignment. So, is it possible to
> filter out methods with inappropriate return types?
No. This would work fine for primitive types but for all other methods
it would be possible to call yet another method which would then match
the desired LHS type.
Dani
>
> Best regards
> Uwe
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03664 seconds