且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Eclipse外观感觉定制

更新时间:2021-09-02 03:11:20

自定义RCP应用程序的一种方法是使用plugin_customization.ini文件.像这样:

One way of customizing an RCP app is by using a plugin_customization.ini file. Like this:

  1. 在项目的根目录中创建一个名为"plugin_customization.ini"的新文件.
  2. 如果尚未执行操作,请创建产品配置并定义产品.
  3. 在插件的清单编辑器中的扩展"选项卡上,找到"org.eclipse.core.runtime.products"扩展,展开节点,右键单击产品节点,然后从上下文菜单.
  4. 在名称"字段中输入"preferenceCustomization",在值"字段中输入"plugin_customization.ini".
  5. 从主菜单中选择文件>保存".

然后,您可以简单地通过编辑plugin_customization.ini文件来自定义很多内容.例如,添加以下行

You can then customize a lot of things simply by editing plugin_customization.ini file. For example, adding the following line

org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false

将为您提供视图和编辑器上的四舍五入选项卡(类似于Eclipse IDE的选项卡),而不是默认选项卡.
您可以在

will give you rounded tabs on your views and editors (similar to those that Eclipse IDE has) instead of the default ones.
You can find other constants that you can use in IWorkbenchPreferenceConstants javadoc.

如果还没有,请查看 Eclipse skins 项目.

Also, check out the Eclipse skins project, if you haven't already.

也有可能使用CSS来更改外观& ,但仍在开发中,可能会出现错误

There is also the possibility to use CSS to change the look & feel of your app, but that is still in development and can be buggy

关于自定义SWT控件本身,唯一的方法(除了小的自定义,例如更改控件的背景色等)是通过

As for customizing the SWT controls themselves, the only way to do that (apart from small customizations such as changing the background colour of a control etc.) is by creating your own custom controls by extending Canvas or Composite, but you already know that.
Keep in mind that the point of SWT is to use native controls, so if you desire the ability to completely customize your controls, perhaps using Swing would be a better option. However, if you're going to use Swing, it may be better to use another RCP entirely - namely, NetBeans RCP. I haven't tried it out yet, but I know that whereas Eclipse RCP uses SWT as a widget toolkit, NetBeans RCP relies on Swing, so that may save you from some headaches regarding compatibility problems and so on.