2

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?

Michael
  • 3,411
  • 4
  • 25
  • 56

1 Answers1

3

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

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • This worked perfectly on Windows but we have noticed that on Mac all of the views are empty and no errors are output. The only changes I've made are adding the `persistedState` of `Custom Renderer` and `UndetachableStackRenderer` as displayed above. Are there any known issues for this as I haven't found anything so far. – Michael Mar 11 '19 at 10:47
  • I don't use this way of defining a renderer so I don't know. You can always search Eclipse [Bugzilla](https://bugs.eclipse.org/bugs/query.cgi?format=advanced). The renderer factory method does work fine on macOS. – greg-449 Mar 11 '19 at 10:56
  • Is there an alternative way of defining a renderer? This is strange. I'll have a look. – Michael Mar 11 '19 at 11:00