简体   繁体   English

Eclipse将文件视为纯文本

[英]Eclipse treating file as plain text

I've got a small homework project, and for whatever reason Eclipse has decided to stop highlighting syntax or allowing intellisense or goto definitions or anything in this Main.java file. 我有一个小的家庭作业项目,无论出于何种原因,Eclipse决定停止突出显示语法或允许intellisense或goto定义或此Main.java文件中的任何内容。 I've tried rebooting it, and the computer, but had no luck. 我试过重新启动它和电脑,但没有运气。

The thing that really has me confused is that it's still compiling and running the code correctly (eg, changes I make in Main.java are compiled and run - it's not running old Main.class files), so it's still in the build path ... right? 让我感到困惑的是它仍在正确编译和运行代码(例如,我在Main.java中进行的更改是编译并运行的 - 它不运行旧的Main.class文件),所以它仍然在构建路径中。 .. 对?

Any ideas? 有任何想法吗?

奇怪的Eclipse情况

Right click on the file in the Package Explorer and choose the Open With menu. 在Package Explorer中右键单击该文件,然后选择Open With菜单。 You will probably find that Text Editor is selected, choose Java Editor to open the file with the correct editor. 您可能会发现选择了Text Editor ,选择Java Editor以使用正确的编辑Java Editor打开文件。

The Open With menu selection is remembered so you should get the Java Editor in future, but equally if you choose the plain text editor that is also remembered. 记住Open With菜单选项,以便将来获得Java编辑器,但同样如果您选择也记住的纯文本编辑器。

I suggest finding a way to reset any setting you might have set by accident. 我建议找一种方法来重置你可能意外设置的任何设置。 Not saying that you did it. 不是说你做到了。 But just to make sure, just try it out. 但只是为了确保,试试吧。 If you customized the preferences already, you could make some kind of note of the settings, then change it. 如果您已经自定义了首选项,则可以对设置进行某种记录,然后进行更改。 If that doesn't work, let me know. 如果这不起作用,请告诉我。 Good Luck! 祝好运!

将文本复制到某处,删除文件,然后添加一个新类(同名)并粘贴文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM