Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317224

Summary: [refactoring] Fix enablement and precondition checking of Extract... refactorings for packages names and annotations
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix
none
Additional fix for failing test none

Description Markus Keller CLA 2010-06-17 13:38:26 EDT
I20100608-0911

While looking at bug 303617, I found that we have a few bugs in enablement and precondition checking of Extract... refactorings with certain selections.

E.g. if you select a package name or an annotation, the refactorings are available in the quick menu and don't even stop in the initial condition checking.

Same problem for Extract Local and Extract Method for selections in an annotation's arguments.
Comment 1 Markus Keller CLA 2010-06-17 13:45:51 EDT
When bug 303617 is fixed, JavaTextSelection#resolveInAnnotation() can be used to hide some refactorings for annotations and annotation arguments.

Test class:

package xy;
import java.util.ArrayList;

@Annotation("all")
//@Annotation({"all", "rawtypes"})
//@Annotation(value= "all")
//@Annotation(value= {"all", "rawtypes"})
public class Try extends ArrayList {
    @Annotation("all" + "a")
    java.util.Vector v= new Bla();
    void m() {
        @Annotation(value= "all" + "a")
	final
        java.util.Vector v= new Bla();
    }
}

@interface Annotation {
    String[] value();
}
Comment 2 Markus Keller CLA 2010-06-18 13:54:20 EDT
Created attachment 172240 [details]
Fix
Comment 3 Markus Keller CLA 2010-06-18 13:55:18 EDT
Fixed in HEAD.
Comment 4 Markus Keller CLA 2010-06-24 08:21:32 EDT
Created attachment 172595 [details]
Additional fix for failing test