Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "FAQ What is a Quick Fix?"

 
m (need thumbnailing!)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Whenever it detects an error, the Java editor highlights the error using
+
Whenever it detects an error, the Java editor highlights the error using a wavy red line under the offending code and a marker in the left editor margin. Moving the mouse over the underlined code or the marker will indicate the error. The marker can be selected with the left mouse to activate the Quick Fix pop-up, indicating actions that can be undertaken to repair the error. Alternatively, pressing Ctrl+1 will activate Quick Fix from the keyboard.
a wavy red line under the offending code and a marker in
+
the left editor margin. Moving the mouse over the underlined code or the marker
+
will indicate the error. The marker can be selected with the left mouse
+
to activate the Quick Fix pop-up, indicating actions that can be undertaken
+
to repair the error. Alternatively, pressing Ctrl+1 will activate Quick Fix  
+
from the keyboard.
+
  
 +
Quick Fixes can be used to make typing much faster. Let&#146;s assume  that you are using Eclipse to rewrite Deep Blue and are writing variation 128839. At some point during editing, you need access to the <tt>Rook</tt> class. You have not yet written  a declaration for <tt>Rook</tt>, so when you use it in your code,  a problem marker will  indicate the nonexistence of the type. The marker is normally a simple red cross to indicate an error. If a Quick Fix is available, a small light bulb is shown on top of the error marker.
  
 +
The JDT can detect syntax errors but is also smart  enough to guess what you could do to correct the problem. As can  be seen in Figure 3.2, the JDT can create the class for us with a single mouse click.
  
Quick Fixes can be used to make typing much faster. Let&#146;s assume
+
[[Image:Quickfix1.jpg|thumb|120px|Test]]
that you are using Eclipse to rewrite Deep Blue and are writing
+
variation 128839. At some point during editing, you
+
need access to the <tt>Rook</tt> class. You have not yet written
+
a declaration for <tt>Rook</tt>, so when you use it in your code,
+
a problem marker will
+
indicate the nonexistence of the type. The marker is normally a simple
+
red cross to indicate an error. If a Quick Fix is available, a small
+
light bulb is shown on top of the error marker.
+
 
+
 
+
 
+
The JDT can detect syntax errors but is also smart
+
enough to guess what you could do to correct the problem. As can
+
be seen in Figure 3.2, the JDT can create the class for us
+
with a single mouse click.
+
 
+
 
+
 
+
&nbsp;&nbsp;&nbsp;&nbsp;<img src=../images/quick-fix1.jpg>
+
 
+
 
+
&nbsp;&nbsp;&nbsp;&nbsp;'''Figure 3.2'''&nbsp;&nbsp;
+
Quick Fix suggestions
+
 
+
 
+
 
+
A major tenet of Extreme Programming is to write test cases first.
+
In other words, use cases are specified first; then the implementation
+
is provided. Quick Fixes help in this process. For instance, we start using
+
our <tt>Rook</tt> class as if it has a <tt>move</tt> method. Of course, the
+
editor will complain and place a marker next to the reference to the
+
nonexistent method. However, the editor also guesses what we want to do
+
with the method (Figure 3.3).
+
 
+
 
+
 
+
&nbsp;&nbsp;&nbsp;&nbsp;<img src=../images/quick-fix2.jpg>
+
 
+
 
+
&nbsp;&nbsp;&nbsp;&nbsp;'''Figure 3.3'''&nbsp;&nbsp;
+
Quick Fix guesses
+
 
+
 
+
 
+
In a similar fashion, Quick Fixes can be used to add fields to classes,
+
add parameters to methods, help with unhandled exceptions,
+
and generate local variable declarations.
+
Quick Fixes are designed to allow you to continue the creative process
+
of designing API while using it, a major component of Extreme Programming.
+
 
+
 
+
 
+
A full list of available Quick Fixes is given at
+
'''Help &gt; Help Contents &gt; Java Development
+
User Guide &gt; Concepts &gt; Quick Fix'''. Updating quick fixes
+
as you type can be computationally intensive, so you can turn this off via
+
'''Window &gt; Preferences &gt; Java &gt; Editor
+
    &gt; Annotations &gt; Analyze annotations while typing'''.
+
  
 +
A major tenet of Extreme Programming is to write test cases first. In other words, use cases are specified first; then the implementation  is provided. Quick Fixes help in this process. For instance, we start using our <tt>Rook</tt> class as if it has a <tt>move</tt> method. Of course, the editor will complain and place a marker next to the reference to the  nonexistent method. However, the editor also guesses what we want to do  with the method (Figure 3.3).
  
 +
[[Image:Quickguess1.jpg|thumb|120px|Test]]
  
 +
In a similar fashion, Quick Fixes can be used to add fields to classes, add parameters to methods, help with unhandled exceptions, and generate local variable declarations.  Quick Fixes are designed to allow you to continue the creative process of designing API while using it, a major component of Extreme Programming.
  
 +
A full list of available Quick Fixes is given at  '''Help &gt; Help Contents &gt; Java Development User Guide &gt; Concepts &gt; Quick Fix'''. Updating quick fixes  as you type can be computationally intensive, so you can turn this off via  '''Window &gt; Preferences &gt; Java &gt; Editor  &gt; Annotations &gt; Analyze annotations while typing'''.
  
 
== See Also: ==
 
== See Also: ==
 +
*[[FAQ How do I implement Quick Fixes for my own language?]]
  
 
+
{{Template:FAQ_Tagline}}
[[FAQ_How_do_I_implement_Quick_Fixes_for_my_own_language%3F]]
+

Latest revision as of 16:26, 17 June 2006

Whenever it detects an error, the Java editor highlights the error using a wavy red line under the offending code and a marker in the left editor margin. Moving the mouse over the underlined code or the marker will indicate the error. The marker can be selected with the left mouse to activate the Quick Fix pop-up, indicating actions that can be undertaken to repair the error. Alternatively, pressing Ctrl+1 will activate Quick Fix from the keyboard.

Quick Fixes can be used to make typing much faster. Let&#146;s assume that you are using Eclipse to rewrite Deep Blue and are writing variation 128839. At some point during editing, you need access to the Rook class. You have not yet written a declaration for Rook, so when you use it in your code, a problem marker will indicate the nonexistence of the type. The marker is normally a simple red cross to indicate an error. If a Quick Fix is available, a small light bulb is shown on top of the error marker.

The JDT can detect syntax errors but is also smart enough to guess what you could do to correct the problem. As can be seen in Figure 3.2, the JDT can create the class for us with a single mouse click.

Test

A major tenet of Extreme Programming is to write test cases first. In other words, use cases are specified first; then the implementation is provided. Quick Fixes help in this process. For instance, we start using our Rook class as if it has a move method. Of course, the editor will complain and place a marker next to the reference to the nonexistent method. However, the editor also guesses what we want to do with the method (Figure 3.3).

Test

In a similar fashion, Quick Fixes can be used to add fields to classes, add parameters to methods, help with unhandled exceptions, and generate local variable declarations. Quick Fixes are designed to allow you to continue the creative process of designing API while using it, a major component of Extreme Programming.

A full list of available Quick Fixes is given at Help > Help Contents > Java Development User Guide > Concepts > Quick Fix. Updating quick fixes as you type can be computationally intensive, so you can turn this off via Window > Preferences > Java > Editor > Annotations > Analyze annotations while typing.

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top