Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to change perspective buttons state ?
How to change perspective buttons state ? [message #921641] Mon, 24 September 2012 09:47 Go to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 27
Registered: May 2010
Junior Member
Hi Everybody !

My E4 RCP application implements three perspectives the user can switch by clicking toolbar push buttons built from "Handled Tool Items" in the Application.e4xmi file.

The perspective switch mechanism works fine, but the perspective toolbar button remains unpressed after I click it. How do you force the button state ?

The following code shows how I get the ToolItem reference:
  private void findObjectsById( MApplication application, EModelService service, String ID )
  {
    List< MUIElement > findElements = service.findElements( application, ID, MUIElement.class, null );
    MUIElement muiElement = findElements.get( 0 );
    ToolItem widget = (ToolItem) muiElement.getWidget();
    widget.setSelection( true );
  }


Thanks a lot in advance for your time !

Georges
Re: How to change perspective buttons state ? [message #921650 is a reply to message #921641] Mon, 24 September 2012 09:54 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

Does the widget have the SWT.RADIO flag?
Re: How to change perspective buttons state ? [message #921701 is a reply to message #921650] Mon, 24 September 2012 11:03 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 27
Registered: May 2010
Junior Member
No, the Handled Tool Item type is Push.
Re: How to change perspective buttons state ? [message #921710 is a reply to message #921701] Mon, 24 September 2012 11:12 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

IIRC the perspective buttons group need to have a RADIO flag in order for any of them to be checked at a given time. Try grouping them and putting the radio flag instead of push.
Re: How to change perspective buttons state ? [message #921724 is a reply to message #921710] Mon, 24 September 2012 11:26 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 27
Registered: May 2010
Junior Member
Everything works as expected with the Radio type.

Thanks a lot for your help !
Re: How to change perspective buttons state ? [message #921732 is a reply to message #921724] Mon, 24 September 2012 11:32 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 385
Registered: December 2010
Location: Germany
Senior Member
Out of interest: Did you set the RADIO flag in the e4xmi? If so, how?

Thanks,
Christoph
Re: How to change perspective buttons state ? [message #921787 is a reply to message #921732] Mon, 24 September 2012 12:28 Go to previous message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 27
Registered: May 2010
Junior Member
Hi Christoph,

Yes, I set the Radio flag in the e4xmi file. I use the application model editor, select a Handled Tool Item in the Toolbar section and set its Type to Radio through the Type combo.
Previous Topic:Application error
Next Topic:InjectionException while obtaining IEventBroker from IEclipseContext
Goto Forum:
  


Current Time: Wed Nov 26 11:36:39 GMT 2014

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

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