本文整理汇总了Java中org.eclipse.emf.ecore.change.ChangeKind类的典型用法代码示例。如果您正苦于以下问题:Java ChangeKind类的具体用法?Java ChangeKind怎么用?Java ChangeKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeKind类属于org.eclipse.emf.ecore.change包,在下文中一共展示了ChangeKind类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
@Override
void execute() {
ListChange listChange = null;
if (newElement instanceof BinaryTemporalConstraint){
listChange = createListFeatureChange(ChangeKind.ADD_LITERAL, position, (EObject)newElement);
addToChangeDescription(parent, featureOfElement, listChange, changeDescription2);
}
else if(newElement instanceof TemporalChain){
FeatureChange featureChange = createFeatureChange(parent, featureOfElement, newElement);
addToChangeDescription(parent, featureOfElement, featureChange, changeDescription2);
}
else {
listChange = createListFeatureChange(ChangeKind.ADD_LITERAL, position, (EObject)newElement);
addToChangeDescription(parent, featureOfElement, listChange, changeDescription1);
}
}
示例2: createRemoveFromListFeatureChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
/** For completion. To ensure a proper FeatureChange use <i>createFeatureChange()</i> methods.
* @param target
* @param feature
* @param indexToRemove
* @return
*/
public static FeatureChange createRemoveFromListFeatureChange(EObject target, EStructuralFeature feature, int indexToRemove) {
Object value = target.eGet(feature);
FeatureChange fc = null;
if(value instanceof List) {
if ((((List) value).size() - 1) < indexToRemove)
return null;
fc = factory.createFeatureChange(feature, value, false);
EObject object = (EObject) ((List) value).get(indexToRemove);
ListChange listChange = createListFeatureChange(ChangeKind.REMOVE_LITERAL, indexToRemove, object);
fc.getListChanges().add(listChange);
}
return fc;
}
示例3: processFeatureChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
protected static void processFeatureChange(EObject affectedObj, FeatureChange fc, String prefix) {
System.err.println(prefix + "Feature change on feature " + fc.getFeatureName());
System.err.println("\t Target value: " + fc.getValue());
System.err.println("\tRollback value: " + affectedObj.eGet(fc.getFeature()));
for (ListChange lc : fc.getListChanges()) {
if (lc.getKind() == ChangeKind.ADD_LITERAL) {
System.err.println(prefix + "\t - Adding Children: " + lc.getValues());
}
else if (lc.getKind() == ChangeKind.REMOVE_LITERAL) {
System.err.println(prefix + "\t - Deleting Children: " + lc.getValues());
}
}
}
示例4: createAddListChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
protected ListChange createAddListChange(EStructuralFeature feature, Object newObject, int index) {
if (index < 0 || index > aggregatingSize) {
throw new ArrayIndexOutOfBoundsException(index);
}
ListChange listChange = createListChange(ChangeKind.ADD_LITERAL, index);
listChange.setFeature(feature);
if (feature instanceof EAttribute) {
listChange.getValues().add(newObject);
} else {
listChange.getReferenceValues().add((EObject) newObject);
}
aggregatingSize++;
getListChanges().add(listChange);
return listChange;
}
示例5: createListFeatureChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
/** This method creates a ListChange with the proper ChangeKind, index and referenced object.
*
* @param kind - ChangeKind (ADD or REMOVE)
* @param index - where the change is going to happen
* @param object - object to ADD or REMOVE
* @return ListChange
*/
public static ListChange createListFeatureChange(ChangeKind kind, int index, EObject object) {
ListChange listChange = factory.createListChange();
listChange.setKind(kind);
listChange.getReferenceValues().add(object);
listChange.setIndex(index);
return listChange;
}
示例6: createAddToListFeatureChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
/** For completion. To ensure a proper FeatureChange use <i>createFeatureChange()</i> methods.
* @param target
* @param feature
* @param objectToAdd
* @param whereToAdd
* @return
*/
public static FeatureChange createAddToListFeatureChange(EObject target, EStructuralFeature feature, EObject objectToAdd, int whereToAdd) {
Object value = target.eGet(feature);
FeatureChange fc = null;
if(value instanceof List) {
if ((((List) value).size() - 1) < whereToAdd)
whereToAdd = ((List) value).size();
fc = factory.createFeatureChange(feature, value, true);
ListChange listChange = createListFeatureChange(ChangeKind.ADD_LITERAL, whereToAdd, objectToAdd);
fc.getListChanges().add(listChange);
}
return fc;
}
示例7: createRemoveListChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
protected ListChange createRemoveListChange(int index) {
ListChange listChange = createListChange(ChangeKind.REMOVE_LITERAL, index);
getListChanges().add(listChange);
aggregatingSize--;
return listChange;
}
示例8: createMoveListChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
protected ListChange createMoveListChange(int index, int toIndex) {
ListChange listChange = createListChange(ChangeKind.MOVE_LITERAL, index);
listChange.setMoveToIndex(toIndex);
getListChanges().add(listChange);
return listChange;
}
示例9: createListChange
import org.eclipse.emf.ecore.change.ChangeKind; //导入依赖的package包/类
protected static ListChange createListChange(ChangeKind kind, int index) {
ListChange listChange = ChangeFactory.eINSTANCE.createListChange();
listChange.setKind(kind);
listChange.setIndex(index);
return listChange;
}