This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178501 - Copying & pasting Java code automatically adds missing imports of classes and static fields/methods that are used in the copied code
Summary: Copying & pasting Java code automatically adds missing imports of classes and...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All Other
: P4 normal with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-11 12:00 UTC by tprochazka
Modified: 2015-04-07 19:54 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tprochazka 2009-12-11 12:00:32 UTC
When I for example copy some source from example project to my project, I must handle all missing imports, which can take a lot of time, especially when exist more classes with the same name.

Would be great if Netbeans will copy also meta-data with full classpath information when I press ctrl+c/x and automatically add imports when I press ctrl+v.
Comment 1 bht 2010-06-26 00:38:34 UTC
There is a simple workaround. After pasting the source code, predd [Ctrl+Shift+I] which fixes all your imports.

The advantage of NOT letting NetBeans do it is that I see what additional imports are needed for the pasted code. I want to always see it, and I want to have control over it. Therefore, I would prefer for the requested behaviour to not be implemented, or be optional, configurable.
Comment 2 markiewb 2015-04-07 19:54:05 UTC
(In reply to bht from comment #1)
> There is a simple workaround. After pasting the source code, predd
> [Ctrl+Shift+I] which fixes all your imports.

Workaround exists. Lowering prio to P4