在 eclipse RCP 中实现结构比较视图时需要帮助解决问题

发布于 2024-12-17 13:11:36 字数 1128 浏览 1 评论 0原文

我一直致力于通过 Eclipse Compare 基础设施实现基于文本的文件的结构比较和合并功能。

通过这个常见问题解答链接,我已经了解了如何做到这一点的基本想法。 这个更详细指南帮助我更多地了解如何使用StructureCreator实现结构查看器。

所以基本上我扩展了 StructureCreators 扩展点,并使用文本文件解析结果中的树结构创建了我自己的 StructureCreator。是的,我们文本文件中的特殊语言格式可以解析成树形结构。到目前为止,我可以在整个比较窗口上部的树视图中看到两个文件的正确结构差异。

但是,我的问题是,当我双击树节点时,它不会显示窗口下部两个窗格中的节点的差异。它只是显示任何内容,而不是像以前那样在 eclipse 中比较两个 java 文件。

我认为这个问题与共享文档有关,正如指南所说:

对于基于文本的输入,客户端应该对 StructureCreator 进行子类化 班级。这将允许多个人之间使用共享文档 编辑器打开同一文件。 StructureCreator 的子类 提供语法高亮必须同时实现 getDocumentPartitioner() 和 getDocumentPartitioning90 方法 支持共享文档。

然而,我不知道哪里出了问题。我是否需要扩展更多扩展点(例如 structureMergeViewers)才能使其正常工作,或者只是在 StructureCreator 的子类中添加更多内容以使其正确?

如果我想支持语法高亮,我还需要做什么?上面引用的说明太简单了,难以遵循。

我希望一些具有此类经验的 eclipse 开发专家可以帮助我解决这个问题。谢谢!

I've been working on the implementation of a structure compare and merge function of a text based file through eclipse compare infrastructure.

Through this FAQ link, I've got a basic idea of how to do it. And this more detailed guide helped me to understand more about how to implement the structure viewer using StructureCreator.

So basically I extended the structureCreators extension point and created my own StructureCreator using the tree structure from the parsing result of the text file. Yes, our special language format in the text file can be parsed into a tree structure. And so far I can see the correct structural differences of two files in the tree view in the upper part of the whole comparing window.

However, my problem is that when I double click a tree node, it does not bring up the differences of the nodes in the two panes in the lower part of window. It just displays nothing, not like when comparing two java files in the eclipse.

I think this problem has something to do with the shared document as the guide says:

For text based inputs, clients should subclass the StructureCreator
class. This will enable the use of a shared document between multiple
editors open on the same file. Subclasses of StructureCreator that
provide syntax highlighting must implement both the
getDocumentPartitioner() and getDocumentPartitioning90 methods to
support shared documents.

However, I don't know where went wrong. Do I need to extend more extension points such as structureMergeViewers to make it work or just to add more stuff in the subclass of StructureCreator to make it right?

And If I want to support syntax highlighting, What more things do I need to do? the above quoted instructions are too simple to follow.

I wish some eclipse dev experts with such experience can help me with this. Thanks!

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

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

发布评论

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

评论(1

浅紫色的梦幻 2024-12-24 13:11:37

事实证明,我需要返回一个从 StructureCreator.createStructureComparator(...) 扩展 DocumentRangeNode 的对象。这使得比较窗口的下部能够显示所选节点的差异。

我创建了一篇文章来分享我从 Eclipse 结构查看器创建中获得的经验。

It turns out I need to return an object that extends DocumentRangeNode from StructureCreator.createStructureComparator(...). This enables the lower part of the compare window to display the differences of the selected node.

I have created a post to share my lessons from the eclipse structure viewer creation.

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