本文整理汇总了Java中org.eclipse.xtext.naming.QualifiedName.getLastSegment方法的典型用法代码示例。如果您正苦于以下问题:Java QualifiedName.getLastSegment方法的具体用法?Java QualifiedName.getLastSegment怎么用?Java QualifiedName.getLastSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.naming.QualifiedName
的用法示例。
在下文中一共展示了QualifiedName.getLastSegment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClassifierReference
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
* Creates a resolved classifier reference. This means a classifier with a valid uri of its declaration.
*
* @param qualifiedName
* QualifiedName of the classifier
* @param uri
* Platform uri of the classifier declaration
*/
public ClassifierReference(QualifiedName qualifiedName, URI uri) {
this.classifierName = qualifiedName.getLastSegment();
List<String> frontSegments = qualifiedName.getSegments();
if (frontSegments.size() > 0) {
StringJoiner joiner = new StringJoiner(N4JSQualifiedNameConverter.DELIMITER);
for (String segment : frontSegments.subList(0, frontSegments.size() - 1)) {
joiner.add(segment);
}
this.classifierModuleSpecifier = joiner.toString();
} else {
this.classifierModuleSpecifier = "";
}
this.uri = uri;
}
示例2: getSingleLocalElementByName
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
* Returns description for given element, name is assumed to consist of a single segment containing the simple name
* of the member. If no subScope contains a member with given name, null is returned. In other error cases (no or
* wrong access, mixed types etc.), {@link IEObjectDescriptionWithError}, and in particular
* {@link UnionMemberDescriptionWithError}, will be returned.
*/
@Override
protected IEObjectDescription getSingleLocalElementByName(QualifiedName qualifiedName) {
String name = qualifiedName.getLastSegment();
TMember member = getOrCreateComposedMember(name);
if (member == null) { // no such member, no need for "merging" descriptions, there won't be any
return null;
}
if (isErrorPlaceholder(member)) {
return createComposedMemberDescriptionWithErrors(EObjectDescription.create(member.getName(), member));
}
IEObjectDescription description = getCheckedDescription(name, member);
return description;
}
示例3: addNewImportDeclaration
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
private AliasLocation addNewImportDeclaration(QualifiedName moduleName, QualifiedName qualifiedName,
String optionalAlias,
int insertionOffset, MultiTextEdit result) {
final String spacer = lazySpacer.get();
String syntacticModuleName = syntacticModuleName(moduleName);
AliasLocation aliasLocation = null;
String importSpec = (insertionOffset != 0 ? lineDelimiter : "") + "import ";
if (!N4JSLanguageUtils.isDefaultExport(qualifiedName)) { // not an 'default' export
importSpec = importSpec + "{" + spacer + qualifiedName.getLastSegment();
if (optionalAlias != null) {
importSpec = importSpec + " as ";
aliasLocation = new AliasLocation(insertionOffset, importSpec.length(), optionalAlias);
importSpec = importSpec + optionalAlias;
}
importSpec = importSpec + spacer + "}";
} else { // import default exported element
if (optionalAlias == null) {
importSpec = importSpec + N4JSLanguageUtils.lastSegmentOrDefaultHost(qualifiedName);
} else {
aliasLocation = new AliasLocation(insertionOffset, importSpec.length(), optionalAlias);
importSpec = importSpec + optionalAlias;
}
}
result.addChild(new InsertEdit(insertionOffset, importSpec + " from "
+ syntacticModuleName + ";"
+ (insertionOffset != 0 ? "" : lineDelimiter)));
return aliasLocation;
}
示例4: parseName
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
* Matches names following the test name convention.
*
* @return method, title, and case.
*/
@VisibleForTesting
static String[] parseName(QualifiedName methodName) {
Matcher matcher = TEST_NAME_PATTERN.matcher(methodName.getLastSegment());
if (!matcher.matches()) {
throw new IllegalArgumentException(
"Test name does not match naming convention: " + methodName.getLastSegment());
}
return new String[] {
matcher.group(1),
matcher.group(2),
matcher.group(3)
};
}
示例5: withoutPolyfillAsString
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
/**
* @param qualifiedName
* with {@code #POLY}-marker to be converted to a String without the polyfill-marker.
* @return string representation without polyfill marker
*/
public static String withoutPolyfillAsString(QualifiedName qualifiedName) {
// Assumption: 2nd-last segment is "!POLY"
String last = qualifiedName.getLastSegment();
String poly = qualifiedName.skipLast(1).getLastSegment();
assert(N4TSQualifiedNameProvider.POLYFILL_SEGMENT.equals(poly));
QualifiedName ret = qualifiedName.skipLast(2).append(last);
return ret.toString();
}
示例6: getMessage
import org.eclipse.xtext.naming.QualifiedName; //导入方法依赖的package包/类
@Override
public String getMessage() {
QualifiedName qualifiedName = getName();
String memberName = qualifiedName.getLastSegment();
return aliasOfMemberDefiningType == null
? IssueCodes.getMessageForVIS_ILLEGAL_STATIC_MEMBER_WRITE_ACCESS(memberDefTypeName, memberName)
: IssueCodes.getMessageForVIS_ILLEGAL_STATIC_MEMBER_WRITE_ACCESS_WITH_ALIAS(memberDefTypeName,
memberName,
aliasOfMemberDefiningType);
}