Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » Customization of the MToolItem rendering
Customization of the MToolItem rendering [message #1387835] Wed, 25 June 2014 13:03 Go to next message
Eclipse UserFriend
In my application I need to customize the way the MToolItem with MMenu is rendered. Rather than default SplitMenuButton with ContextMenu, I would like to have something like Button which opens a javafx.stage.Popup with MenuItems rendered in rows (rows ends on separator).
I managed to achieve that by registering custom renderer factory, which simply is a subclass of DefWorkbenchRendererFactory with overridden getToolItemRendererClass() and getToolItemMenuRendererClass() methods. The problem now is that in order to create custom renderers I need to copy much part of the code from DefToolItemRenderer and DefToolItemMenuRenderer in order to customize their behavior. The methods I need to change are private so I can't solve it by extending them.
My question is, if the way I do it is correct or there is some another approach I overlooked?

Thanks,
Jacek
Re: Customization of the MToolItem rendering [message #1387904 is a reply to message #1387835] Wed, 25 June 2014 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

On 25.06.14 19:03, Jacek Bukowski wrote:
> In my application I need to customize the way the MToolItem with MMenu
> is rendered. Rather than default SplitMenuButton with ContextMenu, I
> would like to have something like Button which opens a
> javafx.stage.Popup with MenuItems rendered in rows (rows ends on
> separator). I managed to achieve that by registering custom renderer
> factory, which simply is a subclass of DefWorkbenchRendererFactory with
> overridden getToolItemRendererClass() and getToolItemMenuRendererClass()
> methods. The problem now is that in order to create custom renderers I
> need to copy much part of the code from DefToolItemRenderer and
> DefToolItemMenuRenderer in order to customize their behavior. The

If you tell me which methods then I can make them protected - still I'd
like to mention that the renderer themselves are not API we'll publish
so you could be broken anytime.

> methods I need to change are private so I can't solve it by extending them.
> My question is, if the way I do it is correct or there is some another
> approach I overlooked?
>

Yes that's the way to go - in 1.1 I plan to provide a way to contribute
renderers to DefWorkbenchRendererFactory using OSGi-Services, so that
you don't need to subclass it.

Another proposal I have for you would be that you contribute your
renderer to e(fx)clipse so that people can flip between the current
split-button and your way of rendering similar to how they can do that
today for the stack-renderer.

Tom
Re: Customization of the MToolItem rendering [message #1388299 is a reply to message #1387904] Thu, 26 June 2014 04:26 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your answer. Currently my code is rather proof-of-concept then something to share. Next days I will try to clean it up and I will then see clearly what methods could be protected and also share the solution with you to check if that is good to contribute.
Re: Customization of the MToolItem rendering [message #1389129 is a reply to message #1388299] Fri, 27 June 2014 07:33 Go to previous messageGo to next message
Eclipse UserFriend
I am looking at the newest master branch and I can't see any other Stack renderer then DefStackRenderer. Do I miss something?
Re: Customization of the MToolItem rendering [message #1389138 is a reply to message #1389129] Fri, 27 June 2014 07:46 Go to previous messageGo to next message
Eclipse UserFriend
look into the renderer it makes a check which UI-Element should be created!

Tom

On 27.06.14 13:33, Jacek Bukowski wrote:
> I am looking at the newest master branch and I can't see any other Stack
> renderer then DefStackRenderer. Do I miss something?
Re: Customization of the MToolItem rendering [message #1389380 is a reply to message #1389138] Fri, 27 June 2014 14:24 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for pointing me that. I have created some basic implementation. It is still far from perfect but I would like to get your feedback if that goes into a good direction. Please see attached Popup.zip with the files I touched.

The one drawback is that javafx.stage.Popup does not allow any styling (so also does not have any look itself), so my popup is quite ugly.

Any comments appreciated.

  • Attachment: Popup.zip
    (Size: 15.85KB, Downloaded 144 times)
Re: Customization of the MToolItem rendering [message #1391050 is a reply to message #1389380] Mon, 30 June 2014 07:23 Go to previous messageGo to next message
Eclipse UserFriend
As Jacek said, some details still need to be discussed, but it would be very much appreciated if this approach made it into e(fx)clipse. Smile
Re: Customization of the MToolItem rendering [message #1393777 is a reply to message #1391050] Fri, 04 July 2014 04:46 Go to previous messageGo to next message
Eclipse UserFriend
Jacek - please create a bugzilla and attach your code there.

Tom

On 30.06.14 13:23, Uwe San wrote:
> As Jacek said, some details still need to be discussed, but it would be
> very much appreciated if this approach made it into e(fx)clipse. :)
Re: Customization of the MToolItem rendering [message #1393813 is a reply to message #1393777] Fri, 04 July 2014 05:57 Go to previous message
Eclipse UserFriend
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=438908
Previous Topic:Using JavaFX in an Eclipse Plugin: Can't import workbench3
Next Topic:JavaFX Preview
Goto Forum:
  


Current Time: Sun Apr 20 03:54:48 EDT 2025

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

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

Back to the top