Java Code Examples for org.eclipse.emf.ecore.util.ExtendedMetaData

The following are top voted examples for showing how to use org.eclipse.emf.ecore.util.ExtendedMetaData. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: neoscada   File: ConfigurationModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames ()
{
    if ( initialObjectNames == null )
    {
        initialObjectNames = new ArrayList<String> ();
        for ( EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements ( ExtendedMetaData.INSTANCE.getDocumentRoot ( configurationPackage ) ) )
        {
            if ( eStructuralFeature.isChangeable () )
            {
                EClassifier eClassifier = eStructuralFeature.getEType ();
                if ( eClassifier instanceof EClass )
                {
                    EClass eClass = (EClass)eClassifier;
                    if ( !eClass.isAbstract () )
                    {
                        initialObjectNames.add ( eStructuralFeature.getName () );
                    }
                }
            }
        }
        Collections.sort ( initialObjectNames, CommonPlugin.INSTANCE.getComparator () );
    }
    return initialObjectNames;
}
 
Example 2
Project: hybris-commerce-eclipse-plugin   File: BeansModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(beansPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 3
Project: ATLauncher   File: ATLLauncher.java   Source Code and License 6 votes vote down vote up
private String lazyMetamodelRegistration(String metamodelPath){
	
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
  	
    ResourceSet rs = new ResourceSetImpl();
    // Enables extended meta-data, weird we have to do this but well...
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(EPackage.Registry.INSTANCE);
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(metamodelPath), true);
    EObject eObject = r.getContents().get(0);
    // A meta-model might have multiple packages we assume the main package is the first one listed
    if (eObject instanceof EPackage) {
        EPackage p = (EPackage)eObject;
        System.out.println(p.getNsURI());
        EPackage.Registry.INSTANCE.put(p.getNsURI(), p);
        return p.getNsURI();
    }
    return null;
}
 
Example 4
Project: SecureBPMN   File: Bpmn2ModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE
				.getAllElements(ExtendedMetaData.INSTANCE
						.getDocumentRoot(bpmn2Package))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass) eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames
								.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames,
				CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 5
Project: OpenSPIFe   File: EMFUtils.java   Source Code and License 6 votes vote down vote up
/**
 * This is a much faster method for simply testing to see if something has a choice of values.
 * It is implemented based on getChoiceOfValues from ItemPropertyDescriptor.
 * 
 * @param pd
 * @param object
 * @return
 */
public static boolean hasChoiceOfValues(IItemPropertyDescriptor pd, Object object) {
	if (object instanceof EObject) {
		Object feature = pd.getFeature(object);
		if (feature instanceof EReference[]) {
			return true;
		} 
		if (feature instanceof EReference) {
			return true;
		} 
		if (feature instanceof EAttribute) {
			EAttribute attribute = (EAttribute) feature;
			if (attribute.getEType() instanceof EEnum) {
				return true;
			}
			EDataType eDataType = attribute.getEAttributeType();
			List<String> enumeration = ExtendedMetaData.INSTANCE.getEnumerationFacet(eDataType);
			if (!enumeration.isEmpty()) {
				return true;
			}
		}
	}
	// must fall back on property descriptor
	Collection<?> values = getChoiceOfValues(pd, object);
	return (values != null && !values.isEmpty());
}
 
Example 6
Project: NeoEMF   File: AbstractInputTest.java   Source Code and License 6 votes vote down vote up
/**
 * Registers a EPackage in {@link Registry} according to its {@code prefix} and {@code uri}, from an Ecore file.
 * <p>
 * The targeted Ecore file must be present in {@code /resources/ecore}.
 */
protected static void registerEPackageFromEcore(String prefix, String uri) {
    File file = getResourceFile(ECORE_PATH.replaceAll("\\{name\\}", prefix));

    EPackage ePackage = null;

    Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(ECORE, new EcoreResourceFactoryImpl());

    ResourceSet rs = new ResourceSetImpl();

    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    Resource r = rs.getResource(URI.createFileURI(file.toString()), true);
    EObject eObject = r.getContents().get(0);
    if (eObject instanceof EPackage) {
        ePackage = (EPackage) eObject;
        rs.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
    }

    assertThat(ePackage).isNotNull(); // "EPackage does not exist"

    Registry.INSTANCE.put(uri, ePackage);
}
 
