[英]Eclipse search opens up Java file that has no syntax highlight or source code link when the project is nested?
Situation::情况::
And so, we have the file here, these 2 files the exactly same file,所以,我们这里有文件,这两个文件是完全相同的文件,
but, when the project is nested inside, Eclipse search opens up the file that has no syntax highlight or source code link (ie: unable to ctrl click on the code).但是,当项目嵌套在里面时,Eclipse 搜索打开没有语法高亮或源代码链接的文件(即:无法按住 ctrl 单击代码)。
(ie: Eclipse opens up the Java file as if the Java file is not on a build path) (即:Eclipse 打开 Java 文件,就好像 Java 文件不在构建路径上一样)
(though, if I search directly on that nested project, instead of on the parent project, then things are fine) (不过,如果我直接在那个嵌套项目上搜索,而不是在父项目上搜索,那么一切都很好)
I have to manually open up the file in the Project Explorer, to get the file with syntax highlight or source code link.我必须在 Project Explorer 中手动打开文件,以获取带有语法高亮显示或源代码链接的文件。
Ask::问::
How can I let Eclipse directly open up the Java file with syntax highlight (when I search on the parent project)如何让 Eclipse直接打开带有语法高亮的 Java 文件(当我在父项目上搜索时)
(so that I dont need to manually search & click all the way through)? (这样我就不需要手动搜索并一直点击)?
You seems to be using Maven and you probably imported your project in Eclipse as Maven project.您似乎正在使用 Maven,并且您可能将 Eclipse 中的项目导入为 Maven 项目。
The problem with Maven and Eclipse is that usually Maven project are split as project aggregator (a pom.xml
with only <module>
) which m2e will import: such aggregator project use a directory hierarchy. Maven 和 Eclipse 的问题是通常 Maven 项目被拆分为项目聚合器(一个
pom.xml
只有<module>
),m2e 将导入:这样的聚合器项目使用目录层次结构。
Eclipse, on the other hand, does not scan files as file system file, but as project related file: that's the main reason for your duplicate.另一方面,Eclipse 不将文件扫描为文件系统文件,而是扫描为项目相关文件:这是重复的主要原因。 The child project being contained in its parent, the same file is shown twice because for Eclipse, these are two distinct path.
子项目包含在其父项目中,同一个文件显示两次,因为对于 Eclipse,这是两个不同的路径。
And since for the parent project, the file is simply a regular file it does not offer anything beside syntax highlighting.因为对于父项目,该文件只是一个普通文件,它除了语法高亮之外不提供任何东西。
You can:你可以:
You could also create a bug or vote for this one which seems related: https://bugs.eclipse.org/bugs/show_bug.cgi?id=533440您还可以创建一个错误或为此似乎相关的投票: https://bugs.eclipse.org/bugs/show_bug.cgi?id=533440
Note that this also affect other screen such as Show Resources (which is the subject of bug 533440).请注意,这也会影响其他屏幕,例如显示资源(这是错误 533440 的主题)。
The workaround I am using::我正在使用的解决方法::
Find the files in the nest projects as I did before, then get the class name, then ctrl shift t
to search that class again.和之前一样在nest projects中找到文件,然后得到class这个名字,然后
ctrl shift t
再次搜索那个class。
Just search in the whole workspace
.只需在整个
workspace
中搜索即可。 And directly open in the file in the child-project (ignore the results from parent-project).并直接在子项目中的文件中打开(忽略父项目的结果)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.