本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JavaModelUtil.isInterfaceOrAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModelUtil.isInterfaceOrAnnotation方法的具体用法?Java JavaModelUtil.isInterfaceOrAnnotation怎么用?Java JavaModelUtil.isInterfaceOrAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JavaModelUtil
的用法示例。
在下文中一共展示了JavaModelUtil.isInterfaceOrAnnotation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustOutgoingVisibility
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
* Adjusts the visibility of the referenced body declaration.
*
* @param member the member where to adjust the visibility
* @param threshold the visibility keyword representing the required visibility, or <code>null</code> for default visibility
* @param template the message template to use
* @throws JavaModelException if an error occurs
*/
private void adjustOutgoingVisibility(final IMember member, final ModifierKeyword threshold, final String template) throws JavaModelException {
Assert.isTrue(!member.isBinary() && !member.isReadOnly());
boolean adjust= true;
final IType declaring= member.getDeclaringType();
if (declaring != null && (JavaModelUtil.isInterfaceOrAnnotation(declaring)
|| (member instanceof IField) && Flags.isEnum(member.getFlags())
|| declaring.equals(fReferenced)))
adjust= false;
if (adjust && hasLowerVisibility(member.getFlags(), keywordToVisibility(threshold)) && needsVisibilityAdjustment(member, threshold))
fAdjustments.put(member, new OutgoingMemberVisibilityAdjustment(member, threshold, RefactoringStatus.createStatus(fVisibilitySeverity, Messages.format(template, new String[] { JavaElementLabels.getTextLabel(member, JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.ALL_FULLY_QUALIFIED), getLabel(threshold)}), JavaStatusContext.create(member), null, RefactoringStatusEntry.NO_CODE, null)));
}
示例2: getAllConstructors
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
public static IMethod[] getAllConstructors(IType type) throws JavaModelException {
if (JavaModelUtil.isInterfaceOrAnnotation(type))
return new IMethod[0];
List<IMethod> result= new ArrayList<IMethod>();
IMethod[] methods= type.getMethods();
for (int i= 0; i < methods.length; i++) {
IMethod iMethod= methods[i];
if (iMethod.isConstructor())
result.add(iMethod);
}
return result.toArray(new IMethod[result.size()]);
}
示例3: confirmAbstract
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static boolean confirmAbstract(IMember element) throws JavaModelException {
// never show the abstract symbol on interfaces
if (element.getElementType() == IJavaElement.TYPE) {
return ! JavaModelUtil.isInterfaceOrAnnotation((IType) element);
}
return true;
}
示例4: isInterfaceOrAnnotationField
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static boolean isInterfaceOrAnnotationField(IMember element) throws JavaModelException {
// always show the final symbol on interface fields
if (element.getElementType() == IJavaElement.FIELD) {
return JavaModelUtil.isInterfaceOrAnnotation(element.getDeclaringType());
}
return false;
}
示例5: isInterfaceOrAnnotationFieldOrType
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static boolean isInterfaceOrAnnotationFieldOrType(IMember element) throws JavaModelException {
// always show the static symbol on interface fields and types
if (element.getElementType() == IJavaElement.FIELD) {
return JavaModelUtil.isInterfaceOrAnnotation(element.getDeclaringType());
} else if (element.getElementType() == IJavaElement.TYPE && element.getDeclaringType() != null) {
return JavaModelUtil.isInterfaceOrAnnotation(element.getDeclaringType());
}
return false;
}
示例6: confirmAbstract
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static boolean confirmAbstract(IMember element) throws JavaModelException {
// never show the abstract symbol on interfaces or members in interfaces
if (element.getElementType() == IJavaElement.TYPE) {
return ! JavaModelUtil.isInterfaceOrAnnotation((IType) element);
}
return ! JavaModelUtil.isInterfaceOrAnnotation(element.getDeclaringType());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:8,代码来源:JavaElementImageProvider.java
示例7: isInstanceField
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static boolean isInstanceField(IField field) throws CoreException{
if (JavaModelUtil.isInterfaceOrAnnotation(field.getDeclaringType()))
return false;
else
return ! JdtFlags.isStatic(field);
}
示例8: isMemberInInterfaceOrAnnotation
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private boolean isMemberInInterfaceOrAnnotation(IMember member) throws JavaModelException {
IType parent= member.getDeclaringType();
return parent != null && JavaModelUtil.isInterfaceOrAnnotation(parent);
}
示例9: isFieldInInterfaceOrAnnotation
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private boolean isFieldInInterfaceOrAnnotation(IMember member) throws JavaModelException {
return (member.getElementType() == IJavaElement.FIELD) && JavaModelUtil.isInterfaceOrAnnotation(member.getDeclaringType());
}