4

我正在使用 eclipse/windowbuilder pro 编写一个 JFace 独立应用程序。Windowbuilder 是一个很好的工具,但我很难找到有关此类应用程序组织结构的信息。

目前,我正在为我的应用程序的主窗口扩展标准的 ApplicationWindow 类(如 windowbuilder 示例中的标准),并为我的应用程序中的“子窗口”子类化 SWT 组合。我遇到的问题是,当我在 windowbuilder 中以图形方式构建 SWT Composite 子类时,我失去了使用 JFace 操作/数据绑定的能力。当使用 SWT 设计器同时继承标准 SWT 组件时,无法访问用于添加 JFace 操作的调色板。我已经详细搜索了如何添加此调色板无济于事(标准方法失败,因为这不是出现在调色板管理器中的“正常”调色板)。我还尝试将 JFace 操作组件添加到我现有的调色板,但找不到有关如何将抽象类 (Action) 添加到调色板的文档。我知道我可以手动编写我想要的所有代码,但这违背了使用 windowbuilder 的目的。

我真的很想坚持使用标准的 JFace 查看器/动作模型,但我不知道我应该为我的应用程序中的“子窗口”子类化哪些组件。我已经尝试直接对 Window 类进行子类化,但这不会产生对 windowbuilder 的 JFace Actions 调色板的访问权限。我不确定在什么条件下可以访问该调色板(我一直在反复删除和添加组件到 ApplicationWindow,我越来越绝望)。我有一些自定义小部件,如果我能解决这个问题,我很乐意为它们编写 JFace Viewers。

那里有windowbuilder的粉丝吗?子类化 SWT Composite 是一种合理/标准的方式来制作这个应用程序的组件吗?编写比单个 ApplicationWindow 更复杂的应用程序的标准是什么?我搜索了高低,但似乎只能找到作为单个应用程序窗口的教程和示例 - 没有复合。我觉得我遗漏了一些关于更复杂的 JFace 应用程序结构的关键信息。我想我的圣杯将是 SWT Composite 的 JFace 版本,它允许我通过 windowbuilder 访问 JFace 操作代码生成。

任何解释大型应用程序的标准 JFace 设计的提示和/或阅读材料将不胜感激!

4

1 回答 1

0

I've been working with WBPro for about 6 to 7 years now... I think we can have a conversation about your problem. I might not be able to answer your question completely, but I will do my best. So, first off, for your sub-windows you should use JFace Dialogs. You can create a template one from New>Other>WbPro>JFace>Dialog or just subclass it yourself. You can also use TitleAreaDialog which is cooler and has a Title Bar at the top just like all Eclipse Dialogs. These two classes are both within JFace and are available in WBPro.

You have the JFace widgets and viewers available in the Design Tab, but not the actions. But the reason for that is that Dialogs and sub-Windows do not have Toolbars or Menu bars, I think that's why they are not there in the palette, but if you have a Context Menu for one of your inner widgets, I think you should implement that yourself. I can dig a little deeper for you if you want, se tell me if there is still something to address.

于 2013-12-18T09:30:04.037 回答