Eclipse 插件“操作未启用”

发布于 2024-11-03 07:05:54 字数 410 浏览 4 评论 0原文

我正在努力解决 Java 重构问题 - 我需要编写一个 Eclipse 插件来重构一些代码。这对我来说真的很困难,如果我能一步一步地遵循工作代码,那就容易多了。我能找到的唯一类似的例子是一个示例 引入间接

不幸的是我无法让它真正发挥作用。每当我尝试时,我都会收到“所选操作当前不可用”信息。

我导入了代码“Run As -> Eclipse App”,然后尝试使用 Eclipse Articles 中的 Introduce Ind.。我做错了什么?

如果有任何帮助,我会很高兴:)。

I'm struggling with Java Refactoring - I need to write an Eclipse plug-in which will refactor some code. It's really difficult for me and it would be way easier if I could follow working code step - by - step. The only alike example I could find is a sample Introduce Indirection.

Unfortunately I cannot make it actually work. I get "chosen operation is not currently available" information anytime I try it.

I've imported code, "Run As -> Eclipse App" and than tried to use Introduce Ind. from Eclipse Articles. What am I doing wrong?

I'll be happy with any help :).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

忆离笙 2024-11-10 07:05:54

检查处理程序类中的 isEnabled() 方法。我想当创建新的处理程序时,此方法的默认值返回 false。这可能就是问题所在。

Check your handler class for isEnabled() method. I suppose when creating new handler the default value for this method returns false. That can be the issue.

九厘米的零° 2024-11-10 07:05:54

您应该能够使该示例(按书面形式)运行,或者您可能需要打开一个错误。当您在运行方式中启动他们的示例时,错误日志中是否有任何错误?

您可以尝试的其他方法是查看一些工作台重构。请参阅 org.eclipse.ltk.internal.ui.refactoring.actions.MoveResourcesHandler,它设置移动资源重构,以及 http://wiki.eclipse.org/FAQ_How_do_I_find_a_pspecial_class_from_an_Eclipse_plug-in%3F(如果您需要使用 CTRL+SHIFT+T 跟踪 SDK 类的帮助)

You should be able to get that example (as written) working, or perhaps you need to open a bug. When you start their example in Run As, is there any errors in your error log?

Something else you can try is to look at some of the workbench refactorings. See org.eclipse.ltk.internal.ui.refactoring.actions.MoveResourcesHandler which sets up the move resources refactoring, and http://wiki.eclipse.org/FAQ_How_do_I_find_a_particular_class_from_an_Eclipse_plug-in%3F if you need help tracking down the SDK classes using CTRL+SHIFT+T

晌融 2024-11-10 07:05:54

我已经成功运行它了。对于遇到同样问题的其他人:

检查基础知识:
请记住,您只能选择一种方法并且:
它必须存在于模型中(http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaElement。 html)

它不能有任何错误

不能是构造函数

不能连接到注释声明

并且:在编辑器大纲或包资源管理器中选择一个 Java 方法

这很明显:)

I've managed to run it. For others who'll face the same problem:

Check the basics:
Remember that you can chose only one method and:
It must exist in the model (http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaElement.html)

It must not have any errors

Must not be a constructor

Must not be connected to annotation declaration

And:Select a Java method in the editor outline or the Package Explorer

And it gets obvious :)

心意如水 2024-11-10 07:05:54

操作处理程序类应该是相关接口的障碍(检查错误控制台以识别缺少的接口,很可能是“IActionDelegate”)。

The action handler class should be impediments with related interfaces (Check for error console for identify what are the missing interfaces, most probably this would be 'IActionDelegate').

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文