@Override
 public Injector createInjectorAndDoEMFRegistration() {
   EPackage.Registry.INSTANCE.put(TaskPackage.eNS_URI, TaskPackage.eINSTANCE);
   EPackage.Registry.INSTANCE.put(QueryPackage.eNS_URI, QueryPackage.eINSTANCE);
   new QueryStandaloneSetup().createInjectorAndDoEMFRegistration();
   return super.createInjectorAndDoEMFRegistration();
 }
  @Test
  public void testSchemaValidationOnLoadWithInvalidFile() {
    String fileName = DATA_BASEDIR + "bare.xml"; // $NON-NLS-1$

    // prepare resource set
    ResourceSet resourceSet = new ResourceSetImpl();
    EPackage.Registry.INSTANCE.put(XMLTypePackage.eNS_URI, XMLTypePackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(XMLNamespacePackage.eNS_URI, XMLNamespacePackage.eINSTANCE);
    resourceSet.getPackageRegistry().put(MyreqifPackage.eNS_URI, MyreqifPackage.eINSTANCE);
    resourceSet
        .getResourceFactoryRegistry()
        .getExtensionToFactoryMap()
        .put("xml", new MyreqifResourceFactoryImpl()); // $NON-NLS-1$

    // load data
    URI emfURI = URI.createURI(fileName, true);
    Resource resource = resourceSet.createResource(emfURI);
    HashMap<String, Object> options = new HashMap<String, Object>();
    enableSchemaValidationAndNewMethods(options);

    try {
      resource.load(options);
    } catch (IOException ioe) {
      assertTrue(ioe.getMessage(), ioe.getMessage().contains("cvc-complex-type.2.4.a:"));
    }

    // validate data
    assertEquals(1, resource.getErrors().size());
    assertTrue(resource.getContents().get(0) instanceof DocumentRoot);
  }
  public static void standalone(EPackage... metaModels) {
    for (EPackage metaModel : metaModels) {
      EPackage.Registry.INSTANCE.put(metaModel.getNsURI(), metaModel);
    }
    EPackage.Registry.INSTANCE.put(EcorePackage.eINSTANCE.getNsURI(), EcorePackage.eINSTANCE);
    Resource.Factory.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("ecore", new XMIResourceFactoryImpl());

    instance = new EmfFragActivator();
    instance.init();
  }
Example #4
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link LibraryPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static LibraryPackage init() {
    if (isInited)
      return (LibraryPackage) EPackage.Registry.INSTANCE.getEPackage(LibraryPackage.eNS_URI);

    // Obtain or create and register package
    LibraryPackageImpl theLibraryPackage =
        (LibraryPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof LibraryPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new LibraryPackageImpl());

    isInited = true;

    // Create package meta-data objects
    theLibraryPackage.createPackageContents();

    // Initialize created meta-data
    theLibraryPackage.initializePackageContents();

    // Register package validator
    EValidator.Registry.INSTANCE.put(
        theLibraryPackage,
        new EValidator.Descriptor() {
          public EValidator getEValidator() {
            return LibraryValidator.INSTANCE;
          }
        });

    // Mark meta-data to indicate it can't be changed
    theLibraryPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(LibraryPackage.eNS_URI, theLibraryPackage);
    return theLibraryPackage;
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey(
        "http://www.eclipse.org/2011/xtext/idea/ui/common/types/xtext/ui/Refactoring")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.eclipse.org/2011/xtext/idea/ui/common/types/xtext/ui/Refactoring",
          org.eclipse
              .xtext
              .idea
              .common
              .types
              .refactoringTestLanguage
              .RefactoringTestLanguagePackage
              .eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("ideaTypesRefactoring", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("ideaTypesRefactoring", serviceProvider);
  }
  public void register(Injector injector) {

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("eobjectatoffsettestlanguage", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("eobjectatoffsettestlanguage", serviceProvider);

    if (!EPackage.Registry.INSTANCE.containsKey(
        "http://www.xtext.org/EObjectAtOffsetTestLanguage")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.xtext.org/EObjectAtOffsetTestLanguage",
          org.eclipse
              .xtext
              .resource
              .eObjectAtOffsetTestLanguage
              .EObjectAtOffsetTestLanguagePackage
              .eINSTANCE);
    }
  }
Example #7
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link MyDslPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static MyDslPackage init() {
    if (isInited)
      return (MyDslPackage) EPackage.Registry.INSTANCE.getEPackage(MyDslPackage.eNS_URI);

    // Obtain or create and register package
    MyDslPackageImpl theMyDslPackage =
        (MyDslPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MyDslPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new MyDslPackageImpl());

    isInited = true;

    // Create package meta-data objects
    theMyDslPackage.createPackageContents();

    // Initialize created meta-data
    theMyDslPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theMyDslPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(MyDslPackage.eNS_URI, theMyDslPackage);
    return theMyDslPackage;
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link Graphics2dPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static Graphics2dPackage init() {
    if (isInited)
      return (Graphics2dPackage) EPackage.Registry.INSTANCE.getEPackage(Graphics2dPackage.eNS_URI);

    // Obtain or create and register package
    Graphics2dPackageImpl theGraphics2dPackage =
        (Graphics2dPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Graphics2dPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new Graphics2dPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    WidgetsPackage.eINSTANCE.eClass();
    StylesPackage.eINSTANCE.eClass();
    LayoutsPackage.eINSTANCE.eClass();
    UtilPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theGraphics2dPackage.createPackageContents();

    // Initialize created meta-data
    theGraphics2dPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theGraphics2dPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(Graphics2dPackage.eNS_URI, theGraphics2dPackage);
    return theGraphics2dPackage;
  }
  @Override
  protected boolean readElement(IConfigurationElement element, boolean add) {
    if (element.getName().equals(TAG_RESOURCE)) {
      String packageURI = element.getAttribute(ATT_URI);
      if (packageURI == null) {
        logMissingAttribute(element, ATT_URI);
      } else if (element.getAttribute(ATT_LOCATION) == null) {
        logMissingAttribute(element, ATT_LOCATION);
      } else if (add) {
        Object previous =
            EPackage.Registry.INSTANCE.put(
                packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION));
        if (previous instanceof PluginClassDescriptor) {
          PluginClassDescriptor descriptor = (PluginClassDescriptor) previous;
          EcorePlugin.INSTANCE.log(
              "Both '"
                  + descriptor.element.getContributor().getName()
                  + "' and '"
                  + element.getContributor().getName()
                  + "' register a package for '"
                  + packageURI
                  + "'");
        }

        return true;
      } else {
        EPackage.Registry.INSTANCE.remove(packageURI);
        return true;
      }
    }

    return false;
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link RuleEnginePackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static RuleEnginePackage init() {
    if (isInited)
      return (RuleEnginePackage) EPackage.Registry.INSTANCE.getEPackage(RuleEnginePackage.eNS_URI);

    // Obtain or create and register package
    RuleEnginePackageImpl theRuleEnginePackage =
        (RuleEnginePackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof RuleEnginePackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new RuleEnginePackageImpl());

    isInited = true;

    // Initialize simple dependencies
    XbasePackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theRuleEnginePackage.createPackageContents();

    // Initialize created meta-data
    theRuleEnginePackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theRuleEnginePackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(RuleEnginePackage.eNS_URI, theRuleEnginePackage);
    return theRuleEnginePackage;
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey(
        "http://www.bme.hu/mit/inf/gomrp/statemachine/dsl/text/StateMachineDSL")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.bme.hu/mit/inf/gomrp/statemachine/dsl/text/StateMachineDSL",
          hu.bme
              .mit
              .inf
              .gomrp
              .statemachine
              .dsl
              .text
              .stateMachineDSL
              .StateMachineDSLPackage
              .eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("smbm", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("smbm", serviceProvider);
  }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   EPackage aMetamodel = AmetamodelPackage.eINSTANCE;
   EPackage.Registry.INSTANCE.put(aMetamodel.getNsURI(), aMetamodel);
   with(new ConcreteTestLanguageStandaloneSetup());
 }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link DawnGmfGenmodelPackage#eINSTANCE} when that field
   * is accessed. Clients should not invoke it directly. Instead, they should simply access that
   * field to obtain the package.
   * <!--
   * begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static DawnGmfGenmodelPackage init() {
    if (isInited) {
      return (DawnGmfGenmodelPackage)
          EPackage.Registry.INSTANCE.getEPackage(DawnGmfGenmodelPackage.eNS_URI);
    }

    // Obtain or create and register package
    DawnGmfGenmodelPackageImpl theDawnGmfGenmodelPackage =
        (DawnGmfGenmodelPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DawnGmfGenmodelPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new DawnGmfGenmodelPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    DawngenmodelPackage.eINSTANCE.eClass();
    GMFGenPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theDawnGmfGenmodelPackage.createPackageContents();

    // Initialize created meta-data
    theDawnGmfGenmodelPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theDawnGmfGenmodelPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(DawnGmfGenmodelPackage.eNS_URI, theDawnGmfGenmodelPackage);
    return theDawnGmfGenmodelPackage;
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link StatesPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static StatesPackage init() {
    if (isInited)
      return (StatesPackage) EPackage.Registry.INSTANCE.getEPackage(StatesPackage.eNS_URI);

    // Obtain or create and register package
    StatesPackageImpl theStatesPackage =
        (StatesPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof StatesPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new StatesPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    ArduinoPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    ArduinoTracePackageImpl theArduinoTracePackage =
        (ArduinoTracePackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(ArduinoTracePackage.eNS_URI)
                    instanceof ArduinoTracePackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(ArduinoTracePackage.eNS_URI)
                : ArduinoTracePackage.eINSTANCE);
    StepsPackageImpl theStepsPackage =
        (StepsPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(StepsPackage.eNS_URI)
                    instanceof StepsPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(StepsPackage.eNS_URI)
                : StepsPackage.eINSTANCE);
    ArduinoPackageImpl theArduinoPackage_1 =
        (ArduinoPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(
                        arduinoTrace.States.arduino.ArduinoPackage.eNS_URI)
                    instanceof ArduinoPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(
                    arduinoTrace.States.arduino.ArduinoPackage.eNS_URI)
                : arduinoTrace.States.arduino.ArduinoPackage.eINSTANCE);

    // Create package meta-data objects
    theStatesPackage.createPackageContents();
    theArduinoTracePackage.createPackageContents();
    theStepsPackage.createPackageContents();
    theArduinoPackage_1.createPackageContents();

    // Initialize created meta-data
    theStatesPackage.initializePackageContents();
    theArduinoTracePackage.initializePackageContents();
    theStepsPackage.initializePackageContents();
    theArduinoPackage_1.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theStatesPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(StatesPackage.eNS_URI, theStatesPackage);
    return theStatesPackage;
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link EnactmentPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static EnactmentPackage init() {
    if (isInited)
      return (EnactmentPackage) EPackage.Registry.INSTANCE.getEPackage(EnactmentPackage.eNS_URI);

    // Obtain or create and register package
    EnactmentPackageImpl theEnactmentPackage =
        (EnactmentPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EnactmentPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new EnactmentPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    TasksPackage.eINSTANCE.eClass();
    NormInstancesPackage.eINSTANCE.eClass();
    ServicePackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    ActionPackageImpl theActionPackage =
        (ActionPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(ActionPackage.eNS_URI)
                    instanceof ActionPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(ActionPackage.eNS_URI)
                : ActionPackage.eINSTANCE);
    EventPackageImpl theEventPackage =
        (EventPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(EventPackage.eNS_URI)
                    instanceof EventPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(EventPackage.eNS_URI)
                : EventPackage.eINSTANCE);
    FactPackageImpl theFactPackage =
        (FactPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(FactPackage.eNS_URI) instanceof FactPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(FactPackage.eNS_URI)
                : FactPackage.eINSTANCE);

    // Create package meta-data objects
    theEnactmentPackage.createPackageContents();
    theActionPackage.createPackageContents();
    theEventPackage.createPackageContents();
    theFactPackage.createPackageContents();

    // Initialize created meta-data
    theEnactmentPackage.initializePackageContents();
    theActionPackage.initializePackageContents();
    theEventPackage.initializePackageContents();
    theFactPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theEnactmentPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(EnactmentPackage.eNS_URI, theEnactmentPackage);
    return theEnactmentPackage;
  }
 public void
     testProjectMap_JavaVMTypes_LoadDefault() { // Almost certainly a workspace project; always a
                                                // project on Hudson
   EPackage.Registry.INSTANCE.put(
       org.eclipse.xtext.common.types.TypesPackage.eNS_URI,
       org.eclipse.xtext.common.types.TypesPackage.eINSTANCE);
   String project = "org.eclipse.xtext.common.types";
   String modelPath = project + "/model/JavaVMTypes.ecore";
   doTestProjectMap_LoadDefault(
       org.eclipse.xtext.common.types.TypesPackage.eINSTANCE, project, modelPath, "/", false);
 }
Example #17
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link EditorPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static EditorPackage init() {
    if (isInited)
      return (EditorPackage) EPackage.Registry.INSTANCE.getEPackage(EditorPackage.eNS_URI);

    // Obtain or create and register package
    EditorPackageImpl theEditorPackage =
        (EditorPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EditorPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new EditorPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    MAVOPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    MIDPackageImpl theMIDPackage =
        (MIDPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(MIDPackage.eNS_URI) instanceof MIDPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(MIDPackage.eNS_URI)
                : MIDPackage.eINSTANCE);
    RelationshipPackageImpl theRelationshipPackage =
        (RelationshipPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(RelationshipPackage.eNS_URI)
                    instanceof RelationshipPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(RelationshipPackage.eNS_URI)
                : RelationshipPackage.eINSTANCE);
    OperatorPackageImpl theOperatorPackage =
        (OperatorPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(OperatorPackage.eNS_URI)
                    instanceof OperatorPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(OperatorPackage.eNS_URI)
                : OperatorPackage.eINSTANCE);

    // Create package meta-data objects
    theEditorPackage.createPackageContents();
    theMIDPackage.createPackageContents();
    theRelationshipPackage.createPackageContents();
    theOperatorPackage.createPackageContents();

    // Initialize created meta-data
    theEditorPackage.initializePackageContents();
    theMIDPackage.initializePackageContents();
    theRelationshipPackage.initializePackageContents();
    theOperatorPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theEditorPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(EditorPackage.eNS_URI, theEditorPackage);
    return theEditorPackage;
  }
Example #18
0
  @Override
  public void execute() throws BuildException {

    EPackage.Registry.INSTANCE.put(GenModelPackage.eNS_URI, GenModelPackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
    EPackage.Registry.INSTANCE.put(
        "http://www.eclipse.org/uml2/2.2.0/GenModel", getUML2GenPackage());
    EPackage.Registry.INSTANCE.put(
        "http://www.eclipse.org/uml2/4.0.0/Types", getUML2TypesPackage());

    Map<String, Object> extensionToFactoryMap =
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
    extensionToFactoryMap.put(
        "ecore", new org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());
    extensionToFactoryMap.put(
        "genmodel", new org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl());

    // We ignore the deprecation warning until the method is not available
    // anymore to keep this code runnable against old versions of EMF as
    // long as possible.
    @SuppressWarnings("deprecation")
    final Map<String, URI> packageNsURIToGenModelLocationMap =
        EcorePlugin.getEPackageNsURIToGenModelLocationMap();
    URI genModelURIObject = URI.createURI(genModelURI);
    ResourceSet rs = new ResourceSetImpl();
    Resource resource = null;
    try {
      resource = rs.getResource(genModelURIObject, true);

      for (GenPackage genPackage : ((GenModel) resource.getContents().get(0)).getGenPackages()) {
        EPackage ecorePackage = genPackage.getEcorePackage();
        String nsURI = ecorePackage.getNsURI();
        EPackage.Registry.INSTANCE.put(nsURI, ecorePackage);
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new BuildException("Can't load generator model from " + genModelURIObject);
    }

    packageNsURIToGenModelLocationMap.put(namespaceURI, genModelURIObject);
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link CinematicPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static CinematicPackage init() {
    if (isInited)
      return (CinematicPackage) EPackage.Registry.INSTANCE.getEPackage(CinematicPackage.eNS_URI);

    // Obtain or create and register package
    CinematicPackageImpl theCinematicPackage =
        (CinematicPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CinematicPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new CinematicPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    EnvironmentPackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    ViewPackageImpl theViewPackage =
        (ViewPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(ViewPackage.eNS_URI) instanceof ViewPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(ViewPackage.eNS_URI)
                : ViewPackage.eINSTANCE);
    FlowPackageImpl theFlowPackage =
        (FlowPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(FlowPackage.eNS_URI) instanceof FlowPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(FlowPackage.eNS_URI)
                : FlowPackage.eINSTANCE);
    ToolkitsPackageImpl theToolkitsPackage =
        (ToolkitsPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(ToolkitsPackage.eNS_URI)
                    instanceof ToolkitsPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(ToolkitsPackage.eNS_URI)
                : ToolkitsPackage.eINSTANCE);

    // Create package meta-data objects
    theCinematicPackage.createPackageContents();
    theViewPackage.createPackageContents();
    theFlowPackage.createPackageContents();
    theToolkitsPackage.createPackageContents();

    // Initialize created meta-data
    theCinematicPackage.initializePackageContents();
    theViewPackage.initializePackageContents();
    theFlowPackage.initializePackageContents();
    theToolkitsPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theCinematicPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(CinematicPackage.eNS_URI, theCinematicPackage);
    return theCinematicPackage;
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.xtext.org/builddsl")) {
      EPackage.Registry.INSTANCE.put("http://www.xtext.org/builddsl", BuildPackage.eINSTANCE);
    }
    IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
    IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class);

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("build", resourceFactory);
    IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("build", serviceProvider);
  }
Example #21
0
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link MmPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain
   * the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static MmPackage init() {
    if (isInited) return (MmPackage) EPackage.Registry.INSTANCE.getEPackage(MmPackage.eNS_URI);

    // Obtain or create and register package
    MmPackageImpl theMmPackage =
        (MmPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MmPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new MmPackageImpl());

    isInited = true;

    // Obtain or create and register interdependencies
    PictogramsPackageImpl thePictogramsPackage =
        (PictogramsPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(PictogramsPackage.eNS_URI)
                    instanceof PictogramsPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(PictogramsPackage.eNS_URI)
                : PictogramsPackage.eINSTANCE);
    AlgorithmsPackageImpl theAlgorithmsPackage =
        (AlgorithmsPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(AlgorithmsPackage.eNS_URI)
                    instanceof AlgorithmsPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(AlgorithmsPackage.eNS_URI)
                : AlgorithmsPackage.eINSTANCE);
    StylesPackageImpl theStylesPackage =
        (StylesPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(StylesPackage.eNS_URI)
                    instanceof StylesPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(StylesPackage.eNS_URI)
                : StylesPackage.eINSTANCE);

    // Create package meta-data objects
    theMmPackage.createPackageContents();
    thePictogramsPackage.createPackageContents();
    theAlgorithmsPackage.createPackageContents();
    theStylesPackage.createPackageContents();

    // Initialize created meta-data
    theMmPackage.initializePackageContents();
    thePictogramsPackage.initializePackageContents();
    theAlgorithmsPackage.initializePackageContents();
    theStylesPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theMmPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(MmPackage.eNS_URI, theMmPackage);
    return theMmPackage;
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link Statechart_1_0Package#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!--
   * begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static Statechart_1_0Package init() {
    if (isInited) {
      return (Statechart_1_0Package)
          EPackage.Registry.INSTANCE.getEPackage(Statechart_1_0Package.eNS_URI);
    }

    // Obtain or create and register package
    Statechart_1_0PackageImpl theStatechart_1_0Package =
        (Statechart_1_0PackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Statechart_1_0PackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new Statechart_1_0PackageImpl());

    isInited = true;

    // Initialize simple dependencies
    XMLTypePackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    Xadlcore_3_0PackageImpl theXadlcore_3_0Package =
        (Xadlcore_3_0PackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(Xadlcore_3_0Package.eNS_URI)
                    instanceof Xadlcore_3_0PackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(Xadlcore_3_0Package.eNS_URI)
                : Xadlcore_3_0Package.eINSTANCE);
    XlinkPackageImpl theXlinkPackage =
        (XlinkPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(XlinkPackage.eNS_URI)
                    instanceof XlinkPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(XlinkPackage.eNS_URI)
                : XlinkPackage.eINSTANCE);

    // Create package meta-data objects
    theStatechart_1_0Package.createPackageContents();
    theXadlcore_3_0Package.createPackageContents();
    theXlinkPackage.createPackageContents();

    // Initialize created meta-data
    theStatechart_1_0Package.initializePackageContents();
    theXadlcore_3_0Package.initializePackageContents();
    theXlinkPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theStatechart_1_0Package.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(Statechart_1_0Package.eNS_URI, theStatechart_1_0Package);
    return theStatechart_1_0Package;
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.bundleDsl.com/BundleDsl")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.bundleDsl.com/BundleDsl", com.bundleDsl.bundleDsl.BundleDslPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("bdsl", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("bdsl", serviceProvider);
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.ExprDemo.expr")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.ExprDemo.expr", expr.exprDemo.ExprDemoPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("expr", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("expr", serviceProvider);
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.caltoopia.org/frontend/Cal")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.caltoopia.org/frontend/Cal", org.caltoopia.frontend.cal.CalPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("cal", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("cal", serviceProvider);
  }
  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon
   * which it depends.
   *
   * <p>This method is used to initialize {@link EnvironmentPackage#eINSTANCE} when that field is
   * accessed. Clients should not invoke it directly. Instead, they should simply access that field
   * to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static EnvironmentPackage init() {
    if (isInited)
      return (EnvironmentPackage)
          EPackage.Registry.INSTANCE.getEPackage(EnvironmentPackage.eNS_URI);

    // Obtain or create and register package
    EnvironmentPackageImpl theEnvironmentPackage =
        (EnvironmentPackageImpl)
            (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EnvironmentPackageImpl
                ? EPackage.Registry.INSTANCE.get(eNS_URI)
                : new EnvironmentPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    ConstraintsPackage.eINSTANCE.eClass();
    EcorePackage.eINSTANCE.eClass();

    // Obtain or create and register interdependencies
    ContextsPackageImpl theContextsPackage =
        (ContextsPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(ContextsPackage.eNS_URI)
                    instanceof ContextsPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(ContextsPackage.eNS_URI)
                : ContextsPackage.eINSTANCE);
    UiPackageImpl theUiPackage =
        (UiPackageImpl)
            (EPackage.Registry.INSTANCE.getEPackage(UiPackage.eNS_URI) instanceof UiPackageImpl
                ? EPackage.Registry.INSTANCE.getEPackage(UiPackage.eNS_URI)
                : UiPackage.eINSTANCE);

    // Create package meta-data objects
    theEnvironmentPackage.createPackageContents();
    theContextsPackage.createPackageContents();
    theUiPackage.createPackageContents();

    // Initialize created meta-data
    theEnvironmentPackage.initializePackageContents();
    theContextsPackage.initializePackageContents();
    theUiPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theEnvironmentPackage.freeze();

    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(EnvironmentPackage.eNS_URI, theEnvironmentPackage);
    return theEnvironmentPackage;
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://lig.imag.fr/dsl/ExSchema")) {
      EPackage.Registry.INSTANCE.put(
          "http://lig.imag.fr/dsl/ExSchema",
          fr.imag.exschema.xtext.exSchema.ExSchemaPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("exschema", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("exschema", serviceProvider);
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.example.org/domainmodel/Domainmodel")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.example.org/domainmodel/Domainmodel",
          org.example.domainmodel.domainmodel.DomainmodelPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("dmdl", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("dmdl", serviceProvider);
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.scribble.org/editor/dsl/ScribbleDsl")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.scribble.org/editor/dsl/ScribbleDsl",
          org.scribble.editor.dsl.scribbleDsl.ScribbleDslPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("scr", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("scr", serviceProvider);
  }
  public void register(Injector injector) {
    if (!EPackage.Registry.INSTANCE.containsKey("http://www.eclipse.org/papyrus/alf/Alf")) {
      EPackage.Registry.INSTANCE.put(
          "http://www.eclipse.org/papyrus/alf/Alf",
          org.eclipse.papyrus.uml.alf.alf.AlfPackage.eINSTANCE);
    }

    org.eclipse.xtext.resource.IResourceFactory resourceFactory =
        injector.getInstance(org.eclipse.xtext.resource.IResourceFactory.class);
    org.eclipse.xtext.resource.IResourceServiceProvider serviceProvider =
        injector.getInstance(org.eclipse.xtext.resource.IResourceServiceProvider.class);
    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("alf", resourceFactory);
    org.eclipse.xtext.resource.IResourceServiceProvider.Registry.INSTANCE
        .getExtensionToFactoryMap()
        .put("alf", serviceProvider);
  }