粘贴代码时如何防止Eclipse自动导入包? [英] How to prevent Eclipse from auto-importing packages when pasting code?

查看:191
本文介绍了粘贴代码时如何防止Eclipse自动导入包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常从现有的代码库复制和粘贴代码。例如,我将代码复制并粘贴到名为 com.myproject的项目包中。实用程序转换为名为 twitter_class.java



的文件,并在其添加的java文件中



import com.pigmal.android.ex.twitter4j.TwitterConstants;



,这会导致错误导入无法解析。当然这也是为甚么,为甚么甚至连尝试导入这个部分的时候,甚至没有选择复制这个部分。



我可以想象这个方便的地方,但是对我而言并不方便,而且经常修复是非常耗时的。



如何在Eclipse中使用Eclipse来关闭它。

解决方案

在粘贴时关闭自动导入



windows > 偏好> java 编辑器 键入 (粘贴时)取消选中更新导入


Frequently I copy and paste code from my existing code base. Eclipse frequently brings in erroneous import statements that I don't need

example, I copy and paste code into my project package named com.myproject.utilities into a file named twitter_class.java

and in the java file it adds

import com.pigmal.android.ex.twitter4j.TwitterConstants;

and this causes an error The import cannot be resolved. Of course it can't why, why did it even attempt to import that part when I didn't even select that for copying

I can imagine places where this is convenient, but it is never convenient for me and it is time consuming to repair so often.

How do I turn this off, in Eclipse, using Eclipse.

解决方案

To turnoff the auto import while pasting

windows > preference > java > editor > Typing > (Under when pasting) uncheck update imports

这篇关于粘贴代码时如何防止Eclipse自动导入包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