本文整理汇总了Java中org.eclipse.emf.ecore.util.EcoreEList类的典型用法代码示例。如果您正苦于以下问题:Java EcoreEList类的具体用法?Java EcoreEList怎么用?Java EcoreEList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EcoreEList类属于org.eclipse.emf.ecore.util包,在下文中一共展示了EcoreEList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferenceParameter
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private static String getReferenceParameter(EPlanElement ePlanElement, EReferenceParameter eStructuralFeature) {
IItemPropertySource source = EMFUtils.adapt(ePlanElement, IItemPropertySource.class);
IItemPropertyDescriptor startPD = source.getPropertyDescriptor(ePlanElement, eStructuralFeature);
// First check the instance name
if (startPD != null) {
Object value = EMFUtils.getPropertyValue(startPD, ePlanElement);
if (value != null && StringifierRegistry.hasRegisteredStringifier(eStructuralFeature.getName())) {
IStringifier stringifier = StringifierRegistry.getStringifier(eStructuralFeature.getName());
return stringifier.getDisplayString(value);
}
if(value instanceof EcoreEList) {
List<String> valueList = new ArrayList<String>();
for (Object o : ((EcoreEList) value).toArray()) {
valueList.add(getChoiceText(eStructuralFeature, o));
}
return EEnumStringifier.formatString(valueList.toString());
}
}
return "";
}
示例2: execute
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, T object) {
if (list.getEStructuralFeature().isUnique() && list.contains(object)) {
return;
}
IUndoableOperation op = new FeatureTransactionAddOperation<T>(label, list, object);
IUndoContext context = TransactionUtils.getUndoContext(list);
if (context != null) {
op.addContext(context);
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.execute(op, null, null);
} catch (Exception e) {
LogUtil.error("execute", e);
}
}
}
示例3: FeatureTransactionRemoveAllOperation
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public FeatureTransactionRemoveAllOperation(String label, EcoreEList<T> list, List<T> objects) {
super(label);
this.list = list;
this.objects = objects;
int i = 0;
List<T> matches = new ArrayList<T>();
int matchIndex = -1;
for (T object : list) {
if (objects.contains(object)) {
matches.add(object);
if (matchIndex == -1) {
matchIndex = i;
}
} else if (matchIndex != -1) {
indexObjects.put(matchIndex, matches);
matches = new ArrayList<T>();
matchIndex = -1;
}
i++;
}
if (matchIndex != -1) {
indexObjects.put(matchIndex, matches);
matches = new ArrayList<T>();
matchIndex = -1;
}
}
示例4: execute
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, List<T> objects) {
boolean containsOne = false;
for (T item : list) {
if (objects.contains(item)) {
containsOne = true;
break;
}
}
if (!containsOne) {
return;
}
IUndoableOperation op = new FeatureTransactionRemoveAllOperation<T>(label, list, objects);
IUndoContext context = TransactionUtils.getUndoContext(list);
if (context != null) {
op.addContext(context);
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.execute(op, null, null);
} catch (Exception e) {
LogUtil.error("execute", e);
}
}
}
示例5: execute
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, List<T> objects) {
if (list.getEStructuralFeature().isUnique() && list.containsAll(objects)) {
return;
}
IUndoableOperation op = new FeatureTransactionAddAllOperation<T>(label, list, objects);
IUndoContext context = TransactionUtils.getUndoContext(list);
if (context != null) {
op.addContext(context);
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.execute(op, null, null);
} catch (Exception e) {
LogUtil.error("execute", e);
}
}
}
示例6: execute
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public static <T> void execute(String label, EcoreEList<T> list, T object) {
if (!list.contains(object)) {
return;
}
IUndoableOperation op = new FeatureTransactionRemoveOperation<T>(label, list, object);
IUndoContext context = TransactionUtils.getUndoContext(list);
if (context != null) {
op.addContext(context);
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.execute(op, null, null);
} catch (Exception e) {
LogUtil.error("execute", e);
}
}
}
示例7: suggestTogglingWaiverOfRuleForElement
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private void suggestTogglingWaiverOfRuleForElement(Set<Suggestion> suggestions, EPlanElement element) {
EcoreEList<String> oldRuleNames = RuleUtils.getWaivedRuleNames(element);
String name = rule.getName();
if (!oldRuleNames.contains(name)) {
String label;
IUndoableOperation operation;
String description;
if (RuleUtils.isWaived(element, rule)) {
label = "waive " + rule.getPrintName();
operation = new FeatureTransactionAddOperation<String>(label, oldRuleNames, name);
description = "Waive " + rule.getPrintName();
} else {
label = "unwaive " + rule.getPrintName();
operation = new FeatureTransactionRemoveOperation<String>(label, oldRuleNames, name);
description = "Unwaive " + rule.getPrintName();
}
if (element instanceof EPlan) {
description += " for this plan";
} else {
description += " for " + element.getName();
}
suggestions.add(new Suggestion(description, operation));
}
}
示例8: createAddConstraintSuggestion
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createAddConstraintSuggestion() {
IUndoableOperation operation = null;
if (constraint instanceof ProfileConstraint) {
EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
// Need to make a copy so it doesn't get removed from the template
ProfileConstraint constraintCopy = (ProfileConstraint) EMFUtils.copy(constraint);
operation = new FeatureTransactionAddOperation("Add Profile Constraint", currentConstraints, constraintCopy);
} else if (constraint instanceof BinaryTemporalConstraint) {
operation = new CreateTemporalRelationOperation((BinaryTemporalConstraint)constraint);
} else if (constraint instanceof PeriodicTemporalConstraint) {
operation = new CreateTemporalBoundOperation((PeriodicTemporalConstraint)constraint);
} else if (constraint instanceof TemporalChain) {
List<EPlanChild> linked = CommonUtils.castList(EPlanChild.class, ((TemporalChain)constraint).getElements());
operation = new ChainOperation(PlanStructureModifier.INSTANCE, linked, false);
}
if (operation != null) {
return new Suggestion(UPDATE_ACTIVITY_ICON, "Add Constraint to Plan", operation);
}
return null;
}
示例9: createRemoveConstraintSuggestion
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createRemoveConstraintSuggestion() {
IUndoableOperation operation = null;
if (constraint instanceof ProfileConstraint) {
EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
operation = new FeatureTransactionRemoveOperation("Remove Profile Constraint", currentConstraints, constraint);
} else if (constraint instanceof BinaryTemporalConstraint) {
operation = new DeleteTemporalRelationOperation((BinaryTemporalConstraint)constraint);
} else if (constraint instanceof PeriodicTemporalConstraint) {
operation = new DeleteTemporalBoundOperation((PeriodicTemporalConstraint)constraint);
} else if (constraint instanceof TemporalChain) {
operation = new UnchainOperation(((TemporalChain)constraint).getElements());
}
if (operation != null) {
return new Suggestion(UPDATE_ACTIVITY_ICON, "Remove Constraint from Plan", operation);
}
return null;
}
示例10: createModifyConstraintSuggestion
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
private Suggestion createModifyConstraintSuggestion() {
CompositeOperation operation = null;
if (constraint instanceof ProfileConstraint) {
operation = new CompositeOperation("Update Profile Constraint");
EcoreEList<ProfileConstraint> currentConstraints = (EcoreEList)target.getMember(ProfileMember.class).getConstraints();
for (ProfileConstraint currentConstraint : currentConstraints) {
if (similarProfileReferences(currentConstraint, (ProfileConstraint)constraint)) {
operation.add(new FeatureTransactionRemoveOperation("Remove Profile Constraint", currentConstraints, currentConstraint));
}
}
// Need to make a copy so it doesn't get removed from the template
ProfileConstraint constraintCopy = (ProfileConstraint) EMFUtils.copy(constraint);
operation.add(new FeatureTransactionAddOperation("Add Profile Constraint", currentConstraints, constraintCopy));
}
if (operation != null) {
return new Suggestion(UPDATE_ACTIVITY_ICON, "Update Constraint in Plan", operation);
}
return null;
}
示例11: getInsideLinkedRelations
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public EList<Relation> getInsideLinkedRelations() {
List<Relation> relations = new ArrayList<>();
for (Relation r : getLinkedRelations()) {
if (getContainer().equals(r.getContainer())) {
relations.add(r);
}
}
return new EcoreEList.UnmodifiableEList(this, TriqPackage.eINSTANCE.getPort_InsideLinkedRelations(), relations.size(), relations.toArray());
}
示例12: getOutsideLinkedRelations
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public EList<Relation> getOutsideLinkedRelations() {
List<Relation> relations = new ArrayList<>();
for (Relation r : getLinkedRelations()) {
if (getContainer().getContainer().equals(r.getContainer())) {
relations.add(r);
}
}
return new EcoreEList.UnmodifiableEList(this, TriqPackage.eINSTANCE.getPort_OutsideLinkedRelations(), relations.size(), relations.toArray());
}
示例13: editOnActivate
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
@Override
public boolean editOnActivate(DayResourceFacet facet, IUndoContext undoContext, TreeItem item, int index) {
Object element = facet.getElement();
if (element instanceof EActivity) {
EActivity activity = (EActivity) element;
EStructuralFeature feature = getFacetFeature(activity);
if (feature == null) {
return false;
}
String featureName = EMFUtils.getDisplayName(activity, feature);
IUndoableOperation operation = null;
if (feature.isMany()) {
EcoreEList value = (EcoreEList) (activity.getData().eGet(feature));
if (!value.contains(object)) {
operation = new FeatureTransactionAddOperation("add "+featureName, value, object);
} else {
operation = new FeatureTransactionRemoveOperation("remove "+featureName, value, object);
}
} else {
operation = new FeatureTransactionChangeOperation("change "+featureName, activity, feature, object);
}
CommonUtils.execute(operation, undoContext);
return true;
}
return false;
}
示例14: FeatureTransactionAddAllOperation
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
public FeatureTransactionAddAllOperation(String label, EcoreEList<T> list, List<T> objects) {
super(label);
this.list = list;
if (list.getEStructuralFeature().isUnique()) {
this.objects = new ArrayList<T>(objects);
this.objects.removeAll(list);
} else {
this.objects = objects;
}
}
示例15: toString
import org.eclipse.emf.ecore.util.EcoreEList; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder builder = new StringBuilder(Object.class.getSimpleName());
builder.append(":");
if (list instanceof EcoreEList) {
builder.append(((EcoreEList) list).getEStructuralFeature().getName());
builder.append(" on " + ((EcoreEList) list).getEObject());
}
builder.append(" remove ");
builder.append(String.valueOf(object));
return builder.toString();
}