Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » content assist
content assist [message #260684] Thu, 18 June 2009 08:40 Go to next message
Uwe Appelt is currently offline Uwe AppeltFriend
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 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
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
>
Re: content assist [message #260795 is a reply to message #260750] Thu, 25 June 2009 00:11 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Daniel Megert wrote:

> Uwe Appelt wrote:

....

>> 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.

But completion ranks methods returning String higher than other methods,
so they appear at the top of the list. I guess that's fair.

Stephan
Re: content assist [message #260934 is a reply to message #260684] Thu, 02 July 2009 17:23 Go to previous message
mathew mooty is currently offline mathew mootyFriend
Messages: 15
Registered: July 2009
Junior Member
In response to your first question, I would like to say that while no such
completion proposals exist yet, I am personally working on a plugin that
will extend the content assist feature to better support constructors.
Hopefully soon, you will be able to.
Previous Topic:Re: How to relaunch a single test within Eclipse
Next Topic:Creating modal Dialog box such as the Open Type Dialog Box
Goto Forum:
  


Current Time: Thu Apr 25 11:22:06 GMT 2024

Powered by FUDForum. Page generated in 0.03664 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top