Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317224 - [refactoring] Fix enablement and precondition checking of Extract... refactorings for packages names and annotations
Summary: [refactoring] Fix enablement and precondition checking of Extract... refactor...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M1   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 13:38 EDT by Markus Keller CLA
Modified: 2010-06-24 08:21 EDT (History)
0 users

See Also:


Attachments
Fix (17.77 KB, patch)
2010-06-18 13:54 EDT, Markus Keller CLA
no flags Details | Diff
Additional fix for failing test (3.40 KB, patch)
2010-06-24 08:21 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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