Esempio n. 1
0
  @NotNull
  protected IOperationContext createOperationContext() {
    if (myContext != null) {
      return myContext;
    }

    assert isValid()
        : "createOperationContext() was called for MPSFileNodeEditor with invalid file: " + myFile;
    SModelDescriptor sm = myFile.getNode().getModel().getModelDescriptor();
    assert sm != null : "Model descriptor is null for model: " + myFile.getNode().getModel();

    IOperationContext result =
        new ModuleContext(sm.getModule(), ProjectHelper.toMPSProject(myProject));
    assert result.getModule() == sm.getModule()
        : "Different modules: " + result.getModule() + "/" + sm.getModule();
    return result;
  }
Esempio n. 2
0
 public static IOperationContext getOperationContext(
     com.intellij.openapi.project.Project project, SModel model) {
   SModelDescriptor md = model.getModelDescriptor();
   assert md != null;
   IModule module = md.getModule();
   if (module instanceof DiffTemporaryModule) {
     return ((DiffTemporaryModule) module).createContext();
   } else {
     return new ModuleContext(module, ProjectHelper.toMPSProject(project));
   }
 }
Esempio n. 3
0
  protected IOperationContext createOperationContext() {
    if (myContext != null) {
      return myContext;
    }

    assert isValid()
        : "createOperationContext() was called for MPSFileNodeEditor with invalid file: " + myFile;
    SNode node = myFile.getNode();
    if (node == null || node.getModel() == null || node.getModel().getModelDescriptor() == null) {
      myIsValid = false;
      return null;
    }
    SModelDescriptor sm = node.getModel().getModelDescriptor();

    IOperationContext result =
        new ModuleContext(sm.getModule(), ProjectHelper.toMPSProject(myProject));
    assert result.getModule() == sm.getModule()
        : "Different modules: " + result.getModule() + "/" + sm.getModule();
    return result;
  }
Esempio n. 4
0
  public static void createModuleForModel(
      SModel model, String version, Project project, boolean mergeResultModel) {
    if (model.getModelDescriptor() != null) {
      return;
    }
    IModule module = null;
    if (mergeResultModel) {
      SModelDescriptor mdInRepo =
          SModelRepository.getInstance().getModelDescriptor(model.getSModelReference());
      if (mdInRepo != null) {
        module = mdInRepo.getModule();
      }
    }

    if (module == null) {
      module = new DiffTemporaryModule(model, version, project);
    }
    model.setModelDescriptor(
        new DiffTemporaryModule.DiffSModelDescriptor(module, model, mergeResultModel));
  }
 private static IModule check_gidzrl_a0e0a0e(SModelDescriptor checkedDotOperand) {
   if (null != checkedDotOperand) {
     return checkedDotOperand.getModule();
   }
   return null;
 }
Esempio n. 6
0
 public void onCreate(SModelDescriptor model) {
   if (!model.getModule().getUsedLanguagesReferences().contains(BootstrapLanguages.UNITTEST)) {
     model.getModule().addUsedLanguage(BootstrapLanguages.UNITTEST);
   }
   model.getSModel().addLanguage(BootstrapLanguages.UNITTEST);
 }