X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Factions%2FAssignSymbolGroupsHandler.java;h=36b32e756ed4a87c08e313b5cedc351442037e65;hp=0a4a5765c079a8684843a99c5cb89ba15caeba63;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsHandler.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsHandler.java index 0a4a5765c..36b32e756 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsHandler.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsHandler.java @@ -1,38 +1,38 @@ -package org.simantics.modeling.ui.actions; - -import java.util.Collection; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.handlers.HandlerUtil; -import org.simantics.db.Resource; -import org.simantics.db.layer0.SelectionHints; -import org.simantics.db.layer0.adapter.ActionFactory; -import org.simantics.utils.ui.ISelectionUtils; - -/** - * This class exists as a org.eclipse.ui.handler extension point counterpart for - * AssignSymbolGroup ActionFactory due to lack of multi-selection support in the - * modeled {@link ActionFactory} contributions. - * - * @author Tuukka Lehtonen - */ -public class AssignSymbolGroupsHandler extends AbstractHandler { - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - ISelection s = HandlerUtil.getCurrentSelection(event); - if (!(s instanceof IStructuredSelection)) - return null; - - Collection res = ISelectionUtils.getPossibleKeys(s, SelectionHints.KEY_MAIN, Resource.class); - if (!res.isEmpty()) - new AssignSymbolGroup().assignGroups(res); - - return null; - } - -} +package org.simantics.modeling.ui.actions; + +import java.util.Collection; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.handlers.HandlerUtil; +import org.simantics.db.Resource; +import org.simantics.db.layer0.SelectionHints; +import org.simantics.db.layer0.adapter.ActionFactory; +import org.simantics.utils.ui.ISelectionUtils; + +/** + * This class exists as a org.eclipse.ui.handler extension point counterpart for + * AssignSymbolGroup ActionFactory due to lack of multi-selection support in the + * modeled {@link ActionFactory} contributions. + * + * @author Tuukka Lehtonen + */ +public class AssignSymbolGroupsHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection s = HandlerUtil.getCurrentSelection(event); + if (!(s instanceof IStructuredSelection)) + return null; + + Collection res = ISelectionUtils.getPossibleKeys(s, SelectionHints.KEY_MAIN, Resource.class); + if (!res.isEmpty()) + new AssignSymbolGroup().assignGroups(res); + + return null; + } + +}