protected void applyTransormMigration(
      SNode origin,
      Computable<SNode> migration,
      _FunctionTypes._void_P2_E0<? super SNode, ? super SNode> postprocess) {
    MigrationScriptBase.SNodePlacePointer pointer = createSNodePlacePointer(origin);
    List<SNode> descendants =
        SNodeOperations.getNodeDescendants(origin, null, true, new SAbstractConcept[] {});

    SNode migrated = migration.compute();

    if (postprocess != null) {
      postprocess.invoke(origin, migrated);
    }

    if (migrated == null) {
      // origin should be removed
      pointer.remove();
    } else {
      if (!(ListSequence.fromList(descendants).contains(migrated))
          && migrated instanceof jetbrains.mps.smodel.SNode) {
        // returned value is new created node
        if (!(ListSequence.fromList(SNodeOperations.getNodeAncestors(origin, null, false))
            .contains(migrated))) {
          // origin is not keeped
          ((jetbrains.mps.smodel.SNode) migrated).setId(origin.getNodeId());
        }
      }
      pointer.insertOrReplace(migrated);
    }
  }
 public static String call_getErasureSignature_2830572026628006618(SNode __thisNode__) {
   StringBuilder sb = new StringBuilder();
   List<SNode> parameters =
       SLinkOperations.getChildren(
           __thisNode__,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8cc56b1fcL,
               0xf8cc56b1feL,
               "parameter"));
   for (int i = 0; i < ListSequence.fromList(parameters).count(); i++) {
     SNode param = ListSequence.fromList(parameters).getElement(i);
     sb.append(
         Type_BehaviorDescriptor.getErasureSignature_idhEwIzNx.invoke(
             SLinkOperations.getTarget(
                 param,
                 MetaAdapterFactory.getContainmentLink(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x450368d90ce15bc3L,
                     0x4ed4d318133c80ceL,
                     "type"))));
     if (i < ListSequence.fromList(parameters).count() - 1) {
       sb.append(",");
     }
   }
   return sb.toString();
 }
  public static List<ModelRootManager> getManagers() {
    final List<ModelRootManager> result = ListSequence.fromList(new ArrayList<ModelRootManager>());
    ModelAccess.instance()
        .runReadAction(
            new Runnable() {
              public void run() {
                for (SNode node : ListSequence.fromList(getManagerNodes())) {
                  Language language =
                      Language.getLanguageFor(SNodeOperations.getModel(node).getModelDescriptor());

                  ModelRootManager manager =
                      new ModelRootManager(
                          SNodeOperations.getModel(node)
                              .getModelDescriptor()
                              .getModule()
                              .getModuleDescriptor()
                              .getId()
                              .toString(),
                          SNodeOperations.getModel(node).getLongName()
                              + "."
                              + NameUtil.toValidIdentifier(
                                  SPropertyOperations.getString(node, "name")));

                  ListSequence.fromList(result).addElement(manager);
                }
              }
            });

    // default
    ListSequence.fromList(result).addElement(null);

    return result;
  }
 @Override
 protected void doFind(
     SNode node, SearchScope scope, List<SNode> _results, ProgressMonitor monitor) {
   monitor.start(getDescription(), 1);
   try {
     for (SNode nodeUsage :
         FindUtils.executeFinder(
             "jetbrains.mps.lang.structure.findUsages.NodeUsages_Finder",
             node,
             scope,
             monitor.subTask(1))) {
       if (SNodeOperations.hasRole(
           nodeUsage,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0xf8c108ca66L,
               0x10f6353296dL,
               "superclass"))) {
         ListSequence.fromList(_results).addElement(SNodeOperations.getParent(nodeUsage));
       } else if (SNodeOperations.isInstanceOf(
           nodeUsage,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x1107e0cb103L,
               "jetbrains.mps.baseLanguage.structure.AnonymousClass"))) {
         ListSequence.fromList(_results).addElement(nodeUsage);
       }
     }
   } finally {
     monitor.done();
   }
 }
Example #5
0
  public static List<SubstituteAction> sideTransform_ActionsFactory_VarDecl_6585869519574765725(
      final IOperationContext operationContext, final SideTransformActionsBuilderContext _context) {
    List<SubstituteAction> result = ListSequence.fromList(new ArrayList<SubstituteAction>());
    ListSequence.fromList(result)
        .addElement(
            new AbstractSideTransformHintSubstituteAction(
                SConceptOperations.findConceptDeclaration(
                    "jetbrains.mps.nanoc.structure.CExpression"),
                _context.getSourceNode()) {
              public SNode doSubstitute(
                  @Nullable final EditorContext editorContext, String pattern) {
                return SNodeFactoryOperations.setNewChild(
                    _context.getSourceNode(),
                    "initializer",
                    "jetbrains.mps.nanoc.structure.CExpression");
              }

              public String getMatchingText(String pattern) {
                return "=";
              }

              public String getVisibleMatchingText(String pattern) {
                return getMatchingText(pattern);
              }
            });
    return result;
  }
 public List<SNode> getMethods() {
   List<SNode> result = new ArrayList<SNode>();
   for (List<SNode> list : MapSequence.fromMap(this.myMethodsByName).values()) {
     ListSequence.fromList(result).addSequence(ListSequence.fromList(list));
   }
   return result;
 }
Example #7
0
  public static SNode virtual_getCreatorExpression_7057666463730727863(
      SNode thisNode, SNode parentRef) {
    SNode result =
        SNodeOperations.copyNode(
            SLinkOperations.getTarget(
                SLinkOperations.getTarget(thisNode, "declaration", false), "creator", true));

    List<SNode> params =
        SLinkOperations.getTargets(
            SLinkOperations.getTarget(thisNode, "declaration", false), "parameter", true);
    List<SNode> args = SLinkOperations.getTargets(thisNode, "argument", true);
    if (ListSequence.fromList(params).count() != ListSequence.fromList(args).count()) {
      throw new RuntimeException();
    }

    for (SNode ref :
        SNodeOperations.getDescendants(
            result,
            "jetbrains.mps.baseLanguage.builders.structure.SimpleBuilderParameterReference",
            false,
            new String[] {})) {
      int index =
          ListSequence.fromList(params).indexOf(SLinkOperations.getTarget(ref, "parameter", false));
      SNodeOperations.replaceWithAnother(
          ref, SNodeOperations.copyNode(ListSequence.fromList(args).getElement(index)));
    }

    return result;
  }
    private boolean canExecute_internal(
        final KeyEvent keyEvent,
        final EditorContext editorContext,
        final SNode node,
        final List<SNode> selectedNodes) {
      if (ListSequence.fromList(selectedNodes).count() != 1) {
        return false;
      }

      // Selected node should be within TypeVariableDeclaration
      SNode selectedNode = ListSequence.fromList(selectedNodes).first();
      SNode typeVarDeclaration =
          SNodeOperations.getAncestor(
              selectedNode,
              "jetbrains.mps.baseLanguage.structure.TypeVariableDeclaration",
              true,
              false);
      if (typeVarDeclaration == null) {
        return false;
      }

      // Next cell should belong to some other SNode, not our typeVarDeclaration
      jetbrains.mps.nodeEditor.cells.EditorCell selectedCell =
          (jetbrains.mps.nodeEditor.cells.EditorCell) editorContext.getSelectedCell();
      jetbrains.mps.nodeEditor.cells.EditorCell nextLeaf = selectedCell.getNextLeaf();
      if (nextLeaf == null) {
        return false;
      }
      SNode nextCellNode = (SNode) nextLeaf.getSNode();
      return nextCellNode != null && nextCellNode != typeVarDeclaration;
    }
