本文整理汇总了Java中org.eclipse.jdt.core.Signature.getSignatureQualifier方法的典型用法代码示例。如果您正苦于以下问题:Java Signature.getSignatureQualifier方法的具体用法?Java Signature.getSignatureQualifier怎么用?Java Signature.getSignatureQualifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.Signature
的用法示例。
在下文中一共展示了Signature.getSignatureQualifier方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAnonymousTypeLabel
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
private void createAnonymousTypeLabel(CompletionProposal proposal, CompletionItem item) {
char[] declaringTypeSignature= proposal.getDeclarationSignature();
declaringTypeSignature= Signature.getTypeErasure(declaringTypeSignature);
String name = new String(Signature.getSignatureSimpleName(declaringTypeSignature));
item.setInsertText(name);
StringBuilder buf= new StringBuilder();
buf.append(name);
buf.append('(');
appendUnboundedParameterList(buf, proposal);
buf.append(')');
buf.append(" "); //$NON-NLS-1$
buf.append("Anonymous Inner Type"); //TODO: consider externalization
item.setLabel(buf.toString());
if (proposal.getRequiredProposals() != null) {
char[] signatureQualifier= Signature.getSignatureQualifier(declaringTypeSignature);
if (signatureQualifier.length > 0) {
item.setDetail(String.valueOf(signatureQualifier));
}
}
setDeclarationSignature(item, String.valueOf(declaringTypeSignature));
}
示例2: createAnonymousTypeLabel
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
StyledString createAnonymousTypeLabel(CompletionProposal proposal) {
char[] declaringTypeSignature = proposal.getDeclarationSignature();
declaringTypeSignature = Signature.getTypeErasure(declaringTypeSignature);
StyledString buffer = new StyledString();
buffer.append(Signature.getSignatureSimpleName(declaringTypeSignature));
buffer.append('(');
appendUnboundedParameterList(buffer, proposal);
buffer.append(')');
buffer.append(" "); // $NON-NLS-1$
buffer.append(JavaTextMessages.ResultCollector_anonymous_type);
if (proposal.getRequiredProposals() != null) {
char[] signatureQualifier = Signature.getSignatureQualifier(declaringTypeSignature);
if (signatureQualifier.length > 0) {
buffer.append(JavaElementLabels.CONCAT_STRING, StyledString.QUALIFIER_STYLER);
buffer.append(signatureQualifier, StyledString.QUALIFIER_STYLER);
}
}
return Strings.markJavaElementLabelLTR(buffer);
}
示例3: isParsableSetter
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
/**
* Determines whether a setter's parameter signature can be parsed from an
* attribute based on the GWT AttributeParsers implementation.
*/
private boolean isParsableSetter(IMethod method) {
StringBuffer signature = new StringBuffer();
for (String paramType : method.getParameterTypes()) {
if (signature.length() > 0) {
signature.append(',');
}
String qualifier = Signature.getSignatureQualifier(paramType);
if (qualifier.length() > 0) {
signature.append(qualifier);
signature.append('.');
}
signature.append(Signature.getSignatureSimpleName(paramType));
}
return PARSABLE_ARGS.contains(signature.toString());
}
示例4: getQualifiedNameFromTypeSignature
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
public static String getQualifiedNameFromTypeSignature(String typeSignature, IType declaringType)
throws JavaModelException {
typeSignature = Signature.getTypeErasure(typeSignature);
String signatureQualifier = Signature.getSignatureQualifier(typeSignature);
String signatureSimpleName = Signature.getSignatureSimpleName(typeSignature);
String simpleName = signatureQualifier.isEmpty() ? signatureSimpleName
: signatureQualifier + '.' + signatureSimpleName;
// workaround https://bugs.eclipse.org/bugs/show_bug.cgi?id=494209.
boolean isArray = false;
if (simpleName.endsWith("[]")) {
isArray = true;
simpleName = simpleName.substring(0, simpleName.lastIndexOf('['));
}
String[][] allResults = declaringType.resolveType(simpleName);
String fullName = null;
if (allResults != null) {
String[] nameParts = allResults[0];
if (nameParts != null) {
StringBuilder fullNameBuilder = new StringBuilder();
for (String part : nameParts) {
if (fullNameBuilder.length() > 0)
fullNameBuilder.append('.');
if (part != null)
fullNameBuilder.append(part);
}
fullName = fullNameBuilder.toString();
}
} else
fullName = simpleName;
// workaround https://bugs.eclipse.org/bugs/show_bug.cgi?id=494209.
if (isArray)
fullName += "[]";
return fullName;
}
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:39,代码来源:Util.java
示例5: qualifySignature
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
/**
* Returns the qualified signature corresponding to <code>signature</code>.
*
* @param signature the signature to qualify
* @param context the type inside which an unqualified type will be resolved to find the
* qualifier, or <code>null</code> if no context is available
* @return the qualified signature
*/
public static String qualifySignature(final String signature, final IType context) {
if (context == null) return signature;
String qualifier = Signature.getSignatureQualifier(signature);
if (qualifier.length() > 0) return signature;
String elementType = Signature.getElementType(signature);
String erasure = Signature.getTypeErasure(elementType);
String simpleName = Signature.getSignatureSimpleName(erasure);
String genericSimpleName = Signature.getSignatureSimpleName(elementType);
int dim = Signature.getArrayCount(signature);
try {
String[][] strings = context.resolveType(simpleName);
if (strings != null && strings.length > 0) qualifier = strings[0][0];
} catch (JavaModelException e) {
// ignore - not found
}
if (qualifier.length() == 0) return signature;
String qualifiedType = Signature.toQualifiedName(new String[] {qualifier, genericSimpleName});
String qualifiedSignature = Signature.createTypeSignature(qualifiedType, true);
String newSignature = Signature.createArraySignature(qualifiedSignature, dim);
return newSignature;
}
示例6: getQualifiedTypeName
import org.eclipse.jdt.core.Signature; //导入方法依赖的package包/类
/**
* Extract the fully-qualified type name out of a type signature, with dots as
* package separators.
*/
public static String getQualifiedTypeName(String typeSignature) {
// Make sure we're using dots for package separator, not /'s
typeSignature = typeSignature.replace('/', '.');
String pckg = Signature.getSignatureQualifier(typeSignature);
String typeName = Signature.getSignatureSimpleName(typeSignature);
if (pckg == null || pckg.length() == 0) {
return typeName;
}
return pckg + "." + typeName;
}