Eclipse的声明视图有什么用途? [英] What is Eclipse's Declaration View used for?

查看:67
本文介绍了Eclipse的声明视图有什么用途?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些带有冗余代码的类文件.我一直在寻找Eclipse中的视图,该视图允许您将编辑器限制为仅一种方法,类似于VB6中的模块视图"按钮,对于那些了解我的意思的人来说.这样做的目的是使搜索字符串变得更容易,并且将搜索范围限制为仅在我关注的方法内的代码.(这也是用于编辑大量代码的不错的功能,以确保我不会意外地将代码添加到具有冗余代码的其他大型方法中.)

We have some class files with globs of redundant code. I've been looking for a view in Eclipse which allows you to limit your editor to just a single method, similar to Module View button in VB6, for those of you who know what I mean. The need for this is to make it easier to search for a string and have the search limited to only the code within the method I care about. (It's also a nice feature for editing large globs of code, to make sure I am not accidentally adding the code to a different large method with redundant code.)

我以为声明视图"可以做到这一点,但是该视图既不允许搜索,也不允许编辑.这导致一个分为两部分的问题:

I thought the Declaration View would do this, but this view neither allows search nor editing. This leads to a 2-part question:

a.Eclipse中有没有可以如上所述使用的视图?

a. This there any view in Eclipse that can be used as described above?

b.给定声明视图"的局限性,它有什么用?(我直接找到的唯一链接是声明视图 Hands On Eclipse 没有对我来说没有多大意义.)

b. Given Declaration View's limitations, what is it useful for? (The only link I found directly Declaration View Hands On Eclipse didn't make much sense to me.)

推荐答案

a)转到 Window>偏好设置>Java>编辑器,然后选择<仅显示选定的Java元素.

a) Go to Window > Preferences > Java > Editor and select Show only selected Java element.

我相信这就是您想要的:)这样,您就可以使用 Outline View 来浏览整个班级成员.

I believe that's what you want :) This way you can use the Outline View to navigate throughout the members of the class.

b) Declaration View 只是关于以下内容的快速参考:

b) The Declaration View is just a quick reference about:

  • 如果光标位于一个位置,则声明变量的行.
  • 类型/方法/注释/等"的代码(如果您的光标位于其中之一)

这篇关于Eclipse的声明视图有什么用途?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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