Example #9
0
 private SModelDescriptor findModel(SModelReference reference) {
   if (reference.equals(myModel.getSModelReference())) {
     return myModel.getModelDescriptor();
   }
   List<IScope> scopes = ListSequence.fromList(new ArrayList<IScope>());
   IScope ps = myProject.getScope();
   if (ps != null) {
     ListSequence.fromList(scopes).addElement(ps);
   }
   ListSequence.fromList(scopes).addElement(GlobalScope.getInstance());
   for (IScope scope : ListSequence.fromList(scopes)) {
     SModelDescriptor md = scope.getModelDescriptor(reference);
     if (md != null) {
       return md;
     }
   }
   // if we can't find model using full reference, try to find by fq-name
   // this is needed for viewing diff on models saved before MPS 2.0 M5
   for (IScope scope : ListSequence.fromList(scopes)) {
     SModelDescriptor md = scope.getModelDescriptor(reference.getSModelFqName());
     if (md != null) {
       return md;
     }
   }
   return null;
 }
Example #10
0
 private static Iterable<SNodeId> getNodeIdsForNodeGroupChange(
     @NotNull NodeGroupChange ngc,
     @Nullable Tuples._2<SNodeId, List<SNodeId>> lastParentAndNewChildrenIds) {
   List<SNodeId> childrenIds;
   if (lastParentAndNewChildrenIds == null
       || neq_5iuzi5_a0a1a72(lastParentAndNewChildrenIds._0(), ngc.getParentNodeId())) {
     List<? extends SNode> children =
         IterableUtil.asList(
             ngc.getChangeSet()
                 .getNewModel()
                 .getNode(ngc.getParentNodeId())
                 .getChildren(ngc.getRole()));
     childrenIds =
         ListSequence.fromList(children)
             .select(
                 new ISelector<SNode, SNodeId>() {
                   public SNodeId select(SNode n) {
                     return n.getNodeId();
                   }
                 })
             .toListSequence();
   } else {
     childrenIds = lastParentAndNewChildrenIds._1();
   }
   return ListSequence.fromList(childrenIds).page(ngc.getResultBegin(), ngc.getResultEnd());
 }
 @NotNull
 public static List<IModule> getVisibleModules_4040588429969394431(IScope scope) {
   List<IModule> result = ListSequence.fromList(new ArrayList<IModule>());
   ListSequence.fromList(result)
       .addSequence(SetSequence.fromSet(MPSModuleRepository.getInstance().getAllModules()));
   return result;
 }
Example #12
0
 public static List<Option> getConstants() {
   List<Option> list = ListSequence.fromList(new LinkedList<Option>());
   ListSequence.fromList(list).addElement(Option.option_default);
   ListSequence.fromList(list).addElement(Option.option_1);
   ListSequence.fromList(list).addElement(Option.drop_it);
   return list;
 }
 private void registerLanguageKeyMaps(Language language) {
   SModel editorModelDescriptor = LanguageAspect.EDITOR.get(language);
   SModel editorModel = (editorModelDescriptor != null ? editorModelDescriptor.getSModel() : null);
   List<KeyMap> keyMaps;
   if (editorModel != null) {
     keyMaps = ListSequence.fromList(new ArrayList<KeyMap>());
     for (SNode keyMapDeclaration :
         ListSequence.fromList(
             SModelOperations.getRoots(
                 editorModel, "jetbrains.mps.lang.editor.structure.CellKeyMapDeclaration"))) {
       try {
         Class<KeyMap> keyMapClass = findKeyMapClassByDeclaration(keyMapDeclaration);
         if (keyMapClass != null) {
           KeyMap keyMap = keyMapClass.newInstance();
           if (keyMap.isApplicableToEveryModel()) {
             ListSequence.fromList(keyMaps).addElement(keyMap);
           }
         }
       } catch (Throwable t) {
         LOG.error(t);
       }
     }
   } else {
     keyMaps = Collections.emptyList();
   }
   MapSequence.fromMap(myLanguagesToKeyMaps).put(language, keyMaps);
 }
 public void test_SimpleFindAndMoveForIntroduceLocalVarTest() throws Exception {
   this.addNodeById("7568753874916244225");
   this.addNodeById("7568753874916244315");
   IntroduceLocalVariableRefactoring refactoring = new IntroduceLocalVariableRefactoring();
   refactoring.init(
       SNodeOperations.cast(
           this.getNodeById("7568753874916244242"),
           "jetbrains.mps.baseLanguage.structure.StringLiteral"),
       null);
   refactoring.setName("s");
   refactoring.setReplacingAll(true);
   refactoring.doRefactoring();
   {
     List<SNode> nodesBefore =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("7568753874916244226"),
                 "jetbrains.mps.baseLanguage.structure.ClassConcept"));
     List<SNode> nodesAfter =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("7568753874916244316"),
                 "jetbrains.mps.baseLanguage.structure.ClassConcept"));
     Assert.assertNull(
         "nodes '" + nodesBefore + "' and '" + nodesAfter + "' do not match!",
         NodesMatcher.matchNodes(nodesBefore, nodesAfter));
   }
 }
