Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » type quick fix
type quick fix [message #220026] Sun, 04 December 2005 02:12 Go to next message
Eclipse UserFriend
Hi,
When I add a new variable, with a type that is unknown yet, I would expect
the quick fix to suggest the import of the appropriate class. Why doesn't it
do so?
Re: type quick fix [message #220070 is a reply to message #220026] Mon, 05 December 2005 16:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse3.rizzoweb.com

Zohar wrote:
> Hi,
> When I add a new variable, with a type that is unknown yet, I would expect
> the quick fix to suggest the import of the appropriate class. Why doesn't it
> do so?

Um, it works for me.What version of Eclipse are you using?

I typed this in:

public class TestClass {

private InputStream stream;

}

When I place the cursor on InputStream and invoke Quick Fix (Ctrl+1) the
first suggestion is "Import InputStream from java.io"

BTW, it is usually quicker to just type part of the class name and
invoke Content Assist (Ctrl+Space) and it will automatically prompt you
for the class to import.


Provide more detail about exactly what you type and do and how it does
not behave as you expect.

Eric
Re: type quick fix [message #220076 is a reply to message #220070] Tue, 06 December 2005 01:53 Go to previous messageGo to next message
Eclipse UserFriend
Let's say you have the following:

public int myMethod() {
URL |
return 1;
}

(the '|' denotes my cursor position)
then "URL" is flagged as an error, and using quick fix has no suggestions.
Only if I go back and use Content Assist it helps, but that's a bit of a
hassle as it interrupts my "flow" of writing the code. I would have liked it
if quick fix would suggest the import and let me on with my writing.


"Eric Rizzo" <eclipse3@rizzoweb.com> wrote in message
news:dn2apo$qea$1@news.eclipse.org...
> Zohar wrote:
>> Hi,
>> When I add a new variable, with a type that is unknown yet, I would
>> expect the quick fix to suggest the import of the appropriate class. Why
>> doesn't it do so?
>
> Um, it works for me.What version of Eclipse are you using?
>
> I typed this in:
>
> public class TestClass {
>
> private InputStream stream;
>
> }
>
> When I place the cursor on InputStream and invoke Quick Fix (Ctrl+1) the
> first suggestion is "Import InputStream from java.io"
>
> BTW, it is usually quicker to just type part of the class name and invoke
> Content Assist (Ctrl+Space) and it will automatically prompt you for the
> class to import.
>
>
> Provide more detail about exactly what you type and do and how it does not
> behave as you expect.
>
> Eric
Re: type quick fix [message #220949 is a reply to message #220076] Tue, 20 December 2005 16:07 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse3.rizzoweb.com

Zohar wrote:
> Let's say you have the following:
>
> public int myMethod() {
> URL |
> return 1;
> }
>
> (the '|' denotes my cursor position)
> then "URL" is flagged as an error, and using quick fix has no suggestions.
> Only if I go back and use Content Assist it helps, but that's a bit of a
> hassle as it interrupts my "flow" of writing the code. I would have liked it
> if quick fix would suggest the import and let me on with my writing.

With exactly that typed in, there is no Quick Fix available. This is
because the line is not parsable enough for Quick Fix to do anything
yet. If you go ahead and type a variable name and semicolon, then Quick
Fix for the URL will suggest the import.

That said, given the state you describe above, all you have to do is hit
back-space or left-arrow and invoke Content Assist (Ctrl+Space) and it
will do the import for you.

It sounds as if you might be thinking of something else when you say
"quick fix" because Quick Fix always requires user action to invoke,
either mouse or keyboard.

HTH,
Eric
Previous Topic:Java formatter in Eclipse 3.1
Next Topic:Interface implementors
Goto Forum:
  


Current Time: Wed Jul 30 19:09:53 EDT 2025

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

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

Back to the top