/*package*/ static void setupCaretAndSelection_id7TYU6fNl1yz(
     @NotNull SNode __thisNode__, EditorCell cellWithId) {
   if (cellWithId instanceof EditorCell_Label) {
     EditorCell_Label label = (EditorCell_Label) cellWithId;
     label.setCaretPosition(
         ((int)
             AnonymousCellAnnotation__BehaviorDescriptor.getCaretPosition_id5rZKa_fUlry.invoke(
                 __thisNode__, label)));
     label.setSelectionStart(
         SPropertyOperations.getInteger(
             __thisNode__,
             MetaAdapterFactory.getProperty(
                 0x8585453e6bfb4d80L,
                 0x98deb16074f1d86cL,
                 0x11e31babe12L,
                 0x56ffc0a94fe5fc33L,
                 "selectionStart")));
     label.setSelectionEnd(
         SPropertyOperations.getInteger(
             __thisNode__,
             MetaAdapterFactory.getProperty(
                 0x8585453e6bfb4d80L,
                 0x98deb16074f1d86cL,
                 0x11e31babe12L,
                 0x56ffc0a94fe5fc35L,
                 "selectionEnd")));
   }
 }
 public static void call_setupCaretAndSelection_9114978211826243747(
     SNode thisNode, EditorCell cellWithId) {
   if (cellWithId instanceof EditorCell_Label) {
     EditorCell_Label label = (EditorCell_Label) cellWithId;
     label.setCaretPosition(
         AnonymousCellAnnotation_Behavior.call_getCaretPosition_6268941039745717986(
             thisNode, label));
     label.setSelectionStart(SPropertyOperations.getInteger(thisNode, "selectionStart"));
     label.setSelectionEnd(SPropertyOperations.getInteger(thisNode, "selectionEnd"));
   }
 }
 public static String virtual_getString_1222432436326(SNode thisNode, List<SNode> vars) {
   String s =
       BehaviorReflection.invokeVirtual(
           String.class,
           SLinkOperations.getTarget(thisNode, "regexp", true),
           "virtual_getString_1222432436326",
           new Object[] {vars});
   return ((UnaryRegexp_Behavior.call_inParentheses_1353467374623956744(thisNode)
           ? Regexp_Behavior.call_par_1222433790846(thisNode, s)
           : s))
       + "{"
       + SPropertyOperations.getInteger(thisNode, "n")
       + ","
       + SPropertyOperations.getInteger(thisNode, "m")
       + "}";
 }
 public static int call_getCaretPosition_6268941039745717986(
     SNode thisNode, EditorCell_Label label) {
   if (SPropertyOperations.getBoolean(thisNode, "isLastPosition")) {
     return label.getText().length();
   } else {
     return SPropertyOperations.getInteger(thisNode, "caretPosition");
   }
 }
 /*package*/ static int fromVersion_id4uVwhQyFcnl(@NotNull SNode __thisNode__) {
   return SPropertyOperations.getInteger(
       __thisNode__,
       MetaAdapterFactory.getProperty(
           0x9074634404fd4286L,
           0x97d5b46ae6a81709L,
           0x73e8a2c68b62c6a3L,
           0x50c63f9f4a0dac17L,
           "fromVersion"));
 }
 /*package*/ static int getCaretPosition_id5rZKa_fUlry(
     @NotNull SNode __thisNode__, EditorCell_Label label) {
   if (SPropertyOperations.getBoolean(
       __thisNode__,
       MetaAdapterFactory.getProperty(
           0x8585453e6bfb4d80L,
           0x98deb16074f1d86cL,
           0x11e31babe12L,
           0x11e3fde6f41L,
           "isLastPosition"))) {
     return label.getText().length();
   } else {
     return SPropertyOperations.getInteger(
         __thisNode__,
         MetaAdapterFactory.getProperty(
             0x8585453e6bfb4d80L,
             0x98deb16074f1d86cL,
             0x11e31babe12L,
             0x11e31babe14L,
             "caretPosition"));
   }
 }
예제 #7
0
 public static Object virtual_getCompileTimeConstantValue_1238860310638(
     SNode thisNode, SModule module) {
   return SPropertyOperations.getInteger(thisNode, "value");
 }
예제 #8
0
 public static boolean baseMappingRule_Condition_7287346816896135373(
     final BaseMappingRuleContext _context) {
   return SPropertyOperations.getInteger(_context.getNode(), "intval") == 42;
 }
