Community
Participate
Working Groups
Build ID: 3.3.2 Steps To Reproduce: I performed a search in bugzilla and was surprised/unable to find an already existing bug report for this common problem. and since this bug is still happening in 3.3.2 but fixed for 3.4 (see minor issue below) Create a java class example Test1.java extending any interface, I chose the javax.swing.Icon interface. notice that it adds a method called paintIcon Now create another java class Test2.java. Do not implement any interface. Go back to Test1.java now from the outline view select the method paintIcon and Ctrl C to copy it Go to Test2.java now in outline view select Test2.java and hit Ctrl V to paste the method Notice the method gets pasted but the required import statements do not get added to the Test2.java file. the required import stmts are import java.awt.Component; import java.awt.Graphics; Note that if one were to copy the entire method from the Editor itself (not outline view) from Test1.java to Test2.java, then the import statements are added. Wondering if this is some kind of intentional behavior. Please dup this bug because I am pretty sure this has been reported somewhere, I just cant find it. Now I have noticed that this is fixed in 3.4 but there is still the minor issue where the Test2.java is saved after the copy even though I expect it to remain dirty after the method is copy-pasted. More information:
The 'import on paste' feature only works on text selections. This has to do with the fact that an AST is required on the source element. For elements in the outline, we would have the AST, but for all other elements normally not. So for consistency, we only support 'import on paste' on text selection. Nothing has changed in this area in 3.4. So maybe you're seeing a different bug. If you have reproducable steps, please file a separate bug against JDT/Text
*** Bug 428197 has been marked as a duplicate of this bug. ***