2017-07-19 39 views
0

我想在eclipse 3.x中使用CSS。 CC的文件是通过org.eclipse.e4.ui.css.swt.theme扩展定义,并通过这个代码在ApplicationWorkbenchAdvisor如何在eclipse 3.x RCP中应用CSS样式?

public void initialize(IWorkbenchConfigurer configurer) 
{ 
    super.initialize(configurer); 

    BundleContext context = Activator.getDefault().getBundle().getBundleContext(); 
    ServiceReference serviceRef = context.getServiceReference(IThemeManager.class.getName()); 
    IThemeManager themeManager = (IThemeManager) context.getService(serviceRef); 
    final IThemeEngine engine = themeManager.getEngineForDisplay(Display.getCurrent()); 
    engine.setTheme("com.mycompany.rcp.test.theme", true); 

} 

装载它的工作,但也有像这样的许多“泄气访问”警告:Discouraged access: The type 'IThemeEngine' is not API (restriction on required library 'D:\Workspaces\Indu4.0-Oxygen\.metadata\.plugins\org.eclipse.pde.core\.bundle_pool\plugins\org.eclipse.e4.ui.css.swt.theme_0.11.0.v20170312-2302.jar')

有没有更好的在Eclipse 3.x应用程序中处理主题和样式的方法?

+0

hi @paul。我也尝试在eclipse rcp 3.x中添加主题。你能给任何链接跟随? – krezus

回答

1

许多e4 APIs如IThemeManager仍被标记为'not API',因为它们尚未最终确定。

你必须要忍受灰心访问警告或者你可以用

@SuppressWarnings("restriction") 
你必须把这个在类级别压制了进口警告

抑制警告。

+0

好的谢谢。不知道我是否做得不好 – paul

相关问题