当前位置: 首页>>代码示例>>Java>>正文


Java EcoreEList类代码示例

本文整理汇总了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 "";
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:TooltipShellBuilder.java

示例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);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionAddOperation.java

示例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;
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:27,代码来源:FeatureTransactionRemoveAllOperation.java

示例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);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:FeatureTransactionRemoveAllOperation.java

示例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);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionAddAllOperation.java

示例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);
	    }
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:FeatureTransactionRemoveOperation.java

示例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));
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:FlightRuleViolation.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:PlanDiffViolation.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:PlanDiffViolation.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:PlanDiffViolation.java

示例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());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:16,代码来源:PortImpl.java

示例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());
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:16,代码来源:PortImpl.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:DayResourceColumn.java

示例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;
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:11,代码来源:FeatureTransactionAddAllOperation.java

示例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();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:13,代码来源:FeatureTransactionRemoveOperation.java


注:本文中的org.eclipse.emf.ecore.util.EcoreEList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。