本文整理匯總了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;
}