本文整理汇总了Java中org.eclipse.emf.ecore.util.ExtendedMetaData类的典型用法代码示例。如果您正苦于以下问题:Java ExtendedMetaData类的具体用法?Java ExtendedMetaData怎么用?Java ExtendedMetaData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtendedMetaData类属于org.eclipse.emf.ecore.util包,在下文中一共展示了ExtendedMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInitialObjectNames
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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;
}
示例2: getInitialObjectNames
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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;
}
示例3: lazyMetamodelRegistration
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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;
}
示例4: getInitialObjectNames
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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;
}
示例5: hasChoiceOfValues
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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());
}
示例6: registerEPackageFromEcore
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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);
}
示例7: getInitialObjectNames
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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;
}
示例8: getValueLabel
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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);
}
示例9: fixEStructuralFeatures
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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);
}
}
}
示例10: eOpenGet
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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");
}
}
示例11: eOpenSet
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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");
}
}
示例12: eOpenUnset
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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");
}
}
示例13: eOpenIsSet
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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");
}
}
示例14: getFeatureMapEntryPrototype
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
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;
}
示例15: getInitialObjectNames
import org.eclipse.emf.ecore.util.ExtendedMetaData; //导入依赖的package包/类
/**
* 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;
}