本文整理汇总了Java中org.eclipse.emf.ecore.EStructuralFeature.isChangeable方法的典型用法代码示例。如果您正苦于以下问题:Java EStructuralFeature.isChangeable方法的具体用法?Java EStructuralFeature.isChangeable怎么用?Java EStructuralFeature.isChangeable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.EStructuralFeature
的用法示例。
在下文中一共展示了EStructuralFeature.isChangeable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInitialObjectNames
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的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: merge
import org.eclipse.emf.ecore.EStructuralFeature; //导入方法依赖的package包/类
private EObject merge(final EObject from, final EObject to, final Collection<Object> visitedObjects) {
if (null == from || null == to) {
return null;
}
// This is against cycles through EReferences.
if (visitedObjects.contains(from) || visitedObjects.contains(to)) {
return to;
}
visitedObjects.add(to);
visitedObjects.add(from);
final Collection<EStructuralFeature> fromFeatures = from.eClass().getEAllStructuralFeatures();
for (final EStructuralFeature feature : fromFeatures) {
if (-1 != to.eClass().getFeatureID(feature) && feature.isChangeable()) {
if (from.eIsSet(feature)) {
final Object fromValue = from.eGet(feature, true);
final Object toValue = to.eGet(feature, true);
if (null == toValue) {
to.eSet(feature, fromValue);
} else {
if (feature.isMany()) {
@SuppressWarnings("unchecked")
final Collection<Object> toManyValue = (Collection<Object>) toValue;
@SuppressWarnings("unchecked")
final Collection<Object> fromManyValue = (Collection<Object>) fromValue;
for (final Iterator<Object> itr = fromManyValue.iterator(); itr.hasNext(); /**/) {
final Object fromElement = itr.next();
if (!contains(toManyValue, fromElement)) {
itr.remove();
toManyValue.add(fromElement);
}
}
} else {
if (feature instanceof EAttribute) {
to.eSet(feature, fromValue);
} else if (feature instanceof EReference) {
to.eSet(feature, merge((EObject) fromValue, (EObject) toValue, visitedObjects));
}
}
}
}
}
}
return to;
}