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


Java QualifiedName.create方法代码示例

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


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

示例1: getCheckedDescription

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
@Override
protected IEObjectDescription getCheckedDescription(String name, TMember member) {
	IEObjectDescription description = EObjectDescription.create(member.getName(), member);

	QualifiedName qn = QualifiedName.create(name);
	boolean allDescrWithError = true;
	for (IScope currSubScope : subScopes) {
		IEObjectDescription subDescription = currSubScope.getSingleElement(qn);
		boolean descrWithError = subDescription == null || subDescription instanceof IEObjectDescriptionWithError;
		allDescrWithError &= descrWithError;
	}
	if (allDescrWithError) {
		return createComposedMemberDescriptionWithErrors(description);
	}

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:IntersectionMemberScope.java

示例2: getCheckedDescription

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
@Override
protected IEObjectDescription getCheckedDescription(String name, TMember member) {
	IEObjectDescription description = EObjectDescription.create(member.getName(), member);

	QualifiedName qn = QualifiedName.create(name);
	for (IScope currSubScope : subScopes) {
		IEObjectDescription subDescription = currSubScope.getSingleElement(qn);

		boolean descrWithError = subDescription == null || subDescription instanceof IEObjectDescriptionWithError;
		if (descrWithError) {
			return createComposedMemberDescriptionWithErrors(description);
		}
	}

	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:UnionMemberScope.java

示例3: append

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
 * Null-safe appending of segments. If segment is null, null is returned. If prefix is null, a new qualified name
 * (with non-null segment) is created.
 */
protected static QualifiedName append(QualifiedName prefix, String segment) {
	if (segment == null) {
		return null;
	}
	if (prefix == null) {
		return QualifiedName.create(segment);
	}
	return prefix.append(segment);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4TSQualifiedNameProvider.java

示例4: prepend

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
 * Prefixing a qualified name. If the prefix segment is null, the suffix is returned, else if the suffix is null a
 * QN with only one segment is returned. Otherwise segment gets prefixed to suffix.
 */
protected static QualifiedName prepend(String segment, QualifiedName suffix) {
	if (segment == null) {
		return suffix;
	}
	QualifiedName qn = QualifiedName.create(segment);
	if (suffix != null) {
		qn = qn.append(suffix);
	}
	return qn;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:N4TSQualifiedNameProvider.java

示例5: getAliasedDescription

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
 * Creates proposal taking semantics of the N4JS imports into account.
 *
 * @param candidate
 *            the original input for which we create proposal
 * @param reference
 *            the reference
 * @param context
 *            the context
 * @return candidate proposal adjusted to the N4JS imports
 */
private IEObjectDescription getAliasedDescription(IEObjectDescription candidate, EReference reference,
		ContentAssistContext context) {

	// Content assist at a location where only simple names are allowed:
	// We found a qualified name and we'd need an import to be allowed to use
	// that name. Consider only the simple name of the element from the index
	// and make sure that the import is inserted as soon as the proposal is applied
	QualifiedName inputQN = candidate.getName();
	int inputNameSegmentCount = inputQN.getSegmentCount();
	if (reference == N4JSPackage.Literals.IDENTIFIER_REF__ID && inputNameSegmentCount > 1)
		return new AliasedEObjectDescription(QualifiedName.create(inputQN.getLastSegment()), candidate);

	// filter out non-importable things:
	// globally provided things should never be imported:
	if (inputNameSegmentCount == 2 && N4TSQualifiedNameProvider.GLOBAL_NAMESPACE_SEGMENT
			.equals(inputQN.getFirstSegment()))
		return new AliasedEObjectDescription(QualifiedName.create(inputQN.getLastSegment()), candidate);

	// special handling for default imports:
	if (inputQN.getLastSegment().equals(N4JSLanguageConstants.EXPORT_DEFAULT_NAME)) {
		EObject element = candidate.getEObjectOrProxy();
		if (element instanceof TExportableElement) {
			TExportableElement exported = (TExportableElement) element;
			if (N4JSLanguageConstants.EXPORT_DEFAULT_NAME.equals(exported.getExportedName())) {
				return new AliasedEObjectDescription(inputQN, candidate);
			}
		}
		// not accessed via namespace
		QualifiedName nameNoDefault = inputQN.skipLast(1);
		QualifiedName moduleName = nameNoDefault.getSegmentCount() > 1
				? QualifiedName.create(nameNoDefault.getLastSegment()) : nameNoDefault;
		return new AliasedEObjectDescription(moduleName, candidate);
	}
	// no special handling, return original input
	return candidate;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:48,代码来源:ImportsAwareReferenceProposalCreator.java

示例6: createTestSpecInfo

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
private SpecTestInfo createTestSpecInfo(String testeeName, Doclet doclet, TMember testMember,
		RepoRelativePath rrp) {
	return new SpecTestInfo(
			testeeName,
			QualifiedName.create(testMember.getContainingModule().getModuleSpecifier(),
					testMember.getContainingType().getName(), testMember.getName()),
			doclet,
			rrp != null ? rrp.withLine(testMember) : null);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:N4JSDReader.java

示例7: getMainModuleOfProject

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/** returns qualified name of the {@link IN4JSProject#getMainModule() } */
public static QualifiedName getMainModuleOfProject(IN4JSProject project) {
	if (project != null) {
		final String mainModuleSpec = project.getMainModule();
		if (mainModuleSpec != null) {
			final QualifiedName mainModuleQN = QualifiedName.create(
					mainModuleSpec.split(N4JSQualifiedNameConverter.DELIMITER));
			return mainModuleQN;
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:ImportSpecifierUtil.java

示例8: qualifiedName

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
protected QualifiedName qualifiedName(LaunchConfig config) {
    if (config.isQualify()) {
        if (config.getQualifierId() != null) {
            return QualifiedName.create(Splitter.on('.').splitToList(config.getQualifierId())).append(config.getName());
        }

        IFile f = ResourcesPlugin.getWorkspace().getRoot()
                .getFile(new Path(config.eResource().getURI().toPlatformString(true)));
        if (f != null && f.exists()) {
            return QualifiedName.create(Splitter.on('.').splitToList(f.getProject().getName())).append(config.getName());
        }
    }

    return QualifiedName.create(config.getName());
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:16,代码来源:LcDslQualifiedNameProvider.java

示例9: lookupCrossReference

import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
 * Retrieves possible reference targets from scope, including erroneous solutions (e.g., not visible targets). This
 * list is further filtered here. This is a general pattern: Do not change or modify scoping for special content
 * assist requirements, instead filter here.
 *
 * @param proposalFactory
 *            usually this will be an instance of
 *            {@link AbstractJavaBasedContentProposalProvider.DefaultProposalCreator DefaultProposalCreator}.
 * @param filter
 *            by default an instance of {@link N4JSCandidateFilter} will be provided here.
 */
@SuppressWarnings("javadoc")
public void lookupCrossReference(
		EObject model,
		EReference reference,
		ContentAssistContext context,
		ICompletionProposalAcceptor acceptor,
		Predicate<IEObjectDescription> filter,
		Function<IEObjectDescription, ICompletionProposal> proposalFactory) {
	if (model != null) {
		final IScope scope = ((IContentAssistScopeProvider) scopeProvider).getScopeForContentAssist(model,
				reference);

		// iterate over candidates, filter them, and create ICompletionProposals for them
		final Iterable<IEObjectDescription> candidates = scope.getAllElements();
		// don't use candidates.forEach since we want an early exit
		for (IEObjectDescription candidate : candidates) {
			if (!acceptor.canAcceptMoreProposals())
				return;
			if (filter.apply(candidate)) {
				QualifiedName qfn = candidate.getQualifiedName();
				String tmodule = null;

				if (qfn.getSegmentCount() >= 2) {
					tmodule = qfn.getSegment(qfn.getSegmentCount() - 2);
				}
				// In case of main module, adjust the qualified name, e.g. index.Element -> react.Element
				IN4JSProject project = n4jsCore.findProject(candidate.getEObjectURI()).orNull();
				QualifiedName candidateName;
				if (project != null && tmodule != null && tmodule.equals(project.getMainModule())) {
					candidateName = QualifiedName.create(project.getProjectId(),
							candidate.getQualifiedName().getLastSegment().toString());
				} else {
					candidateName = candidate.getQualifiedName();
				}

				final ICompletionProposal proposal = getProposal(candidate,
						model,
						scope,
						reference,
						context,
						filter,
						proposalFactory);
				if (proposal instanceof ConfigurableCompletionProposal
						&& candidate.getName().getSegmentCount() > 1) {
					ConfigurableCompletionProposal castedProposal = (ConfigurableCompletionProposal) proposal;
					castedProposal.setAdditionalData(FQNImporter.KEY_QUALIFIED_NAME,
							candidateName);
					// Original qualified name is the qualified name before adjustment
					castedProposal.setAdditionalData(FQNImporter.KEY_ORIGINAL_QUALIFIED_NAME,
							candidate.getQualifiedName());
				}
				acceptor.accept(proposal);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:68,代码来源:ImportsAwareReferenceProposalCreator.java


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