本文整理汇总了Java中org.eclipse.jdt.core.IField.isResolved方法的典型用法代码示例。如果您正苦于以下问题:Java IField.isResolved方法的具体用法?Java IField.isResolved怎么用?Java IField.isResolved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IField
的用法示例。
在下文中一共展示了IField.isResolved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendFieldLabel
import org.eclipse.jdt.core.IField; //导入方法依赖的package包/类
/**
* Appends the style label for a field. Considers the F_* flags.
*
* @param field the element to render
* @param flags the rendering flags. Flags with names starting with 'F_' are considered.
*/
public void appendFieldLabel(IField field, long flags) {
try {
if (getFlag(flags, JavaElementLabels.F_PRE_TYPE_SIGNATURE) && field.exists() && !Flags.isEnum(field.getFlags())) {
if (getFlag(flags, JavaElementLabels.USE_RESOLVED) && field.isResolved()) {
appendTypeSignatureLabel(field, new BindingKey(field.getKey()).toSignature(), flags);
} else {
appendTypeSignatureLabel(field, field.getTypeSignature(), flags);
}
fBuilder.append(' ');
}
// qualification
if (getFlag(flags, JavaElementLabels.F_FULLY_QUALIFIED)) {
appendTypeLabel(field.getDeclaringType(), JavaElementLabels.T_FULLY_QUALIFIED | (flags & QUALIFIER_FLAGS));
fBuilder.append('.');
}
fBuilder.append(getElementName(field));
if (getFlag(flags, JavaElementLabels.F_APP_TYPE_SIGNATURE) && field.exists() && !Flags.isEnum(field.getFlags())) {
fBuilder.append(JavaElementLabels.DECL_STRING);
if (getFlag(flags, JavaElementLabels.USE_RESOLVED) && field.isResolved()) {
appendTypeSignatureLabel(field, new BindingKey(field.getKey()).toSignature(), flags);
} else {
appendTypeSignatureLabel(field, field.getTypeSignature(), flags);
}
}
// post qualification
if (getFlag(flags, JavaElementLabels.F_POST_QUALIFIED)) {
fBuilder.append(JavaElementLabels.CONCAT_STRING);
appendTypeLabel(field.getDeclaringType(), JavaElementLabels.T_FULLY_QUALIFIED | (flags & QUALIFIER_FLAGS));
}
} catch (JavaModelException e) {
JavaLanguageServerPlugin.logException("", e); // NotExistsException will not reach this point
}
}
示例2: createVariable
import org.eclipse.jdt.core.IField; //导入方法依赖的package包/类
public Variable createVariable(
IJavaElement element, IType enclosingType, String expectedType, int positionScore)
throws JavaModelException {
int variableType;
int elementType = element.getElementType();
String elementName = element.getElementName();
String typeSignature;
switch (elementType) {
case IJavaElement.FIELD:
{
IField field = (IField) element;
if (field.getDeclaringType().equals(enclosingType)) {
variableType = Variable.FIELD;
} else {
variableType = Variable.INHERITED_FIELD;
}
if (field.isResolved()) {
typeSignature = new BindingKey(field.getKey()).toSignature();
} else {
typeSignature = field.getTypeSignature();
}
break;
}
case IJavaElement.LOCAL_VARIABLE:
{
ILocalVariable locVar = (ILocalVariable) element;
variableType = Variable.LOCAL;
typeSignature = locVar.getTypeSignature();
break;
}
case IJavaElement.METHOD:
{
IMethod method = (IMethod) element;
if (isMethodToSuggest(method)) {
if (method.getDeclaringType().equals(enclosingType)) {
variableType = Variable.METHOD;
} else {
variableType = Variable.INHERITED_METHOD;
}
if (method.isResolved()) {
typeSignature =
Signature.getReturnType(new BindingKey(method.getKey()).toSignature());
} else {
typeSignature = method.getReturnType();
}
elementName = elementName + "()"; // $NON-NLS-1$
} else {
return null;
}
break;
}
default:
return null;
}
String type = Signature.toString(typeSignature);
boolean isAutoboxMatch = isPrimitiveType(expectedType) != isPrimitiveType(type);
return new Variable(
type,
elementName,
variableType,
isAutoboxMatch,
positionScore,
NO_TRIGGERS,
getImageDescriptor(element));
}