コード例 #1
0
 public void execute(final SNode node, final EditorContext editorContext) {
   if ((SLinkOperations.getTarget(node, "query", true) == null)) {
     SPropertyOperations.set(node, "style", "QUERY");
     SNodeFactoryOperations.setNewChild(
         node, "query", "jetbrains.mps.lang.editor.structure.QueryFunction_FontStyle");
   } else {
     SNodeOperations.detachNode(SLinkOperations.getTarget(node, "query", true));
     SPropertyOperations.set(node, "style", "PLAIN");
   }
 }
コード例 #2
0
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode cl =
       (SNodeOperations.getConceptDeclaration(node)
               == SConceptOperations.findConceptDeclaration(
                   "jetbrains.mps.baseLanguage.closures.structure.ClosureLiteral")
           ? SNodeFactoryOperations.createNewNode(
               "jetbrains.mps.baseLanguage.closures.structure.UnrestrictedClosureLiteral", null)
           : SNodeFactoryOperations.createNewNode(
               "jetbrains.mps.baseLanguage.closures.structure.ClosureLiteral", null));
   SNodeOperations.replaceWithAnother(node, cl);
   List<SNode> params = SLinkOperations.getTargets(node, "parameter", true);
   for (SNode p : params) {
     ListSequence.fromList(SLinkOperations.getTargets(cl, "parameter", true))
         .addElement(SNodeOperations.detachNode(p));
   }
   SLinkOperations.setTarget(
       cl,
       "body",
       SNodeOperations.detachNode(SLinkOperations.getTarget(node, "body", true)),
       true);
 }
コード例 #3
0
 public void execute(SNode node) {
   SNode fieldDeclaration =
       SConceptOperations.createNewNode(
           "jetbrains.mps.baseLanguage.structure.FieldDeclaration", null);
   SPropertyOperations.set(
       fieldDeclaration,
       "name",
       SPropertyOperations.getString(
           ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]), "name"));
   SLinkOperations.setTarget(
       fieldDeclaration,
       "type",
       SLinkOperations.getTarget(
           ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
           "type",
           true),
       true);
   SPropertyOperations.set(
       fieldDeclaration,
       "isFinal",
       ""
           + SPropertyOperations.getBoolean(
               ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
               "isFinal"));
   SLinkOperations.setTarget(
       fieldDeclaration,
       "initializer",
       SLinkOperations.getTarget(
           ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
           "initializer",
           true),
       true);
   ListSequence.fromList(SLinkOperations.getTargets(fieldDeclaration, "annotation", true))
       .addSequence(
           ListSequence.fromList(
               SLinkOperations.getTargets(
                   ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
                   "annotation",
                   true)));
   SLinkOperations.setTarget(
       fieldDeclaration,
       "visibility",
       SLinkOperations.getTarget(
           ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
           "visibility",
           true),
       true);
   SPropertyOperations.set(
       fieldDeclaration,
       "isDeprecated",
       ""
           + SPropertyOperations.getBoolean(
               ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]),
               "isDeprecated"));
   ListSequence.fromList(
           SLinkOperations.getTargets(
               ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("containingClass")[0]),
               "field",
               true))
       .addElement(fieldDeclaration);
   SNodeOperations.detachNode(
       ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]));
   SNodeOperations.deleteNode(
       ((SNode) MakeStaticFieldNotStatic_QuickFix.this.getField("staticField")[0]));
 }