Example #15
0
 public static List<SubstituteAction>
     nodeSubstituteActionsBuilder_ActionsFactory_SNodeOperation_1201875763403(
         final IOperationContext operationContext,
         final NodeSubstituteActionsFactoryContext _context) {
   List<SubstituteAction> result = ListSequence.fromList(new ArrayList<SubstituteAction>());
   ListSequence.fromList(result)
       .addSequence(
           ListSequence.fromList(
               ChildSubstituteActionsHelper.createDefaultSubstituteActions(
                   SConceptOperations.findConceptDeclaration(
                       "jetbrains.mps.lang.typesystem.structure.Node_TypeOperation"),
                   _context.getParentNode(),
                   _context.getCurrentTargetNode(),
                   _context.getChildSetter(),
                   operationContext)));
   ListSequence.fromList(result)
       .addSequence(
           ListSequence.fromList(
               ChildSubstituteActionsHelper.createDefaultSubstituteActions(
                   SConceptOperations.findConceptDeclaration(
                       "jetbrains.mps.lang.typesystem.structure.Node_InferTypeOperation"),
                   _context.getParentNode(),
                   _context.getCurrentTargetNode(),
                   _context.getChildSetter(),
                   operationContext)));
   return result;
 }
 public List<String> getPostfixes(
     SNode node, IOperationContext operationContext, EditorContext editorContext) {
   List<String> result;
   SNode nodeType = ActionParameter__BehaviorDescriptor.getType_id112RIkggjzD.invoke(node);
   if (nodeType != null) {
     result = Type__BehaviorDescriptor.getVariableSuffixes_idhEwIzNo.invoke(nodeType);
   } else {
     result = ListSequence.fromList(new ArrayList<String>());
   }
   // we need this because of smart input
   // DO NOT REMOVE IT
   if (SPropertyOperations.getString(
           node,
           MetaAdapterFactory.getProperty(
               0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"))
       != null) {
     ListSequence.fromList(result)
         .addElement(
             SPropertyOperations.getString(
                 node,
                 MetaAdapterFactory.getProperty(
                     0xceab519525ea4f22L,
                     0x9b92103b95ca8c0cL,
                     0x110396eaaa4L,
                     0x110396ec041L,
                     "name")));
   }
   return result;
 }
 @Override
 @NotNull
 protected List<MenuPart<TransformationMenuItem, TransformationMenuContext>> getParts(
     TransformationMenuContext _context) {
   List<MenuPart<TransformationMenuItem, TransformationMenuContext>> result =
       new ArrayList<MenuPart<TransformationMenuItem, TransformationMenuContext>>();
   if (ListSequence.fromListAndArray(
           new ArrayList<String>(),
           MenuLocations.LEFT_SIDE_TRANSFORM,
           MenuLocations.RIGHT_SIDE_TRANSFORM)
       .contains(_context.getMenuLocation())) {
     result.add(
         new DefaultConceptMenusTransformationMenuPart(
             SModelUtil.getDirectSuperConcepts(
                 MetaAdapterFactory.getConcept(
                     0xf3347d8a0e794f35L,
                     0x8ac91574f25c986fL,
                     0xbe3a0d5ba1a2c12L,
                     "jetbrains.mps.execution.commands.structure.ProcessType"))));
   }
   if (ListSequence.fromListAndArray(new ArrayList<String>(), MenuLocations.RIGHT_SIDE_TRANSFORM)
       .contains(_context.getMenuLocation())) {
     result.add(
         new ConstraintsFilteringTransformationMenuPartDecorator(
             new ProcessType_TransformationMenu.TransformationMenuPart_Action_fvqin_a1(),
             MetaAdapterFactory.getConcept(
                 0xf3347d8a0e794f35L,
                 0x8ac91574f25c986fL,
                 0x87f99370d7e1ea3L,
                 "jetbrains.mps.execution.commands.structure.CommandProcessType")));
   }
   return result;
 }
Example #18
0
 public void test_RemoveParameter() throws Exception {
   this.addNodeById("1230052944082");
   this.addNodeById("1230052944093");
   ChangeMethodSignatureParameters params =
       new ChangeMethodSignatureParameters(
           SNodeOperations.cast(
               this.getNodeById("1230052944084"),
               "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration"));
   ListSequence.fromList(SLinkOperations.getTargets(params.getDeclaration(), "parameter", true))
       .clear();
   ChangeMethodSignatureRefactoring ref =
       new ChangeMethodSignatureRefactoring(
           params,
           SNodeOperations.cast(
               this.getNodeById("1230052944084"),
               "jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration"));
   ref.doRefactoring();
   {
     List<SNode> nodesBefore =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("1230052944083"),
                 "jetbrains.mps.baseLanguage.structure.ClassConcept"));
     List<SNode> nodesAfter =
         ListSequence.fromListAndArray(
             new ArrayList<SNode>(),
             SNodeOperations.cast(
                 this.getNodeById("1230052944094"),
                 "jetbrains.mps.baseLanguage.structure.ClassConcept"));
     Assert.assertNull(
         "nodes '" + nodesBefore + "' and '" + nodesAfter + "' do not match!",
         NodesMatcher.matchNodes(nodesBefore, nodesAfter));
   }
 }
