Added static handler without event as input to AssignSymbolGroupsHandler 77/1977/1
authorMiro Richard Eklund <miro.eklund@semantum.fi>
Tue, 31 Jul 2018 10:39:19 +0000 (13:39 +0300)
committerMiro Richard Eklund <miro.eklund@semantum.fi>
Tue, 31 Jul 2018 10:39:19 +0000 (13:39 +0300)
This minor change is needed by sysdyn to be able to add Modules to
symbol groups.

gitlab #69

Change-Id: I7df2c397a299e1a49a7912809fa7773917e6cfe3

bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsHandler.java

index 36b32e756ed4a87c08e313b5cedc351442037e65..59e9d8c0701ab4ebad0a5209bb784ad2dcb01a8f 100644 (file)
@@ -22,6 +22,10 @@ import org.simantics.utils.ui.ISelectionUtils;
  */
 public class AssignSymbolGroupsHandler extends AbstractHandler {
 
+       public static Object handleStatic(Collection<Resource> res) throws ExecutionException {
+               return executeImpl(res);
+       }
+       
        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException {
                ISelection s = HandlerUtil.getCurrentSelection(event);
@@ -29,9 +33,12 @@ public class AssignSymbolGroupsHandler extends AbstractHandler {
                        return null;
 
                Collection<Resource> res = ISelectionUtils.getPossibleKeys(s, SelectionHints.KEY_MAIN, Resource.class);
+               return executeImpl(res);
+       }
+       
+       private static Object executeImpl(Collection<Resource> res) throws ExecutionException {
                if (!res.isEmpty())
                        new AssignSymbolGroup().assignGroups(res);
-
                return null;
        }