繁体   English   中英

在Eclipse RCP应用程序中添加工具栏

[英]Add Toolbar in eclipse rcp application

我想在eclipse rcp应用程序中添加工具栏,我试图在ActionBarAdvisor.java中的fillCoolBar函数中编写代码,也使用扩展名。 但是其他插件提供的扩展未正确对齐。 我的猜测是工具栏内各种工具栏的名称不正确。 任何人都可以告诉我如何添加所有图标,以便正确对齐由其他插件添加和由我添加的额外图标? 每次我重新启动或打开一个新的工作区时,图标间距都会改变! 我已附上问题的图片。

Eclipse应用中的Coolbar问题

fillCoolBar中的代码如下:

@Override
protected void fillCoolBar(ICoolBarManager coolBar){
        IToolBarManager fileToolbar1 = new ToolBarManager(SWT.WRAP);
        fileToolbar1.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
        fileToolbar1.add(newDropDownAction);
        fileToolbar1.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
        fileToolbar1.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
        fileToolbar1.add(saveFileAction);
        fileToolbar1.add(saveAllFilesAction);
        fileToolbar1.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
        fileToolbar1.add(printAction);
        fileToolbar1.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
        coolBar.add(fileToolbar1);
}

弄清楚了。 需要为其添加CSS样式。 请执行以下步骤:

1. Open plugin.xml
2. Add extension org.eclipse.e4.ui.css.swt.theme
   2.1 Add Theme to above extension.
      2.1.2 Basestyleurl is relative path to css file, like css/theme.css
      2.1.2 Give a id like plugin.theme [id can be anything]
      2.1.3 Fill rest of the fields
3. In extension org.eclipse.core.runtime.products , the one that has your product
   3.1 Add a property
      3.1.1 name: cssTheme [do not change]
      3.1.2 value: id given in step 2.1.2
   3.2 Add a property
      3.2.1 name: applicationCSSResources
      3.2.2 value: platform:/plugin/plugin.name/images/ 
[inside plugin i have images folder which has all essential images for my css, you can see images used by eclipse css theme in eclipse\plugins\org.eclipse.platform_4.3.0.v20130605-2000\images and the css used is inside css folder ]

就是这样! 完成:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM