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

The following examples show how to use org.eclipse.emf.ecore.util.ExtendedMetaData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationModelWizard.java    From neoscada with Eclipse Public License 1.0 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
Source File: BeansModelWizard.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 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
Source File: ConfigurationModelWizard.java    From neoscada with Eclipse Public License 1.0 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 #4
Source File: Bpmn2ResourceImpl.java    From fixflow with Apache License 2.0 5 votes vote down vote up
/**
 * Used from the <extension><definition> tag to load referenced extension schemes.
 * The extension scheme will be loaded and converted to EMF Ecore on the fly.
 * 
 * @param id
 */
private EObject loadExtensionSchema(QName xsdQname) {
    EPackage extensionPackage = extendedMetaData.getPackage(xsdQname.getNamespaceURI());
    if (extensionPackage == null) {

        try {
            @SuppressWarnings("unchecked")
            Class<XSDEcoreBuilder> theXSDEcoreBuilderClass = (Class<XSDEcoreBuilder>) CommonPlugin
                    .loadClass("org.eclipse.xsd", "org.eclipse.xsd.ecore.XSDEcoreBuilder");

            Constructor<XSDEcoreBuilder> theXSDEcoreBuilderConstructor = theXSDEcoreBuilderClass
                    .getConstructor(new Class[] { ExtendedMetaData.class, Map.class });
            Field theOptionField = theXSDEcoreBuilderClass
                    .getField("OPTION_REUSE_REGISTERED_PACKAGES");
            Object theXsdOption = theOptionField.get(null);

            URI location = urisToLocations.get(xsdQname.getNamespaceURI());
            Map<Object, Object> options = new HashMap<Object, Object>();
            options.put(theXsdOption, Boolean.TRUE);
            XSDEcoreBuilder builder = theXSDEcoreBuilderConstructor.newInstance(
                    extendedMetaData, options);
            builder.generate(location);
        } catch (Exception e) {
        }
    }

    return extendedMetaData.getElement(xsdQname.getNamespaceURI(), xsdQname.getLocalPart());
}
 
Example #5
Source File: Bpmn2ResourceFactoryImpl.java    From fixflow with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of the resource.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public Resource createResource(URI uri) {
    Bpmn2ResourceImpl result = new Bpmn2ResourceImpl(uri);
    ExtendedMetaData extendedMetadata = new XmlExtendedMetadata();
    result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetadata);
    result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetadata);
 
    //((Delegator)EPackage.Registry.INSTANCE).put("http://www.founderfix.com/fixflow", Bpmn2Package.eINSTANCE);
    
    result.getDefaultSaveOptions().put(XMLResource.OPTION_SAVE_TYPE_INFORMATION,
            new OnlyContainmentTypeInfo());

    result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,
            Boolean.TRUE);
    result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,
            Boolean.TRUE);

    result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);

    result.getDefaultSaveOptions().put(XMLResource.OPTION_ELEMENT_HANDLER,
            new ElementHandlerImpl(true));

    result.getDefaultSaveOptions().put(XMLResource.OPTION_ENCODING, "UTF-8");

    return result;
}
 
Example #6
Source File: ReleaseUtils.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void startElement(String uri, String localName, String qName,
	Attributes attributes) throws SAXException {
	if (!ExtendedMetaData.XMI_URI.equals(uri)
		&& !ExtendedMetaData.XML_SCHEMA_URI.equals(uri)) {
		nsURI = uri;
		throw new SAXException();
	}
}
 
Example #7
Source File: ReleaseUtils.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
	super.startPrefixMapping(prefix, uri);
	if (!uri.equals(ExtendedMetaData.XMI_URI) && !uri.equals(ExtendedMetaData.XML_SCHEMA_URI)
		&& !uri.equals(ExtendedMetaData.XSI_URI)) {
		namespaceURIs.add(uri);
	}
}