示例#1
0
 public static void updateIconResourceBundle(SNode cb) {
   SModule module = SNodeOperations.getModel(cb).getModule();
   if (module instanceof Language) {
     SNode irb = getIconResourceBundle((Language) module);
     for (SNode ire :
         ListSequence.fromList(
                 SNodeOperations.getDescendants(
                     cb,
                     "jetbrains.mps.lang.resources.structure.IconResourceExpression",
                     false,
                     new String[] {}))
             .toListSequence()) {
       {
         Pattern _pattern_0 = REGEXP_st4ewd_a0a0a0b0b0b;
         Matcher _matcher_0 =
             _pattern_0.matcher(
                 IconResource_Behavior.call_getFilename_8974276187400030131(
                     SLinkOperations.getTarget(ire, "icon", true)));
         if (_matcher_0.find()) {
           final String iconName = _matcher_0.group(1).toUpperCase();
           SNode decl =
               ListSequence.fromList(SLinkOperations.getTargets(irb, "icons", true))
                   .findFirst(
                       new IWhereFilter<SNode>() {
                         public boolean accept(SNode it) {
                           return iconName.equals(SPropertyOperations.getString(it, "name"));
                         }
                       });
           if ((decl == null)) {
             decl =
                 SLinkOperations.addNewChild(
                     irb,
                     "icons",
                     "jetbrains.mps.lang.resources.structure.IconResourceDeclaration");
             SLinkOperations.setTarget(
                 decl,
                 "iconExpression",
                 _quotation_createNode_st4ewd_a0b0c0a0b0b0b(
                     SNodeOperations.copyNode(SLinkOperations.getTarget(ire, "icon", true))),
                 true);
             SPropertyOperations.set(decl, "name", iconName);
           }
           SNodeOperations.replaceWithAnother(
               ire, _quotation_createNode_st4ewd_a0a3a0a1a1a1(decl));
         }
       }
     }
   }
 }
 private static Color _StyleParameter_QueryFunction_79r3b6_a0a(
     EditorContext editorContext, SNode node) {
   return (IconResource_Behavior.call_isValid_8974276187400030063(node) ? Color.BLACK : Color.RED);
 }
 private static boolean renderingCondition_79r3b6_a0a0a0(SNode node, EditorContext editorContext) {
   return IconResource_Behavior.call_isValid_8974276187400030063(node);
 }