コード例 #1
0
 /**
  * Returns the factory associated with the model. Object creation are made through that factory.
  *
  * @return
  */
 public static CCMModelFactory getFactory() {
   if (ccmFactory == null) {
     // Access the factory (needed to create instances)
     Map registry = EPackage.Registry.INSTANCE;
     String ccmURI = CCMModelPackage.eNS_URI;
     CCMModelPackage ccmPackage = (CCMModelPackage) registry.get(ccmURI);
     ccmFactory = ccmPackage.getCCMModelFactory();
   }
   return ccmFactory;
 }
コード例 #2
0
  /**
   * Creates a new navexpression.
   *
   * @param
   * @return
   */
  public CCM createModelView(IFile file) {
    IPath path = file.getFullPath();
    String filename = file.getName().trim();
    String rootName = filename.substring(0, filename.length() - 4);

    createResource(path);
    loadVersionAndRepID(path);
    // Create a new NavExp model
    Map registry = EPackage.Registry.INSTANCE;
    String navURI = CCMModelPackage.eNS_URI;
    CCMModelPackage ccmPackage = (CCMModelPackage) registry.get(navURI);
    ccmFactory = ccmPackage.getCCMModelFactory();
    ccm = ccmFactory.createCCM();
    initm = new InitilizeModel(ccm, version);
    initm.createRootModule(ccmFactory, rootName);
    initm.initType(ccmFactory);
    EList list = resource.getContents();
    list.add(ccm);
    return ccm;
  }