-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.utils.ui.jface;\r
-\r
-import org.eclipse.jface.action.IContributionItem;\r
-import org.eclipse.jface.action.IMenuManager;\r
-import org.eclipse.jface.action.MenuManager;\r
-import org.eclipse.jface.action.SubContributionManager;\r
-\r
-/**\r
- * \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class MenuTools {\r
-\r
- /**\r
- * Searches for existing menu, or creates a new menu.\r
- * @param uniqueID unique id of the contributor (editor's ID + input)\r
- * @param name name of the menu\r
- * @param manager\r
- * @return the menu (created or existing)\r
- */\r
- public static IMenuManager getOrCreate(String uniqueID,String name, IMenuManager manager) {\r
- IContributionItem menu = manager.find(uniqueID+name);\r
- if (menu == null) {\r
- MenuManager m = new MenuManager(name,uniqueID+name);\r
- manager.add(m);\r
- m.setVisible(true);\r
- return m;\r
- }\r
- if (menu instanceof SubContributionManager) {\r
- // without this recreated menus would show only the first item.\r
- SubContributionManager emenu = (SubContributionManager)menu;\r
- return (IMenuManager)emenu.getParent();\r
- }\r
- return (IMenuManager)menu;\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.utils.ui.jface;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.SubContributionManager;
+
+/**
+ *
+ *
+ * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
+ *
+ */
+public class MenuTools {
+
+ /**
+ * Searches for existing menu, or creates a new menu.
+ * @param uniqueID unique id of the contributor (editor's ID + input)
+ * @param name name of the menu
+ * @param manager
+ * @return the menu (created or existing)
+ */
+ public static IMenuManager getOrCreate(String uniqueID,String name, IMenuManager manager) {
+ IContributionItem menu = manager.find(uniqueID+name);
+ if (menu == null) {
+ MenuManager m = new MenuManager(name,uniqueID+name);
+ manager.add(m);
+ m.setVisible(true);
+ return m;
+ }
+ if (menu instanceof SubContributionManager) {
+ // without this recreated menus would show only the first item.
+ SubContributionManager emenu = (SubContributionManager)menu;
+ return (IMenuManager)emenu.getParent();
+ }
+ return (IMenuManager)menu;
+ }
+}