1 /*******************************************************************************
2 * Copyright (c) 2019 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.simulation.ui.handlers.e4;
14 import org.eclipse.e4.ui.model.application.MApplication;
15 import org.eclipse.e4.ui.model.application.ui.menu.MItem;
16 import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
17 import org.eclipse.e4.ui.model.application.ui.menu.MToolItem;
18 import org.eclipse.e4.ui.workbench.modeling.EModelService;
21 * @author Tuukka Lehtonen
26 public static boolean setMenuItemSelected(EModelService modelService, MApplication application, String toolItemId, String menuItemId, boolean selected) {
27 MToolItem toolItem = (MToolItem) modelService.find(toolItemId, application);
28 if (toolItem != null) {
29 MMenu menu = toolItem.getMenu();
31 MItem menuItem = (MItem) modelService.find(menuItemId, menu);
32 if (menuItem != null) {
33 menuItem.setSelected(selected);