Adding a custom renderer to different parts

谁说胖子不能爱 提交于 2019-12-24 10:23:53

问题


I would like some parts to use a different renderer. In some cases I would like to remove the Detach option when right clicking and this is a solution according to a comment on my question here.

I've been following this tutorial as to how this can be done.

I've created two classes. UndetachableStackRenderer and UndetachableStackRendererFactory.

If I add UndetachableStackRendererFactory to the plugin.xml it successfully removes the option to detach from ALL part stacks.

<property
    name="rendererFactoryUri"
    value="bundleclass://com.example.loc/com.example.loc.UndetachableStackRendererFactory">
</property>

I would instead like to change the renderer for one part stack. According to the tutorial I can add CUSTOM_RENDERER_URI to the Persisted State of the part stack.

Key:

CUSTOM_RENDERER_URI

Value:

bundleclass://com.example.loc/com.example.loc.UndetachableStackRenderer

I've tried this and it does nothing. If I enter an incorrect location it doesn't come up with any errors either so it seems as though CUSTOM_RENDERER_URI isn't being seen.

What could be the cause of this?


回答1:


The tutorial seems to be wrong, at least for the current Eclipse release.

The key value is defined in IPresentationEngine.CUSTOM_RENDERER_KEY and has the value Custom Renderer

String CUSTOM_RENDERER_KEY = "Custom Renderer";

It is used in the getRenderer method of org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine



来源:https://stackoverflow.com/questions/54572702/adding-a-custom-renderer-to-different-parts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!