Example #19
0
 public Iterable<SNode> getAvailableElements(@Nullable String prefix) {
   List<SNode> result = new ArrayList<SNode>();
   ListSequence.fromList(result)
       .addSequence(
           Sequence.fromIterable(scope.getAvailableElements(prefix))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return it.isInstanceOfConcept(kindConceptFqName);
                     }
                   }));
   ListSequence.fromList(result)
       .addSequence(
           Sequence.fromIterable(parentScope.getAvailableElements(prefix))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return it.isInstanceOfConcept(kindConceptFqName);
                     }
                   })
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return !(it.isInstanceOfConcept(hidingRootConceptFqName))
                           || !(SetSequence.fromSet(names).contains(it.getName()));
                     }
                   }));
   return result;
 }
 /*package*/ static List<SConcept> getParameterConcepts_id2xELmDxyi2v(
     @NotNull SNode __thisNode__) {
   List<SConcept> result =
       ConceptFunction__BehaviorDescriptor.getParameterConcepts_id2xELmDxyi2v.invokeSpecial(
           __thisNode__);
   ListSequence.fromList(result)
       .addElement(
           MetaAdapterFactory.getConcept(
               0x13744753c81f424aL,
               0x9c1bcf8943bf4e86L,
               0x10e761b3745L,
               "jetbrains.mps.lang.sharedConcepts.structure.ConceptFunctionParameter_model"));
   ListSequence.fromList(result)
       .addElement(
           MetaAdapterFactory.getConcept(
               0x13744753c81f424aL,
               0x9c1bcf8943bf4e86L,
               0x10e761c927aL,
               "jetbrains.mps.lang.sharedConcepts.structure.ConceptFunctionParameter_operationContext"));
   ListSequence.fromList(result)
       .addElement(
           MetaAdapterFactory.getConcept(
               0xaee9cad2acd44608L,
               0xaef20004f6a1cdbdL,
               0x112284c7b8bL,
               "jetbrains.mps.lang.actions.structure.ConceptFunctionParameter_sourceNode"));
   return result;
 }
 public static List<PeriodSeparatorKind> getConstants() {
   List<PeriodSeparatorKind> list = ListSequence.fromList(new LinkedList<PeriodSeparatorKind>());
   ListSequence.fromList(list).addElement(PeriodSeparatorKind.DEFAULT);
   ListSequence.fromList(list).addElement(PeriodSeparatorKind.IFBEFORE);
   ListSequence.fromList(list).addElement(PeriodSeparatorKind.IFAFTER);
   return list;
 }
 /*package*/ static List<SNode> getApplicableConceptFunctionParameter_id2D1PBM_bxJg(
     @NotNull SAbstractConcept __thisConcept__) {
   List<SNode> result =
       ConceptFunction__BehaviorDescriptor.getApplicableConceptFunctionParameter_id2D1PBM_bxJg
           .invokeSpecial(__thisConcept__);
   ListSequence.fromList(result)
       .addElement(
           SNodeOperations.getNode(
               "r:00000000-0000-4000-0000-011c895902a8(jetbrains.mps.lang.actions.structure)",
               "5584396657084912703"));
   ListSequence.fromList(result)
       .addElement(
           SNodeOperations.getNode(
               "r:00000000-0000-4000-0000-011c895902a8(jetbrains.mps.lang.actions.structure)",
               "5584396657084920413"));
   ListSequence.fromList(result)
       .addElement(
           SNodeOperations.getNode(
               "r:00000000-0000-4000-0000-011c895902a8(jetbrains.mps.lang.actions.structure)",
               "5584396657084920670"));
   ListSequence.fromList(result)
       .addElement(
           SNodeOperations.getNode(
               "r:00000000-0000-4000-0000-011c895902bc(jetbrains.mps.lang.sharedConcepts.structure)",
               "1161622665029"));
   return result;
 }
