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

Bug 263917

Summary: [create on paste] Smart paste should better handle imports
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: markus.kell.r
Version: 3.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Dani Megert CLA 2009-02-06 03:42:09 EST
I2009020203-1200.

If I paste the following source.

import java.util.List;
public class A {
	List l;
}

import java.util.List;
public class B {
	List l;
}

I get:

A.java with:
import java.util.List;
public class A {
	List l;
}
import java.util.List;

and B.java with:
public class B {
	List l;
}

We should be smarter and add imports above a public class to that CU.
Comment 1 Markus Keller CLA 2009-02-06 06:07:43 EST
It works if there's a package declaration before the imports.
No plans to invest more into this.
Comment 2 Dani Megert CLA 2009-02-06 07:41:30 EST
Fair enough, though snippets attached to bugs are often as simple as possible.