Search in sources :

Example 6 with MMenu

use of org.eclipse.e4.ui.model.application.ui.menu.MMenu in project whole by wholeplatform.

the class E4Utils method findMenu.

@SuppressWarnings("unchecked")
public static <T> T findMenu(String elementId, EModelService modelService, MApplication application, Class<T> type) {
    for (MWindow window : modelService.findElements(application, null, MWindow.class, null)) {
        MMenu mainMenu = window.getMainMenu();
        if (mainMenu == null)
            continue;
        MMenuElement menuElement = findMenu(elementId, mainMenu);
        if (menuElement != null)
            return (T) menuElement;
    }
    return null;
}
Also used : MWindow(org.eclipse.e4.ui.model.application.ui.basic.MWindow) MMenu(org.eclipse.e4.ui.model.application.ui.menu.MMenu) MMenuElement(org.eclipse.e4.ui.model.application.ui.menu.MMenuElement)

Aggregations

MMenu (org.eclipse.e4.ui.model.application.ui.menu.MMenu)6 MMenuElement (org.eclipse.e4.ui.model.application.ui.menu.MMenuElement)3 MTrimmedWindow (org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow)2 Inject (javax.inject.Inject)1 CoreException (org.eclipse.core.runtime.CoreException)1 Execute (org.eclipse.e4.core.di.annotations.Execute)1 Optional (org.eclipse.e4.core.di.annotations.Optional)1 MUIElement (org.eclipse.e4.ui.model.application.ui.MUIElement)1 MPerspective (org.eclipse.e4.ui.model.application.ui.advanced.MPerspective)1 MPerspectiveStack (org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack)1 MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)1 MPartSashContainer (org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer)1 MPartStack (org.eclipse.e4.ui.model.application.ui.basic.MPartStack)1 MTrimBar (org.eclipse.e4.ui.model.application.ui.basic.MTrimBar)1 MWindow (org.eclipse.e4.ui.model.application.ui.basic.MWindow)1 EObject (org.eclipse.emf.ecore.EObject)1 ClasspathPersistenceProvider (org.whole.lang.codebase.ClasspathPersistenceProvider)1