Example #23
0
  public static List<SubstituteAction> sideTransform_ActionsFactory_VarRef_6585869519574772785(
      final IOperationContext operationContext, final SideTransformActionsBuilderContext _context) {
    List<SubstituteAction> result = ListSequence.fromList(new ArrayList<SubstituteAction>());
    ListSequence.fromList(result)
        .addElement(
            new AbstractSideTransformHintSubstituteAction(
                SConceptOperations.findConceptDeclaration(
                    "jetbrains.mps.nanoc.structure.CAssignmentExpression"),
                _context.getSourceNode()) {
              public SNode doSubstitute(
                  @Nullable final EditorContext editorContext, String pattern) {
                SNode result =
                    SNodeOperations.replaceWithAnother(
                        _context.getSourceNode(),
                        SNodeFactoryOperations.createNewNode(
                            "jetbrains.mps.nanoc.structure.CAssignmentExpression", null));
                return SLinkOperations.setTarget(
                    result, "variable", _context.getSourceNode(), true);
              }

              public String getMatchingText(String pattern) {
                return "=";
              }

              public String getVisibleMatchingText(String pattern) {
                return getMatchingText(pattern);
              }
            });
    return result;
  }
 public List<String> getPostfixes(
     SNode node, IScope scope, IOperationContext operationContext, EditorContext editorContext) {
   List<String> result = ListSequence.fromList(new ArrayList<String>());
   SNode nodeType = SLinkOperations.getTarget(node, "type", true);
   if (nodeType != null) {
     List<String> names =
         BehaviorReflection.invokeVirtual(
             (Class<List<String>>) ((Class) Object.class),
             nodeType,
             "virtual_getVariableSuffixes_1213877337304",
             new Object[] {});
     Project project = operationContext.getProject();
     for (String name : names) {
       String prefix =
           BehaviorReflection.invokeVirtual(
               String.class,
               node,
               "virtual_getPrefix_3012473318495495520",
               new Object[] {project});
       String suffix =
           BehaviorReflection.invokeVirtual(
               String.class,
               node,
               "virtual_getSuffix_3012473318495499856",
               new Object[] {project});
       String mainName =
           ((prefix == null || prefix.length() == 0) ? name : NameUtil.capitalize(name));
       ListSequence.fromList(result).addElement(prefix + mainName + suffix);
     }
   }
   return result;
 }
