Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前有一个 Eclipse 插件,可以突出显示 Java 类中的实例变量。当单击菜单选项时调用命令处理程序。如何更改它,而不是单击菜单选项,我可以在用户键入时连续标记实例变量?(就像用户键入时会自动标记错误一样?)
您需要扩展org.eclipse.jdt.core.compilationParticipant扩展点并覆盖该reconcile方法。这将在发生协调操作时调用您的代码。它将为您提供一个 AST(可能已经解决了绑定)。
org.eclipse.jdt.core.compilationParticipant
reconcile
有了这个,您应该通过ReconcileContext传入方法的实例向文件添加额外的标记和注释。据推测,您的插件已实现,以便使用标记突出显示实例变量,如果是这样,这将非常适合您的实现。
ReconcileContext