Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How do i define and use my own renderer?
How do i define and use my own renderer? [message #565662] Wed, 09 December 2009 14:28 Go to next message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
Hello,

i'm trying to define my own renderer for the indiviual elements of the workbench model.

I looked into the org.eclipse.e4.ui.workbench.renderers.swt package and played a bit with the existing renderers. Like changing the CTabFolder created in the StackRenderer or including the ribbon toolbar (from Hexapixel) in the WBWRenderer and that worked fine. So i thought to change the renderer i can implement my own by extending the SWTPartRenderer and define this one as default.

But how to i define that my own renderer should be used for a specific workbench model element. I saw that a model element has a Factory- & Widget-feature but i don't know how to use it. The same with the org.eclipse.e4.workbench.rendererfactory extension point.

Is this the right way at all or is there a better solution?

Thanks in advance for your help.

Jens Keller
Re: How do i define and use my own renderer? [message #565899 is a reply to message #565662] Fri, 11 December 2009 09:30 Go to previous message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
I found a way. I'm sure that in future versions of e4 it will be a bit easier to do this
but this feature looks very promising. So first you need the following:

- Eclipse 3.6M3
- e4M2 as target platform

from the cvs (both 20091126-1500):
- org.eclipse.e4.ui.workbench.renderers.swt
- org.eclipse.e4.ui.workbench.swt

Add both plugins to your runtime config.

- org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory
- org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer
- org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine

First you need a renderer.You can define one for every element type in the workbench model.
For this you extend the SWTPartRenderer. You can use a default renderer in
org.eclipse.e4.ui.workbench.renderers.swt as a blueprint (maybe just change the CTabFolder in the StackRenderer).
To define which renderer should be used you must implement a IRendererFactory. Again you can use the default
one in org.eclipse.e4.workbench.ui.renderers.swt as blueprint. To define which IRendererFactory Eclipse should
use you must implement the org.eclipse.e4.workbench.rendererfactory extension point. This ext. point is not
fully implemented yet so you don't get a context menu to help you. After you added the ext.point got to
the xml-view and complete the definition as following (which i only guessed ad the moment):

<extension
id="sample.rendererfactory"
point="org.eclipse.e4.workbench.rendererfactory">
<rendererfactory
id="sample.rendererfactory"
name="SampleRendererFactory"
class="de.sample.renderer.SampleWorkbenchRendererFactory">
</rendererfactory>
</extension>

The last step is to make sure Eclipse uses your IRendererFactory. Go to org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine
(in the cvs plugin) and comment the code in line 186 & 187 (at the moment this code makes sure that no other renderer is used than the default one):

if (!curFactoryId.equals(id))
continue;

Now you should be able to explore the future possibilities of implementing your own renderers and new ways of designing
the UI. For a starting point you can include the swt rippon toolbar which you can find at http://hexapixel.com/projects/ribbon
Previous Topic:Single Sourcing ( RCP + RAP ) - File Upload
Next Topic:XWT + TableViewer + Master/Details
Goto Forum:
  


Current Time: Tue Apr 23 15:05:06 GMT 2024

Powered by FUDForum. Page generated in 0.03258 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top