Example #25
0
 public ProcessHandler createProcess(List<ITestNodeWrapper> tests) throws ExecutionException {
   if (tests == null) {
     throw new ExecutionException("Tests to run are null.");
   }
   Tuples._2<List<ITestNodeWrapper>, Tuples._3<String, List<String>, List<String>>> testsToRun =
       Junit_Command.getTestsToRunWithParameters(tests);
   if (ListSequence.fromList(testsToRun._0()).isEmpty()) {
     throw new ExecutionException("Could not find tests to run.");
   }
   return new Java_Command()
       .setVirtualMachineParameter_String(
           IterableUtils.join(ListSequence.fromList(testsToRun._1()._1()), " ")
               + (((myVirtualMachineParameter_String != null
                       && myVirtualMachineParameter_String.length() > 0)
                   ? " " + myVirtualMachineParameter_String
                   : "")))
       .setClassPath_ListString(
           ListSequence.fromList(testsToRun._1()._2())
               .union(ListSequence.fromList(Junit_Command.getClasspath(testsToRun._0())))
               .toListSequence())
       .setJrePath_String(myJrePath_String)
       .setWorkingDirectory_File(myWorkingDirectory_File)
       .setProgramParameter_String(Junit_Command.getProgramParameters(testsToRun._0()))
       .setDebuggerSettings_String(myDebuggerSettings_String)
       .createProcess(testsToRun._1()._0());
 }
Example #26
0
 public Set<? extends IVertex> getNexts() {
   if (targets == null) {
     if (ListSequence.fromList(SLinkOperations.getTargets(module, "dependencies", true))
         .isEmpty()) {
       targets = Collections.emptySet();
     } else {
       targets = new HashSet<CycleHelper.Module>();
       for (SNode ref :
           ListSequence.fromList(SLinkOperations.getTargets(module, "dependencies", true))
               .where(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return SNodeOperations.isInstanceOf(
                           it, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference");
                     }
                   })) {
         CycleHelper.Module tm =
             map.get(
                 SLinkOperations.getTarget(
                     SNodeOperations.cast(
                         ref, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference"),
                     "target",
                     false));
         if (tm == null) {
           genContext.showErrorMessage(ref, "internal problem: unsatisfied local dependency");
         } else {
           targets.add(tm);
         }
       }
     }
   }
   return targets;
 }
  public void doDispose() {
    ExtensionPoint<ConfigurationType> configurationExtensionPoint =
        Extensions.getArea(null).getExtensionPoint(ConfigurationType.CONFIGURATION_TYPE_EP);
    for (ConfigurationType configurationKind :
        ListSequence.fromList(
                RunConfigurationsInitializer_CustomApplicationPlugin.this.myRegisteredKinds)
            .reversedList()) {
      configurationExtensionPoint.unregisterExtension(configurationKind);
    }
    ListSequence.fromList(
            RunConfigurationsInitializer_CustomApplicationPlugin.this.myRegisteredKinds)
        .clear();

    ExtensionPoint<RuntimeConfigurationProducer> producerExtensionPoint =
        Extensions.getArea(null)
            .getExtensionPoint(RuntimeConfigurationProducer.RUNTIME_CONFIGURATION_PRODUCER);
    for (RuntimeConfigurationProducer producer :
        ListSequence.fromList(
            RunConfigurationsInitializer_CustomApplicationPlugin.this.myRegisteredProducers)) {
      producerExtensionPoint.unregisterExtension(producer);
    }
    ListSequence.fromList(
            RunConfigurationsInitializer_CustomApplicationPlugin.this.myRegisteredProducers)
        .clear();
  }