Example 7
Project: LiquibaseEditor   File: DbchangelogModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(dbchangelogPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, java.text.Collator.getInstance());
	}
	return initialObjectNames;
}
 
Example 8
Project: eclipse-avro   File: XMLTypeValidator.java   Source Code and License 6 votes vote down vote up
protected void reportXMLGregorianCalendarViolation
  (EDataType eDataType, XMLGregorianCalendar value, DiagnosticChain diagnostics, Map<Object, Object> context)
{
  createDiagnostic
    (Diagnostic.ERROR,
     DIAGNOSTIC_SOURCE,
     WELL_FORMED_XML_GREGORIAN_CALENDAR,
     "_UI_BadXMLGregorianCalendar_diagnostic",
     new Object []
     {
       getValueLabel(eDataType, value, context),
       ExtendedMetaData.INSTANCE.getName(eDataType)
     },
     new Object [] { value },
     context);
}
 
Example 9
Project: eclipse-avro   File: EPackageImpl.java   Source Code and License 6 votes vote down vote up
protected void fixEStructuralFeatures(EClass eClass)
{
  List<EStructuralFeature> features = eClass.getEStructuralFeatures();
  if (!features.isEmpty())
  {
    // The container class must be null for the open content features of the document root
    // to ensure that they are looked up in the actual eClass() 
    // rather than assumed to be a feature with a feature ID relative to the actual class.
    // Otherwise, it's good to have this optimization.
    //
    Class<?> containerClass = ExtendedMetaData.INSTANCE.getDocumentRoot(this) == eClass ? null : eClass.getInstanceClass();

    int id = eClass.getFeatureID(features.get(0));
    
    for (Iterator<EStructuralFeature> i = features.iterator(); i.hasNext(); )
    {
      EStructuralFeatureImpl eStructuralFeature = (EStructuralFeatureImpl)i.next();
      eStructuralFeature.setFeatureID(id++);
      eStructuralFeature.setContainerClass(containerClass);
    }
  }
}
 
Example 10
Project: eclipse-avro   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public Object eOpenGet(EStructuralFeature eFeature, boolean resolve)
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    return ((FeatureMap.Internal)featureMap).get(eFeature, resolve);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid feature");
  }
}
 
Example 11
Project: eclipse-avro   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public void eOpenSet(EStructuralFeature eFeature, Object newValue) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    ((FeatureMap.Internal)featureMap).set(eFeature, newValue);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature");
  }
}
 
Example 12
Project: eclipse-avro   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public void eOpenUnset(EStructuralFeature eFeature) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    ((FeatureMap.Internal)featureMap).unset(eFeature);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature");
  }
}
 
Example 13
Project: eclipse-avro   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public boolean eOpenIsSet(EStructuralFeature eFeature) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    return ((FeatureMap.Internal)featureMap).isSet(eFeature);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid feature");
  }
}
 
Example 14
Project: eclipse-avro   File: EStructuralFeatureImpl.java   Source Code and License 6 votes vote down vote up
public FeatureMap.Entry.Internal getFeatureMapEntryPrototype()
{
  if (prototypeFeatureMapEntry == null)
  {
    EReference eOpposite = getEOpposite();
    if (eOpposite != null)
    {
      prototypeFeatureMapEntry = new InverseUpdatingFeatureMapEntry(this, null);
    }
    else if (isContainment())
    {
      // create containment one.
      prototypeFeatureMapEntry = new ContainmentUpdatingFeatureMapEntry(this, null);
    }
    else if (ExtendedMetaData.INSTANCE.getFeatureKind(this) == ExtendedMetaData.SIMPLE_FEATURE)
    {
      prototypeFeatureMapEntry = new SimpleContentFeatureMapEntry(this);
    }
    else
    {
      prototypeFeatureMapEntry = new SimpleFeatureMapEntry(this, null);
    }
  }
  return prototypeFeatureMapEntry;
}
 
