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 #502716] 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 #503172 is a reply to message #502716] Fri, 11 December 2009 09:30 Go to previous messageGo to next 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.
Re: How do i define and use my own renderer? [message #505894 is a reply to message #503172] Tue, 05 January 2010 14:12 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
I have created a bug and make some modification to change the default value
of curFactoryId for subclasses:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=298848

Best regards
Yves YANG
"Jens Keller" <mai00bfi@googlemail.com> wrote in message
news:hft3f9$k0h$1@build.eclipse.org...
>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
Re: How do i define and use my own renderer? [message #506168 is a reply to message #505894] Wed, 06 January 2010 12:44 Go to previous messageGo to next message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
Thanks for your help.

Jens Keller
Re: How do i define and use my own renderer? [message #506174 is a reply to message #506168] Wed, 06 January 2010 12:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
BTW there are (not up-to-date) renderer implementations available from
my personal repository [1].

Tom

[1] https://svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/

Am 06.01.10 13:44, schrieb Jens Keller:
> Thanks for your help.
>
> Jens Keller
Re: How do i define and use my own renderer? [message #506398 is a reply to message #506174] Thu, 07 January 2010 11:51 Go to previous messageGo to next message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
Thanks for your example-renderers. I also used the nice swt-ribbon by Emil Crumhorn as a basis for my first renderer.

Jens Keller
Re: How do i define and use my own renderer? [message #566985 is a reply to message #503172] Tue, 05 January 2010 14:12 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
I have created a bug and make some modification to change the default value
of curFactoryId for subclasses:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=298848

Best regards
Yves YANG
"Jens Keller" <mai00bfi@googlemail.com> wrote in message
news:hft3f9$k0h$1@build.eclipse.org...
>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
Re: How do i define and use my own renderer? [message #567122 is a reply to message #505894] Wed, 06 January 2010 12:44 Go to previous messageGo to next message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
Thanks for your help.

Jens Keller
Re: How do i define and use my own renderer? [message #567146 is a reply to message #567122] Wed, 06 January 2010 12:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
BTW there are (not up-to-date) renderer implementations available from
my personal repository [1].

Tom

[1] https://svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/

Am 06.01.10 13:44, schrieb Jens Keller:
> Thanks for your help.
>
> Jens Keller
Re: How do i define and use my own renderer? [message #567239 is a reply to message #506174] Thu, 07 January 2010 11:51 Go to previous messageGo to next message
Jens Keller is currently offline Jens KellerFriend
Messages: 50
Registered: December 2009
Location: Leipzig, Germany
Member
Thanks for your example-renderers. I also used the nice swt-ribbon by Emil Crumhorn as a basis for my first renderer.

Jens Keller
Re: How do i define and use my own renderer? [message #842609 is a reply to message #506174] Thu, 12 April 2012 13:04 Go to previous messageGo to next message
ishk gunathilake is currently offline ishk gunathilakeFriend
Messages: 27
Registered: April 2012
Junior Member
hi tom,
could you please provide credentials for your svn repository

thanks
Re: How do i define and use my own renderer? [message #842615 is a reply to message #842609] Thu, 12 April 2012 13:08 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I'm missing the context a bit from your post because you didn't quote
the original post.

Tom

Am 12.04.12 15:05, schrieb ishara gunathilake:
> hi tom,
> could you please provide credentials for your svn repository
>
> thanks
Re: How do i define and use my own renderer? [message #842631 is a reply to message #842615] Thu, 12 April 2012 13:28 Go to previous messageGo to next message
ishk gunathilake is currently offline ishk gunathilakeFriend
Messages: 27
Registered: April 2012
Junior Member
Quote:
BTW there are (not up-to-date) renderer implementations available from
my personal repository [1].

Tom


[1] svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/


this is the original post.I just want credentials for above repository to try out custom renderer.

thanks.
Re: How do i define and use my own renderer? [message #842639 is a reply to message #842615] Thu, 12 April 2012 13:28 Go to previous messageGo to next message
ishk gunathilake is currently offline ishk gunathilakeFriend
Messages: 27
Registered: April 2012
Junior Member
Quote:
> BTW there are (not up-to-date) renderer implementations available from
> my personal repository [1].
>
> Tom


[1] svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/


this is the original post.I just want credentials for above repository to try out custom renderer.

thanks.
Re: How do i define and use my own renderer? [message #842664 is a reply to message #842639] Thu, 12 April 2012 13:58 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What do you mean with credentials? The repo is available publicly
https://svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/

and the header state that the code is provided under EPL so I really
don't get what you mean.

Please also note that this code is fairly old and you should start with
an implementation from the current codebase and replace stuff.

Tom

Am 12.04.12 15:28, schrieb ishara gunathilake:
> Quote:
>> BTW there are (not up-to-date) renderer implementations available from
>> my personal repository [1].
>>
>> Tom
>
>
> [1] svn.tomsondev.com/svn/ufacekit/desktop/org.ufacekit. ui.e4.renderer/
>
>
> this is the original post.I just want credentials for above repository
> to try out custom renderer.
>
> thanks.
Re: How do i define and use my own renderer? [message #847937 is a reply to message #842664] Tue, 17 April 2012 20:04 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

My Eclipse 4 Renderer tutorial might also help.
Re: How do i define and use my own renderer? [message #1298843 is a reply to message #847937] Wed, 16 April 2014 14:46 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 5
Registered: November 2010
Junior Member
Hi Lars,

I tried to follow your tutorial for registering my own renderer, but it is not called.

Is the extension point "org.eclipse.core.runtime.products" the correct entry point to use just my own StackRender in the eclipse IDE ?

Thanks,
Alain Rapaz
Re: How do i define and use my own renderer? [message #1299952 is a reply to message #1298843] Thu, 17 April 2014 08:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You need to replace the rendererfactory used.

Tom

On 16.04.14 16:46, Missing name Mising name wrote:
> Hi Lars,
>
> I tried to follow your tutorial for registering my own renderer, but it
> is not called.
>
> Is the extension point "org.eclipse.core.runtime.products" the correct
> entry point to use just my own StackRender in the eclipse IDE ?
>
> Thanks,
> Alain Rapaz
Re: How do i define and use my own renderer? [message #1300323 is a reply to message #1299952] Thu, 17 April 2014 13:48 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 5
Registered: November 2010
Junior Member
Thanks Tom,

But what extension point should I use to do that ?
I tried "org.eclipse.e4.workbench.rendererfactory" but it seems not valid anymore...
I use eclipse 4.3.2

Alain Rapaz
Re: How do i define and use my own renderer? [message #1300408 is a reply to message #1300323] Thu, 17 April 2014 14:53 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
There's not extension point for that but in your use the
property-element of the product-extension point

<property name="rendererFactoryUri" value="bundleclass://.....">

Tom

On 17.04.14 15:48, Missing name Mising name wrote:
> Thanks Tom,
>
> But what extension point should I use to do that ?
> I tried "org.eclipse.e4.workbench.rendererfactory" but it seems not
> valid anymore...
> I use eclipse 4.3.2
>
> Alain Rapaz
Re: How do i define and use my own renderer? [message #1300452 is a reply to message #1300408] Thu, 17 April 2014 15:30 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 5
Registered: November 2010
Junior Member
this is what I tried, but my renderer is not used...

<extension
point="org.eclipse.core.runtime.products"
id="wrappedTabs">
<product
application="org.eclipse.e4.ui.workbench.swt.E4Application"
name="wrappedTabs">
<property
name="rendererFactoryUri"
value="bundleclass://WrappedTabs/wrappedTabs.WrappedRendererFactory">
</property>
</product>
</extension>

This is not for an RCP application, I just want to customize the IDE to replace the widget for the editors tabs to show them multiline.

In 3.x of eclipse, I used the "presentation examples" of Lars Vogel (I think) and I would like to implement it on E4.

Alain
Re: How do i define and use my own renderer? [message #1300577 is a reply to message #1300452] Thu, 17 April 2014 17:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
But the IDE is not booted with this product! If you want to customize
the IDE you can use the same key with as a Programm argument:

-os ..... -rendererFactoryUri
bundleclass://WrappedTabs/wrappedTabs.WrappedRendererFactory

Tom

On 17.04.14 17:30, Missing name Mising name wrote:
> this is what I tried, but my renderer is not used...
>
> <extension
> point="org.eclipse.core.runtime.products"
> id="wrappedTabs">
> <product
> application="org.eclipse.e4.ui.workbench.swt.E4Application"
> name="wrappedTabs">
> <property
> name="rendererFactoryUri"
>
> value="bundleclass://WrappedTabs/wrappedTabs.WrappedRendererFactory">
> </property>
> </product>
> </extension>
>
> This is not for an RCP application, I just want to customize the IDE to
> replace the widget for the editors tabs to show them multiline.
>
> In 3.x of eclipse, I used the "presentation examples" of Lars Vogel (I
> think) and I would like to implement it on E4.
>
> Alain
Re: How do i define and use my own renderer? [message #1308637 is a reply to message #1300577] Tue, 22 April 2014 07:13 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 5
Registered: November 2010
Junior Member
Hi Tom,

Thanks, it is working with the switch in the command line to start eclipse.
But, I think it should be implemented as an extension point, to be in the philosophy of plug-in to extend the functionality of eclipse.

Alain
Re: How do i define and use my own renderer? [message #1311431 is a reply to message #1308637] Wed, 23 April 2014 20:09 Go to previous message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member
There's a far simpler way if you're over-riding at a very low level;

There's a key CUSTOM_RENDERER_URI...if you add this to any element's 'persistentData' map with the 'value' being the URI of the renderer you want to use....
Previous Topic:Behavior Differences Between @Active and @Named
Next Topic:TextElement foreground color = background color
Goto Forum:
  


Current Time: Fri Apr 19 11:58:11 GMT 2024

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

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

Back to the top