eclipse - Adding menu to In E4 MWindow -
in our eclipse e4 (pure e4) application have open new window , show views in new window (which different main window). in new window trying add menu (file->import) pro-grammatically. have written below code new window not showing menus. missing?
`
mtrimmedwindow window = mbasicfactory.instance.createtrimmedwindow(); .... mmenu menubar = menufactoryimpl.einstance.createmenu(); menubar.setlabel("test"); window.setmainmenu(menubar); mmenu filemenu = menufactoryimpl.einstance.createmenu(); filemenu.setelementid("file"); filemenu.setlabel("file"); menubar.getchildren().add(filemenu); mmenuitem item1 = menufactoryimpl.einstance.createdirectmenuitem(); item1.setelementid("item1"); item1.setlabel("item1"); filemenu.getchildren().add(item1);`
don't add window application children until after have created , setup main menu (and else want have in window).
when add window application child list rendered immediately. if have not set main menu @ point not shown.
if window design fixed can avoid code designing window in application.e4xmi. turn off 'to rendered' flag not show , do:
mtrimmedwindow window = (mtrimmedwindow)modelservice.find("window id", app); window.settoberendered(true);
to show window.
Comments
Post a Comment