Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Code Assist Filter
Code Assist Filter [message #221423] Tue, 03 January 2006 09:31 Go to next message
Eclipse UserFriend
Originally posted by: sebastiank.segue.at

Is it possible to filter the result of the code assist where the type is
known?

(1)
eg:
//This inserts automatically "List" if there is no import of any subclass
of List
List myList = new <Ctrl-Space>

Is it possible to get a list of all available implementations of List in
the project even if they are not already imported to the class?


(2)
//This returns a list with all classes starting with "A" although the most
would no compile if inserted
List myList = new A<Ctrl-Space>
Re: Code Assist Filter [message #221434 is a reply to message #221423] Tue, 03 January 2006 21:54 Go to previous messageGo to next message
Eclipse UserFriend
I think it will be more easily to do by quick assist rather than code
completion because the jdt provide an extension(please reference to
extension org.eclipse.jdt.ui.quickAssistProcessors) that let you to
create a quick assist easily. In the processor, you can read the
covering AST model to get the "ITypeBinding" to check weather this
variable can assigned by your specify Type or not.

Sebastian wrote:
> Is it possible to filter the result of the code assist where the type is
> known?
>
> (1)
> eg:
> //This inserts automatically "List" if there is no import of any
> subclass of List
> List myList = new <Ctrl-Space>
>
> Is it possible to get a list of all available implementations of List in
> the project even if they are not already imported to the class?
>
>
> (2)
> //This returns a list with all classes starting with "A" although the
> most would no compile if inserted List myList = new A<Ctrl-Space>
>
>
Re: Code Assist Filter [message #221449 is a reply to message #221423] Wed, 04 January 2006 06:14 Go to previous messageGo to next message
Eclipse UserFriend
Sebastian wrote:
> Is it possible to filter the result of the code assist where the type is
> known?

This is very expensive to compute - you would have to find all types
implementing or extending the type of the left hand side of the
assignment - imagine writing

Object o = new | // find every existing type...

Also, you may want to use an inner type of the type you are completing:

Entry e = new Map| // complete to Map.Entry

Note that starting with M4, code assist will remember the types you have
used before and propose ArrayList when you've previously assigned it to
a List instance.

HTH, tom

>
> (1)
> eg:
> //This inserts automatically "List" if there is no import of any
> subclass of List
> List myList = new <Ctrl-Space>
>
> Is it possible to get a list of all available implementations of List in
> the project even if they are not already imported to the class?
>
>
> (2)
> //This returns a list with all classes starting with "A" although the
> most would no compile if inserted List myList = new A<Ctrl-Space>
>
>
Re: Code Assist Filter [message #221467 is a reply to message #221449] Wed, 04 January 2006 07:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sebastiank.segue.at

I've asked because IntelliJ has this feature and I have to convince my
collegues of using Eclipse instead.
I'll have a go at the enhancements in M4.

Thanks for the answers.
Re: Code Assist Filter [message #221708 is a reply to message #221467] Fri, 06 January 2006 17:23 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse3.rizzoweb.com

Sebastian wrote:
> I've asked because IntelliJ has this feature and I have to convince my
> collegues of using Eclipse instead.
> I'll have a go at the enhancements in M4.
>
> Thanks for the answers.

Honestly, if someone is rejecting a new tool because of a minor thing
like this, then you are not likely to ever convince them. That kind of
attitude reflects a pretty closed mind, like they've already made up
their mind they don't want to try it.
Sad, but true...
Eric
Previous Topic:Problem with Outline / Structure
Next Topic:Question on the JDT's breakpoint entries in the "breakpoint" view
Goto Forum:
  


Current Time: Fri Nov 07 08:40:57 EST 2025

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

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

Back to the top