Example #28
0
 public static List<SNode> virtual_getTestMethods_2148145109766218395(SNode thisNode) {
   List<SNode> result = new ArrayList<SNode>();
   if (!(SPropertyOperations.getBoolean(thisNode, "abstractClass"))) {
     ListSequence.fromList(result)
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getTargets(
                     SLinkOperations.getTarget(thisNode, "testMethodList", true),
                     "testMethod",
                     true)));
     if (SNodeOperations.isInstanceOf(
         SLinkOperations.getTarget(
             SLinkOperations.getTarget(thisNode, "superclass", true), "classifier", false),
         "jetbrains.mps.baseLanguage.unitTest.structure.ITestCase")) {
       ListSequence.fromList(result)
           .addSequence(
               ListSequence.fromList(
                   BehaviorReflection.invokeVirtual(
                       (Class<List<SNode>>) ((Class) Object.class),
                       SNodeOperations.cast(
                           SLinkOperations.getTarget(
                               SLinkOperations.getTarget(thisNode, "superclass", true),
                               "classifier",
                               false),
                           "jetbrains.mps.baseLanguage.unitTest.structure.ITestCase"),
                       "virtual_getTestMethods_2148145109766218395",
                       new Object[] {})));
     }
   }
   return result;
 }
Example #29
0
    public void run() {
      try {
        while (true) {
          if (isInterrupted() || myClosed) {
            break;
          }
          processCommand(myCommandQueue.take());
        }

        if (myClosed) {
          List<IManagerCommand> unprocessed =
              ListSequence.fromList(new ArrayList<IManagerCommand>());
          myCommandQueue.drainTo(unprocessed);
          for (IManagerCommand command : ListSequence.fromList(unprocessed)) {
            try {
              command.cancel();
            } catch (Throwable t) {
              LOG.error("Command " + command + " threw an exception.", t);
            }
          }
        }
      } catch (InterruptedException ignore) {
        // do what?
      }
      LOG.debug("Thread " + this + " finished working.");
    }
 public static List<SNode> call_getProperties_5389689214217081373(
     SNode __thisNode__, SModel model) {
   List<SNode> result = new ArrayList<SNode>();
   for (SNode a :
       SimpleBuilderDeclaration_BehaviorDescriptor.getAncestors_id6K2Bohp6U4S.invoke(
           __thisNode__)) {
     ListSequence.fromList(result)
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getChildren(
                     a,
                     MetaAdapterFactory.getContainmentLink(
                         0x132aa4d8a3f7441cL,
                         0xa7eb3fce23492c6aL,
                         0x6524536b2e1a1e38L,
                         0x4acc05c8d729d207L,
                         "property"))));
   }
   for (SNode ext :
       SimpleBuilderDeclaration_BehaviorDescriptor.getExtensions_id6K2Bohp73wF.invoke(
           __thisNode__, model)) {
     ListSequence.fromList(result)
         .addSequence(
             ListSequence.fromList(
                 SLinkOperations.getChildren(
                     ext,
                     MetaAdapterFactory.getContainmentLink(
                         0x132aa4d8a3f7441cL,
                         0xa7eb3fce23492c6aL,
                         0x56cd40dfa78dcaf3L,
                         0x56cd40dfa78dcaf5L,
                         "property"))));
   }
   return result;
 }