예제 #9
0
  public void processCycles() {
    List<SNode> modules = new ArrayList<SNode>();
    ListSequence.fromList(modules)
        .addSequence(
            ListSequence.fromList(SLinkOperations.getTargets(project, "parts", true))
                .where(
                    new IWhereFilter<SNode>() {
                      public boolean accept(SNode it) {
                        return SNodeOperations.isInstanceOf(
                            it, "jetbrains.mps.build.workflow.structure.BwfJavaModule");
                      }
                    })
                .select(
                    new ISelector<SNode, SNode>() {
                      public SNode select(SNode it) {
                        return SNodeOperations.cast(
                            it, "jetbrains.mps.build.workflow.structure.BwfJavaModule");
                      }
                    }));
    for (SNode m : ListSequence.fromList(modules)) {
      optimizeDependencies(m);
    }
    for (SNode jm : modules) {
      CycleHelper.Module module = new CycleHelper.Module(jm);
      map.put(jm, module);
      if (isEmpty_yc0kju_a0c0d0f(SPropertyOperations.getString(jm, "outputFolder"))) {
        genContext.showErrorMessage(jm, "empty output path");
      } else if (SPropertyOperations.getString(jm, "outputFolder").endsWith("/")
          || SPropertyOperations.getString(jm, "outputFolder").endsWith("\\")) {
        genContext.showErrorMessage(jm, "output path shouldn't end with slash");
      }
    }
    Graph<CycleHelper.Module> graph = new Graph();
    for (CycleHelper.Module module : map.values()) {
      graph.add(module);
    }
    List<List<CycleHelper.Module>> cycles = Graphs.findStronglyConnectedComponents(graph);
    Collections.reverse(cycles);
    List<SNode> cyclesToName = new ArrayList<SNode>();
    for (List<CycleHelper.Module> cycle : cycles) {
      if (cycle.size() < 2) {
        continue;
      }
      final Set<SNode> cycleModules = new HashSet<SNode>();
      for (CycleHelper.Module m : cycle) {
        cycleModules.add(m.getModule());
      }

      Collections.sort(
          cycle,
          new Comparator<CycleHelper.Module>() {
            public int compare(CycleHelper.Module m1, CycleHelper.Module m2) {
              return new Integer(SNodeOperations.getIndexInParent(m1.getModule()))
                  .compareTo(SNodeOperations.getIndexInParent(m2.getModule()));
            }
          });
      SNode first = cycle.get(0).getModule();
      SModel model = SNodeOperations.getModel(first);
      SNode cycleX =
          SModelOperations.createNewNode(
              model, null, "jetbrains.mps.build.workflow.structure.BwfJavaModule");
      cyclesToName.add(cycleX);
      SNodeOperations.insertPrevSiblingChild(first, cycleX);
      SPropertyOperations.set(cycleX, "noWarnings", "" + (true));

      // build cycle sources & dependencies; trying to avoid duplication (which is not critical)
      Set<String> seenSources = new HashSet<String>();
      List<SNode> sources = new ArrayList<SNode>();
      Set<String> seenDependencies = new HashSet<String>();
      List<SNode> deps = new ArrayList<SNode>();
      Set<SNode> seenModules = new LinkedHashSet<SNode>();
      Set<SNode> seenLibraries = new LinkedHashSet<SNode>();
      Set<SNode> taskDependency = new LinkedHashSet<SNode>();

      int heapSize = 0;
      for (CycleHelper.Module m : cycle) {
        SNode module = m.getModule();
        heapSize = Math.max(heapSize, SPropertyOperations.getInteger(module, "heapSize"));
        ListSequence.fromList(SLinkOperations.getTargets(module, "dependencies", true))
            .removeWhere(
                new IWhereFilter<SNode>() {
                  public boolean accept(SNode it) {
                    return SNodeOperations.isInstanceOf(
                            it, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference")
                        && cycleModules.contains(
                            SLinkOperations.getTarget(
                                SNodeOperations.cast(
                                    it,
                                    "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference"),
                                "target",
                                false));
                  }
                });
        for (SNode dep : SLinkOperations.getTargets(module, "dependencies", true)) {
          if (SNodeOperations.isInstanceOf(
              dep, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference")) {
            seenModules.add(
                SLinkOperations.getTarget(
                    SNodeOperations.cast(
                        dep, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference"),
                    "target",
                    false));
          } else if (SNodeOperations.isInstanceOf(
              dep, "jetbrains.mps.build.workflow.structure.BwfJavaLibraryReference")) {
            seenLibraries.add(
                SLinkOperations.getTarget(
                    SNodeOperations.cast(
                        dep, "jetbrains.mps.build.workflow.structure.BwfJavaLibraryReference"),
                    "target",
                    false));
          } else if (SNodeOperations.isInstanceOf(
              dep, "jetbrains.mps.build.workflow.structure.BwfJavaClassPath")) {
            SNode cp =
                SLinkOperations.getTarget(
                    SNodeOperations.cast(
                        dep, "jetbrains.mps.build.workflow.structure.BwfJavaClassPath"),
                    "classpath",
                    true);
            XmlSignature s = new XmlSignature().add(cp);
            String id = (s.hasErrors() ? "dep." + cp.getNodeId().toString() : s.getResult());
            if (seenDependencies.add(id)) {
              deps.add(cp);
            }
          } else {
            genContext.showErrorMessage(dep, "unexpected dependency type");
          }
        }

        for (SNode task :
            ListSequence.fromList(SLinkOperations.getTargets(module, "taskDeps", true))
                .select(
                    new ISelector<SNode, SNode>() {
                      public SNode select(SNode it) {
                        return SLinkOperations.getTarget(it, "target", false);
                      }
                    })) {
          if ((task != null)) {
            taskDependency.add(task);
          }
        }

        SNode mref =
            SModelOperations.createNewNode(
                model, null, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference");
        SLinkOperations.setTarget(mref, "target", cycleX, false);
        ListSequence.fromList(SLinkOperations.getTargets(module, "dependencies", true))
            .addElement(mref);

        for (SNode n :
            ListSequence.fromList(
                SLinkOperations.getTargets(
                    SLinkOperations.getTarget(module, "sources", true), "elements", true))) {
          XmlSignature s = new XmlSignature().add(n);
          String id = (s.hasErrors() ? "path." + n.getNodeId().toString() : s.getResult());
          if (seenSources.add(id)) {
            sources.add(n);
          }
        }
      }
      SPropertyOperations.set(cycleX, "heapSize", "" + (heapSize));
      SLinkOperations.setNewChild(
          cycleX, "sources", "jetbrains.mps.build.workflow.structure.BwfFileSet");
      ListSequence.fromList(
              SLinkOperations.getTargets(
                  SLinkOperations.getTarget(cycleX, "sources", true), "elements", true))
          .addSequence(
              Sequence.fromIterable(((Iterable<SNode>) sources))
                  .select(
                      new ISelector<SNode, SNode>() {
                        public SNode select(SNode it) {
                          return CopyUtil.copy(it);
                        }
                      }));
      for (SNode dep : deps) {
        SNode cp =
            SModelOperations.createNewNode(
                model, null, "jetbrains.mps.build.workflow.structure.BwfJavaClassPath");
        SLinkOperations.setTarget(cp, "classpath", CopyUtil.copy(dep), true);
        ListSequence.fromList(SLinkOperations.getTargets(cycleX, "dependencies", true))
            .addElement(cp);
      }
      for (SNode jl : seenLibraries) {
        SNode mref =
            SModelOperations.createNewNode(
                model, null, "jetbrains.mps.build.workflow.structure.BwfJavaLibraryReference");
        SLinkOperations.setTarget(mref, "target", jl, false);
        ListSequence.fromList(SLinkOperations.getTargets(cycleX, "dependencies", true))
            .addElement(mref);
      }
      for (SNode jm : seenModules) {
        SNode mref =
            SModelOperations.createNewNode(
                model, null, "jetbrains.mps.build.workflow.structure.BwfJavaModuleReference");
        SLinkOperations.setTarget(mref, "target", jm, false);
        ListSequence.fromList(SLinkOperations.getTargets(cycleX, "dependencies", true))
            .addElement(mref);
      }
      for (SNode task : taskDependency) {
        SNode dependency =
            SModelOperations.createNewNode(
                model, null, "jetbrains.mps.build.workflow.structure.BwfTaskDependency");
        SLinkOperations.setTarget(dependency, "target", task, false);
        ListSequence.fromList(SLinkOperations.getTargets(cycleX, "taskDeps", true))
            .addElement(dependency);
      }
    }
    int cycleCounter = 0;
    Collections.sort(
        cyclesToName,
        new Comparator<SNode>() {
          public int compare(SNode n1, SNode n2) {
            return new Integer(SNodeOperations.getIndexInParent(n1))
                .compareTo(SNodeOperations.getIndexInParent(n2));
          }
        });
    for (SNode cycleX : cyclesToName) {
      SPropertyOperations.set(cycleX, "name", "java.modules.cycle." + ++cycleCounter);
      SPropertyOperations.set(
          cycleX,
          "outputFolder",
          SPropertyOperations.getString(project, "temporaryFolder")
              + "/"
              + SPropertyOperations.getString(cycleX, "name"));
    }
  }
 private static boolean renderingCondition_ed1xw0_a4a(
     SNode node, EditorContext editorContext, IScope scope) {
   return SPropertyOperations.getInteger(node, "minDigits") > 1;
 }
예제 #11
0
 public static boolean ifMacro_Condition_1659807394254658074(final IfMacroContext _context) {
   return SPropertyOperations.getInteger(_context.getNode(), "heapSize") >= 4;
 }
예제 #12
0
 public static Object propertyMacro_GetPropertyValue_1659807394254658124(
     final PropertyMacroContext _context) {
   return SPropertyOperations.getInteger(_context.getNode(), "heapSize") + "m";
 }