Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » MMenuItem.setSelected is not reflected in the GUI(setSelected operation does change the selected state of MMenuItem but this is not reflected in the GUI)
MMenuItem.setSelected is not reflected in the GUI [message #1219049] Sat, 30 November 2013 06:05 Go to next message
Ozgur Cagdas is currently offline Ozgur Cagdas
Messages: 29
Registered: May 2013
Junior Member
Hi,

I use the below snippet to toggle selected states of DirectMenuItems and via debugger I can verify that the fields are modified as expected. However, the changes are not reflected in the GUI and initial selections states are retained as far as the GUI is concerned.

Am I missing anything here?

Another question is, I tried getting the MMenu which holds this MMenuItem injected in the execute method (both @Named and regular injections) but every time I'm getting 'null'. I worked this around by accessing the parent of the MMenuItem but why wouldn't the injection work?

@Execute
public void execute(MMenuItem item) {
	MElementContainer<MUIElement> elementContainer = item.getParent();
	List<MUIElement> uiElements = elementContainer.getChildren();

	for(int i = 0; i < uiElements.size(); i++) {
		MUIElement uiElement = uiElements.get(i);
		if(uiElement instanceof MMenuItem && 
                   ((MMenuItem)uiElement).getType() == ItemType.CHECK) {
			((MMenuItem)uiElement).setSelected(false);
		}
	}

	item.setSelected(true);
}


Regards,

Ozgur.

[Updated on: Mon, 02 December 2013 16:38]

Report message to a moderator

Re: MMenuItem.setSelected is not reflected in the GUI [message #1219856 is a reply to message #1219049] Fri, 06 December 2013 04:59 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

There's probably a listener missing. Please file a bug on Platform/UI and cc me.
Re: MMenuItem.setSelected is not reflected in the GUI [message #1221101 is a reply to message #1219856] Mon, 16 December 2013 17:35 Go to previous message
Ozgur Cagdas is currently offline Ozgur Cagdas
Messages: 29
Registered: May 2013
Junior Member
I've raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=424192 and CC'ed Sopot.
Previous Topic:Is it possible to retrieve MPart's bounds?
Next Topic:Active Perspective Core Expression
Goto Forum:
  


Current Time: Tue Jul 29 14:56:21 EDT 2014

Powered by FUDForum. Page generated in 0.01808 seconds