Пример #1
0
 protected void installImports() {
   URI baseURI = getBaseURI(ecoreResource);
   List<Import> allImports = pivotModel.getOwnedImports();
   for (EObject eContent : ecoreResource.getContents()) {
     if (eContent instanceof EModelElement) {
       EAnnotation importAnnotation =
           ((EModelElement) eContent).getEAnnotation(PivotConstants.IMPORT_ANNOTATION_SOURCE);
       if (importAnnotation != null) {
         EMap<String, String> details = importAnnotation.getDetails();
         for (String key : details.keySet()) {
           URI uri = URI.createURI(details.get(key));
           if (baseURI != null) {
             uri = uri.resolve(baseURI);
           }
           try {
             assert uri != null;
             Element importedObject =
                 metamodelManager.loadResource(uri, null, ecoreResource.getResourceSet());
             if (importedObject instanceof Namespace) {
               Import anImport = PivotFactory.eINSTANCE.createImport();
               anImport.setName(key);
               anImport.setImportedNamespace((Namespace) importedObject);
               allImports.add(anImport);
             }
           } catch (ParserException e) {
             error(e.getMessage());
           }
         }
       }
     }
   }
 }