Example 15
Project: citygml4emf   File: XALModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(xalPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 16
Project: citygml4emf   File: XlinkModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(xlinkPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 17
Project: citygml4emf   File: NamespaceModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(namespacePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 18
Project: citygml4emf   File: Smil20ModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(smil20Package))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 19
Project: citygml4emf   File: LanguageModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(languagePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 20
Project: citygml4emf   File: CityfurnitureModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(cityfurniturePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 21
Project: citygml4emf   File: GenericsModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(genericsPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 22
Project: citygml4emf   File: TexturedsurfaceModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(texturedsurfacePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 23
Project: citygml4emf   File: CityobjectgroupModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(cityobjectgroupPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 24
Project: citygml4emf   File: CitygmlModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(citygmlPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 25
Project: citygml4emf   File: TransportationModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(transportationPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 26
Project: citygml4emf   File: BuildingModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(buildingPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 27
Project: citygml4emf   File: AppearanceModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(appearancePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 28
Project: citygml4emf   File: LanduseModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(landusePackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 29
Project: citygml4emf   File: ReliefModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(reliefPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 30
Project: citygml4emf   File: VegetationModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(vegetationPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 31
Project: citygml4emf   File: WaterbodyModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(waterbodyPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 32
Project: citygml4emf   File: GmlModelWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames() {
	if (initialObjectNames == null) {
		initialObjectNames = new ArrayList<String>();
		for (EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements(ExtendedMetaData.INSTANCE.getDocumentRoot(gmlPackage))) {
			if (eStructuralFeature.isChangeable()) {
				EClassifier eClassifier = eStructuralFeature.getEType();
				if (eClassifier instanceof EClass) {
					EClass eClass = (EClass)eClassifier;
					if (!eClass.isAbstract()) {
						initialObjectNames.add(eStructuralFeature.getName());
					}
				}
			}
		}
		Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
	}
	return initialObjectNames;
}
 
Example 33
Project: clickwatch   File: XMLTypeValidator.java   Source Code and License 6 votes vote down vote up
protected void reportXMLGregorianCalendarViolation
  (EDataType eDataType, XMLGregorianCalendar value, DiagnosticChain diagnostics, Map<Object, Object> context)
{
  createDiagnostic
    (Diagnostic.ERROR,
     DIAGNOSTIC_SOURCE,
     WELL_FORMED_XML_GREGORIAN_CALENDAR,
     "_UI_BadXMLGregorianCalendar_diagnostic",
     new Object []
     {
       getValueLabel(eDataType, value, context),
       ExtendedMetaData.INSTANCE.getName(eDataType)
     },
     new Object [] { value },
     context);
}
 
Example 34
Project: clickwatch   File: EPackageImpl.java   Source Code and License 6 votes vote down vote up
protected void fixEStructuralFeatures(EClass eClass)
{
  List<EStructuralFeature> features = eClass.getEStructuralFeatures();
  if (!features.isEmpty())
  {
    // The container class must be null for the open content features of the document root
    // to ensure that they are looked up in the actual eClass() 
    // rather than assumed to be a feature with a feature ID relative to the actual class.
    // Otherwise, it's good to have this optimization.
    //
    Class<?> containerClass = ExtendedMetaData.INSTANCE.getDocumentRoot(this) == eClass ? null : eClass.getInstanceClass();

    int id = eClass.getFeatureID(features.get(0));
    
    for (Iterator<EStructuralFeature> i = features.iterator(); i.hasNext(); )
    {
      EStructuralFeatureImpl eStructuralFeature = (EStructuralFeatureImpl)i.next();
      eStructuralFeature.setFeatureID(id++);
      eStructuralFeature.setContainerClass(containerClass);
    }
  }
}
 
Example 35
Project: clickwatch   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public Object eOpenGet(EStructuralFeature eFeature, boolean resolve)
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    return ((FeatureMap.Internal)featureMap).get(eFeature, resolve);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid feature");
  }
}
 
Example 36
Project: clickwatch   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public void eOpenSet(EStructuralFeature eFeature, Object newValue) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    ((FeatureMap.Internal)featureMap).set(eFeature, newValue);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature");
  }
}
 
Example 37
Project: clickwatch   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public void eOpenUnset(EStructuralFeature eFeature) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    ((FeatureMap.Internal)featureMap).unset(eFeature);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature");
  }
}
 
Example 38
Project: clickwatch   File: BasicEObjectImpl.java   Source Code and License 6 votes vote down vote up
public boolean eOpenIsSet(EStructuralFeature eFeature) 
{
  EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature);
  if (openFeature != null)
  {
    if (!FeatureMapUtil.isFeatureMap(openFeature))
    {
      openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature);
    }
    FeatureMap featureMap = (FeatureMap)eGet(openFeature);
    return ((FeatureMap.Internal)featureMap).isSet(eFeature);
  }
  else
  {
    throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid feature");
  }
}
 
Example 39
Project: clickwatch   File: EStructuralFeatureImpl.java   Source Code and License 6 votes vote down vote up
public FeatureMap.Entry.Internal getFeatureMapEntryPrototype()
{
  if (prototypeFeatureMapEntry == null)
  {
    EReference eOpposite = getEOpposite();
    if (eOpposite != null)
    {
      prototypeFeatureMapEntry = new InverseUpdatingFeatureMapEntry(this, null);
    }
    else if (isContainment())
    {
      // create containment one.
      prototypeFeatureMapEntry = new ContainmentUpdatingFeatureMapEntry(this, null);
    }
    else if (ExtendedMetaData.INSTANCE.getFeatureKind(this) == ExtendedMetaData.SIMPLE_FEATURE)
    {
      prototypeFeatureMapEntry = new SimpleContentFeatureMapEntry(this);
    }
    else
    {
      prototypeFeatureMapEntry = new SimpleFeatureMapEntry(this, null);
    }
  }
  return prototypeFeatureMapEntry;
}
 
Example 40
Project: kie-wb-common   File: Bpmn2JsonUnmarshaller.java   Source Code and License 6 votes vote down vote up
private void createDockersForBoundaryEvent(BoundaryEvent boundaryEvent) {
    List<Point> dockers = _dockers.get(boundaryEvent.getId());
    StringBuffer dockerBuff = new StringBuffer();
    for (int i = 0; i < dockers.size(); i++) {
        dockerBuff.append(dockers.get(i).getX());
        dockerBuff.append("^");
        dockerBuff.append(dockers.get(i).getY());
        dockerBuff.append("|");
    }
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "http://www.jboss.org/drools",
            "dockerinfo",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     dockerBuff.toString());
    boundaryEvent.getAnyAttribute().add(extensionEntry);
}
 
Example 41
Project: kie-wb-common   File: Bpmn2JsonUnmarshaller.java   Source Code and License 6 votes vote down vote up
protected void applyAssociationProperties(Association association,
                                          Map<String, String> properties) {
    if (properties.get("type") != null) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "type",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("type"));
        association.getAnyAttribute().add(extensionEntry);
    }
    if (properties.get("bordercolor") != null && properties.get("bordercolor").length() > 0) {
        if (!(_elementColors.containsKey(association.getId()))) {
            List<String> colorsList = new ArrayList<String>();
            colorsList.add("bordercolor:" + properties.get("bordercolor"));
            _elementColors.put(association.getId(),
                               colorsList);
        } else {
            _elementColors.get(association.getId()).add("bordercolor:" + properties.get("bordercolor"));
        }
    }
}
 
Example 42
Project: kie-wb-common   File: Bpmn2JsonUnmarshaller.java   Source Code and License 6 votes vote down vote up
protected void applyDefinitionProperties(Definitions def,
                                         Map<String, String> properties) {
    def.setTypeLanguage(properties.get("typelanguage"));
    //def.setTargetNamespace(properties.get("targetnamespace"));
    def.setTargetNamespace("http://www.omg.org/bpmn20");
    def.setExpressionLanguage(properties.get("expressionlanguage"));
    ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
    EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
            "xsi",
            "schemaLocation",
            false,
            false);
    SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                     "http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd");
    def.getAnyAttribute().add(extensionEntry);
    //_currentResource.getContents().add(def);// hook the definitions object to the resource early.
}
 
Example 43
Project: kie-wb-common   File: Bpmn2JsonUnmarshaller.java   Source Code and License 6 votes vote down vote up
protected void applyGatewayProperties(Gateway gateway,
                                      Map<String, String> properties) {
    if (properties.get("name") != null && properties.get("name").length() > 0) {
        gateway.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n",
                                                                                       " "));
        // add unescaped and untouched name value as extension element as well
        Utils.setMetaDataExtensionValue(gateway,
                                        "elementname",
                                        wrapInCDATABlock(properties.get("name").replaceAll("\\\\n",
                                                                                           "\n")));
    } else {
        gateway.setName("");
    }
    if (properties.get("defaultgate") != null && (gateway instanceof InclusiveGateway || gateway instanceof ExclusiveGateway)) {
        ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
        EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
                "http://www.jboss.org/drools",
                "dg",
                false,
                false);
        SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute,
                                                                         properties.get("defaultgate"));
        gateway.getAnyAttribute().add(extensionEntry);
    }
}
 
