package jetbrains.mps.baseLanguage.typesystem;

/*Generated by MPS */

import jetbrains.mps.errors.QuickFix_Runtime;
import jetbrains.mps.smodel.SNodePointer;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.model.SReference;
import org.jetbrains.mps.openapi.language.SReferenceLink;
import jetbrains.mps.smodel.ModelImports;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;

public class makeReferenceStatic_QuickFix extends QuickFix_Runtime {
  public makeReferenceStatic_QuickFix() {
    super(new SNodePointer("r:00000000-0000-4000-0000-011c895902c5(jetbrains.mps.baseLanguage.typesystem)", "6287546302289331498"));
  }
  public String getDescription(SNode node) {
    return "Make reference static";
  }
  public void execute(SNode node) {
    SReference ref = node.getReference(((SReferenceLink) makeReferenceStatic_QuickFix.this.getField("role")[0]));
    SNode target = ref.getTargetNode();
    if (target == null) {
      return;
    }

    node.setReferenceTarget(((SReferenceLink) makeReferenceStatic_QuickFix.this.getField("role")[0]), target);

    // add model import
    new ModelImports(SNodeOperations.getModel(node)).addModelImport(target.getModel().getReference());
  }
}
