Back Forum Reply New

Eclipse like dynamic tool bar based on perspective

I would like to implement a dynamic toolbar based on some user perspective.

We're using the jide-springrcp project to create different perspective that would show different views in the page.  Is there a way to dynamically replace the quot;magicquot; toolbar?  I don't want to just disable certain button.  I would like a button to disable altogether when we switch to a different perspective.

Similar to what eclipse does, when you switch to Java perspective, we will see the quot;New packagequot;, quot;New classquot; button.  But when you switch to debug perspective, those button is gone, not just disabled.

Thank you very much in advance.

Hi,

This isn't something I've ever done with the jide based perspectives, but that's not to say it couldn't be done.

Maybe in the perspective display method you could get the toolbar via
Application.instance().getActiveWindow().getToolBa  r() and the make the required commands visible or not?

JonnyOriginally Posted by mchanspringI would like to implement a dynamic toolbar based on some user perspective.

We're using the jide-springrcp project to create different perspective that would show different views in the page.  Is there a way to dynamically replace the quot;magicquot; toolbar?  I don't want to just disable certain button.  I would like a button to disable altogether when we switch to a different perspective.

Similar to what eclipse does, when you switch to Java perspective, we will see the quot;New packagequot;, quot;New classquot; button.  But when you switch to debug perspective, those button is gone, not just disabled.

Thank you very much in advance.
Johnny,

Thanks for your response.  That toolbar is a commandgroup, which can be used to genarate menuBar and toolbar .. etc using createMenuBar(), createToolBar() ... etc.  

How I can get the toolbar instance that are created before?

Is it possible to replace the toolbar completely?  

Thanks again,

Michael

Michael,

I was thinking you could iterate through the various members of the command group underlying the toolbar and make those visible or not. ie keep the same toolbar but just manipulate the members.

Jonny

Jonny,

That's the thing.  I'm not sure whether the commandgroup can still link to the toolbar which was already created in some quot;system levelquot; framework code.  Perhaps, it's good to extend the framework to support not just disabled command, but a disappeared command.

Just an idea.

Regards,

Michael

Michael,

have you tried it? I'd have assumed that obtaining the command group for the toolbar and calling setVisible on the command would work. It certainly works in other situations, as I'm using it ie the extension you mention from supporting disabling to supporting visibility is already there I think.

JonnyOriginally Posted by mchanspringJonny,

That's the thing.  I'm not sure whether the commandgroup can still link to the toolbar which was already created in some quot;system levelquot; framework code.  Perhaps, it's good to extend the framework to support not just disabled command, but a disappeared command.

Just an idea.

Regards,

Michael
¥
Back Forum Reply New