Example 44
Project: neoscada   File: ConfigurationModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel ()
{
    EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot ( configurationPackage );
    EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature ( initialObjectCreationPage.getInitialObjectName () );
    EObject rootObject = configurationFactory.create ( eClass );
    rootObject.eSet ( eStructuralFeature, EcoreUtil.create ( (EClass)eStructuralFeature.getEType () ) );
    return rootObject;
}
 
Example 45
Project: NoSQLDataEngineering   File: ModelLoader.java   Source Code and License 5 votes vote down vote up
public ModelLoader()
{
	resourceSet = new ResourceSetImpl();
	final ExtendedMetaData extendedMetaData = 
		new BasicExtendedMetaData(resourceSet.getPackageRegistry());
	resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,
	    extendedMetaData);
}
 
Example 46
Project: caml2tosca   File: ToscaUtil.java   Source Code and License 5 votes vote down vote up
public static EReference createTEReference(String nsPrefix, String nsURI, String name) {
	// if the package / document root does not exist yet then create it
	if(Package_Map.get(nsURI) == null) {
		createTEPackage(nsPrefix, nsURI);
	}
	
	EClass documentRoot = (EClass) Package_Map.get(nsURI).getEClassifier("DocumentRoot");
	EReference feature = (EReference) documentRoot.getEStructuralFeature(name);
	
	if(feature == null) {
		EReference propertiesTypeFeature = EcoreFactory.eINSTANCE.createEReference();
		propertiesTypeFeature.setName(name);		
		propertiesTypeFeature.setEType(EcorePackage.eINSTANCE.getEClassifier("EObject"));
		propertiesTypeFeature.setContainment(true);
		propertiesTypeFeature.setUpperBound(-2);
		// the container of the feature is the document root
		documentRoot.eClass().getEStructuralFeatures().add(propertiesTypeFeature);
		// set the namespace of the feature
		Extended_Meta_Data.setNamespace(propertiesTypeFeature, nsURI);
		// how should the feature be represented in XML: element vs. attribute
		Extended_Meta_Data.setFeatureKind(propertiesTypeFeature, ExtendedMetaData.ELEMENT_FEATURE);
		
		return propertiesTypeFeature;
	} else {
		return feature;
	}
}
 
