--- /dev/null
+package org.simantics.modeling.ui.actions;\r
+\r
+import java.util.Collection;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.layer0.SelectionHints;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.utils.ui.ISelectionUtils;\r
+\r
+/**\r
+ * This class exists as a org.eclipse.ui.handler extension point counterpart for\r
+ * AssignSymbolGroup ActionFactory due to lack of multi-selection support in the\r
+ * modeled {@link ActionFactory} contributions.\r
+ * \r
+ * @author Tuukka Lehtonen <tuukka.lehtonen@semantum.fi>\r
+ */\r
+public class AssignSymbolGroupsHandler extends AbstractHandler {\r
+\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ ISelection s = HandlerUtil.getCurrentSelection(event);\r
+ if (!(s instanceof IStructuredSelection))\r
+ return null;\r
+\r
+ Collection<Resource> res = ISelectionUtils.getPossibleKeys(s, SelectionHints.KEY_MAIN, Resource.class);\r
+ if (!res.isEmpty())\r
+ new AssignSymbolGroup().assignGroups(res);\r
+\r
+ return null;\r
+ }\r
+\r
+}\r