コード例 #1
0
 @Override
 protected void handleChild(Object resultObject, String tagName, Object value)
     throws SAXException {
   BaseSModelDescriptor.ModelLoadResult result =
       (BaseSModelDescriptor.ModelLoadResult) resultObject;
   if ("persistence".equals(tagName)) {
     return;
   }
   if ("language".equals(tagName)) {
     ModuleReference child = (ModuleReference) value;
     fieldmodel.addLanguage(child);
     return;
   }
   if ("language-engaged-on-generation".equals(tagName)) {
     ModuleReference child = (ModuleReference) value;
     fieldmodel.addEngagedOnGenerationLanguage(child);
     return;
   }
   if ("devkit".equals(tagName)) {
     ModuleReference child = (ModuleReference) value;
     fieldmodel.addDevKit(child);
     return;
   }
   if ("import".equals(tagName)) {
     String[] child = (String[]) value;
     fieldhelper.addImportToModel(
         fieldmodel, child[0], child[1], Integer.parseInt(child[2]), child[3] != null);
     return;
   }
   if ("roots".equals(tagName)) {
     Object child = (Object) value;
     if (fieldtoState == ModelLoadingState.ROOTS_LOADED
         && !(StructureModificationProcessor.hasRefactoringsToPlay(fieldmodel))) {
       result.setState(ModelLoadingState.ROOTS_LOADED);
       fieldmodel.setLoading(false);
       throw new BreakParseSAXException();
     }
     return;
   }
   if ("root".equals(tagName)) {
     return;
   }
   super.handleChild(resultObject, tagName, value);
 }
コード例 #2
0
ファイル: ModelReader8Handler.java プロジェクト: sprig/MPS
 @Override
 protected SNode createObject(Attributes attrs) throws SAXException {
   Tuples._3<ConceptKind, StaticScope, Boolean> parsed =
       fieldhelper.readNodeInfo(attrs.getValue("nodeInfo"));
   if (parsed == null) {
     throw new SAXParseException("bad typeInfo attribute", null);
   }
   boolean interfaceNode = false;
   if (fieldinterfaceOnly) {
     if (fieldhasRefactorings == null) {
       fieldhasRefactorings = StructureModificationProcessor.hasRefactoringsToPlay(fieldmodel);
     }
     if (!(fieldhasRefactorings)) {
       interfaceNode = (parsed._0() == ConceptKind.INTERFACE || attrs.getValue("role") == null);
     }
   }
   jetbrains.mps.smodel.SNode result =
       (interfaceNode
           ? new InterfaceSNode(fieldhelper.readType(attrs.getValue("type")))
           : new jetbrains.mps.smodel.SNode(fieldhelper.readType(attrs.getValue("type"))));
   fieldlinkMap.addNodeMetainfo(parsed._0(), parsed._1(), (boolean) parsed._2(), result);
   return result;
 }