Example 47
Project: menthor-xcore   File: OntoumlResource.java   Source Code and License 5 votes vote down vote up
public static EPackage readEcore (String ecorePath)
{	
	ResourceSet ecoreResourceSet = new ResourceSetImpl();		
	URI ecoreURI = URI.createFileURI(ecorePath);		
	Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	ecoreResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
	ecoreResourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);				
	final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(ecoreResourceSet.getPackageRegistry());
	ecoreResourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA,  extendedMetaData);		
    Resource ecoreResource = ecoreResourceSet.getResource(ecoreURI,true);
    EPackage ecoremodel = (EPackage) ecoreResource.getContents().get(0);	    
    ecoreResource.getResourceSet().getPackageRegistry().put(ecoremodel.getNsURI(),ecoremodel);
    EPackage.Registry.INSTANCE.put(ecoremodel.getNsURI(), ecoremodel);	    
    return ecoremodel;
}
 
Example 48
Project: SecureBPMN   File: Bpmn2ModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(bpmn2Package);
	EStructuralFeature eStructuralFeature = eClass
			.getEStructuralFeature(initialObjectCreationPage
					.getInitialObjectName());
	EObject rootObject = bpmn2Factory.create(eClass);
	rootObject.eSet(eStructuralFeature,
			EcoreUtil.create((EClass) eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 49
Project: LiquibaseEditor   File: DbchangelogModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(dbchangelogPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = dbchangelogFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 50
Project: massif   File: Exporter.java   Source Code and License 5 votes vote down vote up
/**
 * Loads the EMF representation of a Simulink model.
 * 
 * @param fileNameWithoutExtension
 *            the file to load specified by its name
 * @return the loaded SimulinkModel root EMF model object
 * @throws SimulinkApiException
 */
public SimulinkModel loadSimulinkModel(String fileNameWithoutExtension) throws SimulinkApiException {

    // Register a resource factory for the extension "simulink"
    Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
    Map<String, Object> m = reg.getExtensionToFactoryMap();
    m.put("simulink", new XMIResourceFactoryImpl());

    // Obtain a new resource set
    ResourceSet rs = new ResourceSetImpl();
    final ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(rs.getPackageRegistry());
    rs.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData);

    // The model will be saved to the root of the project for now under the
    // given name.
    // TODO save path may come from an extension or properties file
    String path = fileNameWithoutExtension + ".simulink";

    // Load the resource
    Resource loadResource = rs.getResource(URI.createURI(path), true);
    Object resourceContent = loadResource.getContents().get(0);

    // Make a log entry if the root object isn't a SimulinkModel
    if (!(resourceContent instanceof SimulinkModel))
        logger.error("The given resource contained no SimulinkModel as a root element!");

    // Return the root EMF model object
    // Also throws an exception when invalid cast occurs
    return (SimulinkModel) resourceContent;
}
 
Example 51
Project: citygml4emf   File: XALModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(xalPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = xalFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 52
Project: citygml4emf   File: XlinkModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(xlinkPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = xlinkFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 53
Project: citygml4emf   File: NamespaceModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(namespacePackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = namespaceFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 54
Project: citygml4emf   File: Smil20ModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(smil20Package);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = smil20Factory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 55
Project: citygml4emf   File: LanguageModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(languagePackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = languageFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 56
Project: citygml4emf   File: CityfurnitureModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(cityfurniturePackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = cityfurnitureFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 57
Project: citygml4emf   File: GenericsModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(genericsPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = genericsFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 58
Project: citygml4emf   File: TexturedsurfaceModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(texturedsurfacePackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = texturedsurfaceFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 59
Project: citygml4emf   File: CityobjectgroupModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(cityobjectgroupPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = cityobjectgroupFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}
 
Example 60
Project: citygml4emf   File: CitygmlModelWizard.java   Source Code and License 5 votes vote down vote up
/**
 * Create a new model.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected EObject createInitialModel() {
	EClass eClass = ExtendedMetaData.INSTANCE.getDocumentRoot(citygmlPackage);
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());
	EObject rootObject = citygmlFactory.create(eClass);
	rootObject.eSet(eStructuralFeature, EcoreUtil.create((EClass)eStructuralFeature.getEType()));
	return rootObject;
}