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


Java EObject.eIsProxy方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EObject.eIsProxy方法的典型用法代码示例。如果您正苦于以下问题:Java EObject.eIsProxy方法的具体用法?Java EObject.eIsProxy怎么用?Java EObject.eIsProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EObject的用法示例。


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

示例1: resolveType

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private EObject resolveType(final ParserRuleContext ruleContext, final EObject superType) {
    final EObject resolvedType;

    if (superType.eIsProxy()) {
        resolvedType = null;
    } else {
        resolvedType = create(superType.eClass(), ruleContext);
        EcoreUtil.replace(unresolved, resolvedType);

        final Token nameToken = ruleContext.getStart();
        final String name = nameToken.getText();
        final Scope typeScope = scope.with(resolvedType, TYPE_CONTAINER__TYPES);

        typeScope.with(IDENTIFIABLE_ELEMENT__NAME)
                .setValue(name, nameToken);

        typeScope.with(unresolved.eClass().getEStructuralFeature("type"))
                .setValue(superType, nameToken);
    }

    return resolvedType;
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:23,代码来源:TypeDeclarationResolver.java

示例2: isAccepted

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
protected boolean isAccepted(IEObjectDescription description) {
	EObject proxyOrInstance = description.getEObjectOrProxy();
	if (proxyOrInstance != null && !proxyOrInstance.eIsProxy()) {
		if (proxyOrInstance instanceof TMember) {
			TMember member = (TMember) proxyOrInstance;
			MemberVisibility result = checker.isVisible(context, receiverType, member);

			if (!result.visibility)
				this.accessModifierSuggestionStore.put(description.getEObjectURI().toString(),
						result.accessModifierSuggestion);

			return result.visibility;
		} else if (proxyOrInstance instanceof TEnumLiteral) {
			return checker.isEnumLiteralVisible(context, receiverType);
		}
	}
	return true;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:VisibilityAwareMemberScope.java

示例3: getActualReplacementString

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Return the to-be-inserted string if an existing import is present.
 */
@Override
public String getActualReplacementString(ConfigurableCompletionProposal proposal) {
	String syntacticReplacementString = proposal.getReplacementString();
	if (scope != null) {
		final QualifiedName qualifiedName = applyValueConverter(syntacticReplacementString);
		if (qualifiedName.getSegmentCount() == 1) {
			return syntacticReplacementString;
		}
		final IEObjectDescription element = scope.getSingleElement(qualifiedName);
		if (element != null) {
			EObject resolved = EcoreUtil.resolve(element.getEObjectOrProxy(), context);
			if (!resolved.eIsProxy()) {
				IEObjectDescription description = findApplicableDescription(resolved, qualifiedName, true);
				if (description != null) {
					String multisegmentProposal = applyValueConverter(description.getName());
					return multisegmentProposal;
				}
			}
		}
	}
	return syntacticReplacementString;

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:FQNImporter.java

示例4: isAccepted

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
protected boolean isAccepted(IEObjectDescription description) {
	EObject proxyOrInstance = description.getEObjectOrProxy();
	if (proxyOrInstance instanceof TVariable && !proxyOrInstance.eIsProxy()) {
		TVariable type = (TVariable) proxyOrInstance;

		TypeVisibility visibility = checker.isVisible(this.contextResource, type);

		if (!visibility.visibility) {
			this.accessModifierSuggestionStore.put(description.getEObjectURI().toString(),
					visibility.accessModifierSuggestion);
		}

		return visibility.visibility;
	}
	return super.isAccepted(description);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:VisibilityAwareIdentifiableScope.java

示例5: getDoc

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Get JSDoc comment for the given element. The element may be an AST node such as <code>N4MethodDeclaration</code>
 * or a type model element such as <code>TMethod</code>. In the latter case, this method will follow the link to the
 * AST which may cause a load of the N4JS resource if it is not fully loaded (i.e. if only the TModule was loaded
 * from the Xtext index).
 * <p>
 * Thus, <b>this method may have a side effect on the containing resource of the given element</b>. If that is not
 * desired, use method {@link #getDocSafely(ResourceSet, EObject)} instead.
 */
public String getDoc(EObject element) {
	if (element == null)
		throw new IllegalArgumentException("element must not be null");
	if (element.eIsProxy()) {
		return null;
		// throw new IllegalArgumentException("element must not be proxy: " + element.toString());
	}

	final List<INode> docNodes = documentationProviderExt.getDocumentationNodes(element);
	if (!docNodes.isEmpty()) {
		final StringBuilder sb = new StringBuilder(docNodes.get(0).getText());
		for (int idx = 1; idx < docNodes.size(); idx++) {
			sb.append("\n").append(docNodes.get(idx).getText());
		}
		return sb.toString();
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:N4JSDocHelper.java

示例6: provideHighlightingFor

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
public void provideHighlightingFor(XtextResource resource,
		org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor) {
	TreeIterator<EObject> allContents = resource.getAllContents();
	while (allContents.hasNext()) {
		EObject next = allContents.next();
		if (next.eIsProxy()) {
			continue;
		}
		if (next instanceof ElementReferenceExpression) {
			if (next instanceof ElementReferenceExpression) {
				ElementReferenceExpression expression = (ElementReferenceExpression) next;
				provideHighligtingFor(expression, acceptor);
			}
		}
	}
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:18,代码来源:SoliditySemanticHighlighter.java

示例7: assertNoDanglingReferences

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Asserts that root and the entire object tree below root does not contain any dangling references, i.e.
 * cross-references to target {@link EObject}s that are not contained in a {@link Resource}.
 */
public void assertNoDanglingReferences(EObject root) {
	final List<String> errMsgs = new ArrayList<>();
	final TreeIterator<EObject> iter = root.eAllContents();
	while (iter.hasNext()) {
		final EObject currObj = iter.next();
		if (currObj != null && !currObj.eIsProxy()) {
			for (EReference currRef : currObj.eClass().getEAllReferences()) {
				if (!currRef.isContainment() && !currRef.isContainer() && currRef.getEOpposite() == null) {
					if (currRef.isMany()) {
						@SuppressWarnings("unchecked")
						final EList<? extends EObject> targets = (EList<? extends EObject>) currObj.eGet(currRef,
								false);
						for (EObject currTarget : targets) {
							if (isDangling(currTarget)) {
								errMsgs.add(getErrorInfoForDanglingEObject(currObj, currRef));
								break;
							}
						}
					} else {
						final EObject target = (EObject) currObj.eGet(currRef, false);
						if (isDangling(target))
							errMsgs.add(getErrorInfoForDanglingEObject(currObj, currRef));
					}
				}
			}
		}
	}
	if (!errMsgs.isEmpty())
		fail("Expected no dangling references, but found the following: " + Joiner.on("; ").join(errMsgs) + ".");
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:35,代码来源:N4JSValidationTestHelper.java

示例8: linkedPathname

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Similar to {@link #linkedName(IStringExpectation, ICrossEReferenceAndEObject)} but concatenating the fully
 * qualified name again instead of using the qualified name provider, as the latter may not create a valid name for
 * non-globally available elements.
 * <p>
 * The qualified name created by retrieving all "name" properties of the target and its containers, using '/' as
 * separator.
 */
@Xpect
@ParameterParser(syntax = "('at' arg1=OFFSET)?")
public void linkedPathname(@StringExpectation IStringExpectation expectation,
		ICrossEReferenceAndEObject arg1) {
	EObject targetObject = (EObject) arg1.getEObject().eGet(arg1.getCrossEReference());
	if (targetObject == null) {
		Assert.fail("Reference is null");
		return; // to avoid warnings in the following
	}
	if (targetObject.eIsProxy())
		Assert.fail("Reference is a Proxy: " + ((InternalEObject) targetObject).eProxyURI());
	Resource targetResource = targetObject.eResource();
	if (targetResource instanceof TypeResource)
		targetResource = arg1.getEObject().eResource();
	if (!(targetResource instanceof XtextResource))
		Assert.fail("Referenced EObject is not in an XtextResource.");

	Deque<String> segments = new ArrayDeque<>();
	do {
		EStructuralFeature nameFeature = targetObject.eClass().getEStructuralFeature("name");
		if (nameFeature != null) {
			Object obj = targetObject.eGet(nameFeature);
			if (obj instanceof String) {
				segments.push((String) obj);
			}
		} else {
			if (targetObject instanceof NamedElement) {
				segments.push(((NamedElement) targetObject).getName());
			}
		}
		targetObject = targetObject.eContainer();
	} while (targetObject != null);
	String pathname = Joiner.on('/').join(segments);
	expectation.assertEquals(pathname);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:44,代码来源:LinkingXpectMethod.java

示例9: loadTClass

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private Optional<TClass> loadTClass(final ResourceSet resSet, final IEObjectDescription objDesc) {
	if (T_CLASS.isSuperTypeOf(objDesc.getEClass())) {
		final EObject objectOrProxy = objDesc.getEObjectOrProxy();
		final EObject object = objectOrProxy.eIsProxy() ? EcoreUtil.resolve(objectOrProxy, resSet) : objectOrProxy;
		if (!object.eIsProxy()) {
			return fromNullable((TClass) object);
		}
	}
	return absent();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:TestDiscoveryHelper.java

示例10: getText

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
public String getText(Object element) {
	if (element instanceof ImportableObject) {
		ImportableObject io = (ImportableObject) element;
		return getText(io.getTe());
	}
	if (element instanceof ImportProvidedElement) {
		ImportProvidedElement ele = ((ImportProvidedElement) element);
		TModule tm = ((ImportDeclaration) ele.importSpec.eContainer()).getModule();
		return ele.localname + " from " + findLocation(tm);
	}
	if (element instanceof IEObjectDescription) {
		IEObjectDescription ieod = (IEObjectDescription) element;
		EObject eo = ieod.getEObjectOrProxy();

		if (eo instanceof TExportableElement && !eo.eIsProxy()) {
			return getText(eo);
		}
		return ieod.getName().getLastSegment() + " from "
				+ qualifiedNameConverter.toString(ieod.getName().skipLast(1));
	}
	if (element instanceof TExportableElement) {
		TExportableElement te = (TExportableElement) element;
		return te.getName() + " (exported as " + te.getExportedName() + ") from "
				+ findLocation(te.getContainingModule());
	}

	return n4Labelprovider.getText(element);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:ImportProvidedElementLabelprovider.java

示例11: visitTypeDeclarationFacet

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
public Object visitTypeDeclarationFacet(final RAMLParser.TypeDeclarationFacetContext typeDeclarationFacet) {
    final EObject eObject = (EObject) super.visitTypeDeclarationFacet(typeDeclarationFacet);
    if (eObject == null || eObject.eIsProxy()) {
        unresolvedTypeDeclarations.put(typeDeclarationFacet, eObject);
    } else {
        unresolvedTypeDeclarations.remove(typeDeclarationFacet);
    }
    return eObject;
}
 
开发者ID:vrapio,项目名称:rest-modeling-framework,代码行数:11,代码来源:TypeDeclarationResolver.java

示例12: getNode

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@Override
public Node getNode(Object element) {
	final String type;
	final String name;
	final String desc;
	if (element instanceof Resource) {
		// case: Resource
		final URI uri = ((Resource) element).getURI();
		type = "Resource";
		name = uri != null ? uri.lastSegment() : null;
		desc = null;
	} else if (element instanceof EObject) {
		final EObject eobj = (EObject) element;
		if (eobj.eIsProxy()) {
			// case: proxy
			type = "PROXY(" + eobj.eClass().getName() + ")";
			name = null;
			desc = "proxy URI:\n" + EcoreUtil.getURI(eobj);
		} else {
			// case: non-proxy EObject
			type = eobj.eClass().getName();
			name = getName(eobj);
			desc = getDescription(eobj);
		}
	} else {
		// case: any POJO
		type = element.getClass().getSimpleName();
		name = null;
		desc = null;
	}
	final String title = type + (name != null ? " " + name : "");
	return new Node(element, title, desc);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:34,代码来源:ASTGraphProvider.java

示例13: findMemberInSubScope

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Searches for a member of the given name and for the given access in the sub-scope with index 'subScopeIdx'.
 */
private TMember findMemberInSubScope(IScope subScope, String name) {
	final IEObjectDescription currElem = subScope.getSingleElement(QualifiedName.create(name));
	if (currElem != null) {
		final EObject objOrProxy = currElem.getEObjectOrProxy();
		if (objOrProxy != null && !objOrProxy.eIsProxy() && objOrProxy instanceof TMember) {
			final TMember currM = (TMember) objOrProxy;
			return currM;
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:ComposedMemberScope.java

示例14: discardAST

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
/**
 * Discard the AST and proxify all referenced nodes. Does nothing if the AST is already unloaded.
 */
private void discardAST() {
	EObject script = getScript();
	if (script != null && !script.eIsProxy()) {

		// Create a proxy for the AST.
		InternalEObject scriptProxy = (InternalEObject) EcoreUtil.create(script.eClass());
		scriptProxy.eSetProxyURI(EcoreUtil.getURI(script));

		TModule module = null;
		ModuleAwareContentsList theContents = (ModuleAwareContentsList) contents;
		if (isFullyInitialized()) {
			module = getModule();
			if (module != null && !module.eIsProxy()) {
				proxifyASTReferences(module);
				module.setAstElement(scriptProxy);
			}
		}

		// Unload the AST.
		unloadElements(theContents.subList(0, 1));

		theContents.sneakyClear();

		if (module != null) {
			theContents.sneakyAdd(scriptProxy);
			theContents.sneakyAdd(module);
		} else {
			// there was no module (not even a proxy)
			// -> don't add the script proxy
			// (i.e. transition from resource load state "Loaded" to "Created", not to "Loaded from Description")
		}

		// Clear AST meta cache and Xtext cache
		this.setASTMetaInfoCache(null);
		getCache().clear(this);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:41,代码来源:N4JSResource.java

示例15: proxifyASTReferences

import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private void proxifyASTReferences(EObject object) {
	if (object instanceof SyntaxRelatedTElement) {
		SyntaxRelatedTElement element = (SyntaxRelatedTElement) object;
		EObject astElement = element.getAstElement();
		if (astElement != null && !astElement.eIsProxy()) {
			InternalEObject proxy = (InternalEObject) EcoreUtil.create(astElement.eClass());
			proxy.eSetProxyURI(EcoreUtil.getURI(astElement));
			element.setAstElement(proxy);
		}
	}

	for (EObject child : object.eContents()) {
		proxifyASTReferences(child);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:N4JSResource.java


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