當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。