将自定义渲染器添加到不同的部分 [英] Adding a custom renderer to different parts

查看:59
本文介绍了将自定义渲染器添加到不同的部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望某些部分使用其他渲染器。在某些情况下,我想在右键单击时删除 Detach 选项,根据对我的问题此处

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.

我创建了两个类。 UndetachableStackRenderer UndetachableStackRendererFactory

I've created two classes. UndetachableStackRenderer and UndetachableStackRendererFactory.

如果我在 plugin.xml 中添加 UndetachableStackRendererFactory 它成功删除了从 ALL 零件堆栈分离的选项。

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>

我想更改一个零件堆栈的渲染器。根据教程,我可以将 CUSTOM_RENDERER_URI 添加到零件堆栈的持久状态中。

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.

键:

CUSTOM_RENDERER_URI

值:

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

我已经尝试过了,但是什么也没做。如果我输入的位置不正确,也不会出现任何错误,因此好像没有看到 CUSTOM_RENDERER_URI

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.

这可能是什么原因?

推荐答案

该教程似乎是错误的,至少对于当前的Eclipse版本而言是错误的。

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

键值是在 IPresentationEngine.CUSTOM_RENDERER_KEY 中定义的,其值是自定义渲染器

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

String CUSTOM_RENDERER_KEY = "Custom Renderer";

getRenderer 方法中使用 org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine

这篇关于将自定义渲染器添加到不同的部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