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


Java Setting类代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EStructuralFeature.Setting的典型用法代码示例。如果您正苦于以下问题:Java Setting类的具体用法?Java Setting怎么用?Java Setting使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Setting类属于org.eclipse.emf.ecore.EStructuralFeature包,在下文中一共展示了Setting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isLocallyUsed

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected boolean isLocallyUsed(EObject target, EObject containerToFindUsage) {
	if (readAndWriteTracking.isRead(target)) {
		return true;
	}
	Collection<Setting> usages = XbaseUsageCrossReferencer.find(target, containerToFindUsage);
	// for non-private members it is enough to check that there are usages
	if (!(target instanceof JvmOperation) || ((JvmOperation)target).getVisibility()!=JvmVisibility.PRIVATE) {
		return !usages.isEmpty();
	} else {
		// for private members it has to be checked if all usages are within the operation
		EObject targetSourceElem = associations.getPrimarySourceElement(target);
		for (Setting s : usages) {
			if (s.getEObject() instanceof XAbstractFeatureCall) {
				XAbstractFeatureCall fc = (XAbstractFeatureCall) s.getEObject();
				// when the feature call does not call itself or the call is
				// from another function, then it is locally used
				if (fc.getFeature() != target || !EcoreUtil.isAncestor(targetSourceElem, fc))
					return true;
			} else {
				return true;
			}
		}
		return false;
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:XbaseValidator.java

示例2: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, de.darwinspl.preferences.resource.dwprofile.ui.DwprofilePositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:DwprofileOccurrence.java

示例3: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionPositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HyexpressionOccurrence.java

示例4: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaPositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HyvalidityformulaOccurrence.java

示例5: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavaluePositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HydatavalueOccurrence.java

示例6: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingPositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HymappingOccurrence.java

示例7: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsPositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HyconstraintsOccurrence.java

示例8: addAnnotationsForReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
protected void addAnnotationsForReferences(EObject referencedElement, List<String> matchingNames) {
	
	IDocument document = getSourceViewer().getDocument();
	
	// Determine all references to the EObject
	Map<EObject, Collection<Setting>> map = EcoreUtil.UsageCrossReferencer.find(Collections.singleton(textResource));
	Collection<Setting> referencingObjects = map.get(referencedElement);
	if (referencingObjects == null) {
		// No references found
		return;
	}
	
	// Highlight the token in the text for the referencing objects
	for (Setting setting : referencingObjects) {
		EObject referencingElement = setting.getEObject();
		// Search through all tokens in the elements that reference the element at the
		// caret position
		for (String name : matchingNames) {
			int index = getIndexOf(referencingElement, name);
			if (index > 0) {
				addAnnotation(document, eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestPositionCategory.PROXY, name, index, name.length());
			}
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:26,代码来源:HymanifestOccurrence.java

示例9: findFieldReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
public List<Method> findFieldReferences(IResourceDescriptions descriptions, Class element){
	List<Method> usages = new ArrayList<Method>();
	Iterable<IEObjectDescription> exportedObjectsByType = descriptions.getExportedObjectsByType(element.eClass());
	final ArrayList<EObject> gather = new ArrayList<>();

	exportedObjectsByType.forEach((e) -> {
		EObject eObjectOrProxy = e.getEObjectOrProxy();
		EObject resolve = EcoreUtil.resolve(eObjectOrProxy, element);
		gather.add(resolve);
	});

	element.getFields().listIterator().forEachRemaining((a) -> {
		Collection<Setting> references = EcoreUtil.UsageCrossReferencer.find(a, gather);
		references.forEach((f) -> {
			usages.add((Method) f.getEObject().eContainer());
		});
	});
	return usages;
}
 
开发者ID:ioanaverebi,项目名称:Sparrow,代码行数:20,代码来源:CrossReferenceResolver.java

示例10: adapt

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
@Override
protected Object adapt(Object element) {
	final Object res;

	final EObject eObject = IdeMappingUtils.adapt(element, EObject.class);
	if (eObject != null) {
		res = eObject;
	} else {
		final Setting setting = IdeMappingUtils.adapt(element, Setting.class);
		if (setting != null) {
			res = setting;
		} else {
			res = super.adapt(element);
		}
	}

	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:19,代码来源:IdeEObjectConnector.java

示例11: getName

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see org.eclipse.mylyn.docs.intent.mapping.connector.IConnector#getName(org.eclipse.mylyn.docs.intent.mapping.base.ILocation)
 */
public String getName(ILocation location) {
	final String res;

	final Object element = getElement(location);
	if (element instanceof Setting) {
		final Setting setting = (Setting)element;
		res = getName(setting.getEObject(), setting.getEStructuralFeature(), ((IEObjectLocation)location)
				.getIndex());
	} else if (element instanceof EObject) {
		res = getName((EObject)element, null, 0);
	} else {
		// the located element has been deleted...
		res = null;
	}

	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:23,代码来源:EObjectConnector.java

示例12: findCrossReferenceResource

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
private Set<Resource> findCrossReferenceResource(Resource resource) {
    if (tempSet.contains(resource)) {
        return Collections.emptySet();
    }
    tempSet.add(resource);
    
    Set<Resource> unloadResourceList = new LinkedHashSet<Resource>();

    Map<EObject, Collection<Setting>> find = EcoreUtil.CrossReferencer.find(resource.getContents());

    for (Iterator<?> iterator = find.keySet().iterator(); iterator.hasNext();) {
        EObject type = (EObject) iterator.next();
        if (ProjectUtil.isModelFile(type.eResource())) {
            unloadResourceList.add(type.eResource());
            
            Set<Resource> referenceResource = findCrossReferenceResource(resource);
            if(!referenceResource.isEmpty()) {
                unloadResourceList.addAll(referenceResource);
            }
        }
    }

    return unloadResourceList;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:ResourceUnloader.java

示例13: pruneDanglingReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
private void pruneDanglingReferences(final EPlan plan) {
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		@SuppressWarnings("unchecked")
		public void run() {
			Map<EObject, Collection<Setting>> proxiesMap = UnresolvedProxyCrossReferencer.find(plan);
			for (EObject proxy : proxiesMap.keySet()) {
				for (Setting setting : proxiesMap.get(proxy)) {
					EStructuralFeature feature = setting.getEStructuralFeature();
					if (feature instanceof EReference) {
						Object newValue = null;
						if (feature.isMany()) {
							newValue = new ArrayList((Collection)setting.get(true));
							((Collection)newValue).remove(proxy);
						}
						setting.set(newValue);
					}
				}
			}
		}
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:PlanEditorModel.java

示例14: deleteIncomingCrossReferencesFromParent

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
/**
 * Delete the given incoming cross references to the given model element from any
 * other model element in the given project.
 * 
 * @param inverseReferences a collection of inverse references
 * @param modelElement
 *            the model element
 */
public static void deleteIncomingCrossReferencesFromParent(Collection<Setting> inverseReferences,
	EObject modelElement) {
	for (final Setting setting : inverseReferences) {
		final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature();
		final EReference reference = (EReference) eStructuralFeature;

		if (reference.isContainer() || reference.isContainment() || !reference.isChangeable()) {
			continue;
		}

		final EObject opposite = setting.getEObject();

		if (eStructuralFeature.isMany()) {
			((EList<?>) opposite.eGet(eStructuralFeature)).remove(modelElement);
		} else {
			if (opposite instanceof Map.Entry<?, ?> && eStructuralFeature.getName().equals("key")) {
				logWarning("Incoming cross reference for model element " + modelElement + " is a map key.");
			}

			opposite.eUnset(eStructuralFeature);
		}
	}
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:32,代码来源:ModelUtil.java

示例15: deleteOutgoingCrossReferences

import org.eclipse.emf.ecore.EStructuralFeature.Setting; //导入依赖的package包/类
/**
 * Delete all outgoing cross references of the given model element to any element in the given collection.
 * 
 * @param collection the collection
 * @param modelElement
 *            the model element
 */
public static void deleteOutgoingCrossReferences(IdEObjectCollection collection, EObject modelElement) {
	final Set<EObject> allModelElements = new LinkedHashSet<EObject>();
	allModelElements.add(modelElement);
	allModelElements.addAll(ModelUtil.getAllContainedModelElements(modelElement, false));

	final List<SettingWithReferencedElement> crossReferences = collectOutgoingCrossReferences(collection,
		allModelElements);
	for (final SettingWithReferencedElement settingWithReferencedElement : crossReferences) {
		final Setting setting = settingWithReferencedElement.getSetting();
		if (!settingWithReferencedElement.getSetting().getEStructuralFeature().isMany()) {
			setting.getEObject().eUnset(setting.getEStructuralFeature());
		} else {
			final List<?> references = (List<?>) setting.getEObject().eGet(setting.getEStructuralFeature());
			references.remove(settingWithReferencedElement.getReferencedElement());
		}
	}
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:25,代码来源:ModelUtil.java


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