1 package org.simantics.modeling.ui.actions;
\r
3 import java.util.Collection;
\r
5 import org.eclipse.core.commands.AbstractHandler;
\r
6 import org.eclipse.core.commands.ExecutionEvent;
\r
7 import org.eclipse.core.commands.ExecutionException;
\r
8 import org.eclipse.jface.viewers.ISelection;
\r
9 import org.eclipse.jface.viewers.IStructuredSelection;
\r
10 import org.eclipse.ui.handlers.HandlerUtil;
\r
11 import org.simantics.db.Resource;
\r
12 import org.simantics.db.layer0.SelectionHints;
\r
13 import org.simantics.db.layer0.adapter.ActionFactory;
\r
14 import org.simantics.utils.ui.ISelectionUtils;
\r
17 * This class exists as a org.eclipse.ui.handler extension point counterpart for
\r
18 * AssignSymbolGroup ActionFactory due to lack of multi-selection support in the
\r
19 * modeled {@link ActionFactory} contributions.
\r
21 * @author Tuukka Lehtonen <tuukka.lehtonen@semantum.fi>
\r
23 public class AssignSymbolGroupsHandler extends AbstractHandler {
\r
26 public Object execute(ExecutionEvent event) throws ExecutionException {
\r
27 ISelection s = HandlerUtil.getCurrentSelection(event);
\r
28 if (!(s instanceof IStructuredSelection))
\r
31 Collection<Resource> res = ISelectionUtils.getPossibleKeys(s, SelectionHints.KEY_MAIN, Resource.class);
\r
33 new AssignSymbolGroup().assignGroups(res);
\r