本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JdtFlags.isEnum方法的典型用法代码示例。如果您正苦于以下问题:Java JdtFlags.isEnum方法的具体用法?Java JdtFlags.isEnum怎么用?Java JdtFlags.isEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JdtFlags
的用法示例。
在下文中一共展示了JdtFlags.isEnum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isExtractSupertypeAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isExtractSupertypeAvailable(IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
if (!Checks.isAvailable(member)) return false;
if (member instanceof IMethod) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
member = method.getDeclaringType();
} else if (member instanceof IField) {
member = member.getDeclaringType();
}
if (member instanceof IType) {
if (JdtFlags.isEnum(member) || JdtFlags.isAnnotation(member)) return false;
if (member.getDeclaringType() != null && !JdtFlags.isStatic(member)) return false;
if (((IType) member).isAnonymous())
return false; // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=253727
if (((IType) member).isLambda()) return false;
}
return true;
}
示例2: isGeneralizeTypeAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isGeneralizeTypeAvailable(final IJavaElement element)
throws JavaModelException {
if (element != null && element.exists()) {
String type = null;
if (element instanceof IMethod) type = ((IMethod) element).getReturnType();
else if (element instanceof IField) {
final IField field = (IField) element;
if (JdtFlags.isEnum(field)) return false;
type = field.getTypeSignature();
} else if (element instanceof ILocalVariable) return true;
else if (element instanceof IType) {
final IType clazz = (IType) element;
if (JdtFlags.isEnum(clazz)) return false;
return true;
}
if (type == null || PrimitiveType.toCode(Signature.toString(type)) != null) return false;
return true;
}
return false;
}
示例3: isMoveStaticAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveStaticAvailable(final IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
final IType declaring = member.getDeclaringType();
if (declaring == null) return false;
if (!Checks.isAvailable(member)) return false;
if (type == IJavaElement.METHOD && declaring.isInterface()) {
boolean is18OrHigher = JavaModelUtil.is18OrHigher(member.getJavaProject());
if (!is18OrHigher || !Flags.isStatic(member.getFlags())) return false;
}
if (type == IJavaElement.METHOD && !JdtFlags.isStatic(member)) return false;
if (type == IJavaElement.METHOD && ((IMethod) member).isConstructor()) return false;
if (type == IJavaElement.TYPE && !JdtFlags.isStatic(member)) return false;
if (!declaring.isInterface() && !JdtFlags.isStatic(member)) return false;
return true;
}
示例4: isPullUpAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPullUpAvailable(IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE) return false;
if (!Checks.isAvailable(member)) return false;
if (member instanceof IType) {
if (!JdtFlags.isStatic(member) && !JdtFlags.isEnum(member) && !JdtFlags.isAnnotation(member))
return false;
}
if (member instanceof IMethod) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
final IType declaring = method.getDeclaringType();
if (declaring != null && declaring.isAnnotation()) return false;
}
return true;
}
示例5: isPushDownAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPushDownAvailable(final IMember member) throws JavaModelException {
if (!member.exists()) return false;
final int type = member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD) return false;
if (JdtFlags.isEnum(member)) return false;
if (!Checks.isAvailable(member)) return false;
if (JdtFlags.isStatic(member)) return false;
if (type == IJavaElement.METHOD) {
final IMethod method = (IMethod) member;
if (method.isConstructor()) return false;
if (JdtFlags.isNative(method)) return false;
final IType declaring = method.getDeclaringType();
if (declaring != null && declaring.isAnnotation()) return false;
}
return true;
}
示例6: isMoveAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveAvailable(final IResource[] resources, final IJavaElement[] elements) throws JavaModelException {
if (elements != null) {
for (int index= 0; index < elements.length; index++) {
IJavaElement element= elements[index];
if (element == null || !element.exists())
return false;
if ((element instanceof IType) && ((IType) element).isLocal())
return false;
if ((element instanceof IPackageDeclaration))
return false;
if (element instanceof IField && JdtFlags.isEnum((IMember) element))
return false;
}
}
return ReorgPolicyFactory.createMovePolicy(resources, elements).canEnable();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:RefactoringAvailabilityTester.java
示例7: isGeneralizeTypeAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isGeneralizeTypeAvailable(final IJavaElement element) throws JavaModelException {
if (element != null && element.exists()) {
String type= null;
if (element instanceof IMethod)
type= ((IMethod) element).getReturnType();
else if (element instanceof IField) {
final IField field= (IField) element;
if (JdtFlags.isEnum(field))
return false;
type= field.getTypeSignature();
} else if (element instanceof ILocalVariable)
return true;
else if (element instanceof IType) {
final IType clazz= (IType) element;
if (JdtFlags.isEnum(clazz))
return false;
return true;
}
if (type == null || PrimitiveType.toCode(Signature.toString(type)) != null)
return false;
return true;
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:RefactoringAvailabilityTester.java
示例8: isMoveStaticAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveStaticAvailable(final IMember member) throws JavaModelException {
if (!member.exists())
return false;
final int type= member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD && type != IJavaElement.TYPE)
return false;
if (JdtFlags.isEnum(member) && type != IJavaElement.TYPE)
return false;
final IType declaring= member.getDeclaringType();
if (declaring == null)
return false;
if (!Checks.isAvailable(member))
return false;
if (type == IJavaElement.METHOD && declaring.isInterface())
return false;
if (type == IJavaElement.METHOD && !JdtFlags.isStatic(member))
return false;
if (type == IJavaElement.METHOD && ((IMethod) member).isConstructor())
return false;
if (type == IJavaElement.TYPE && !JdtFlags.isStatic(member))
return false;
if (!declaring.isInterface() && !JdtFlags.isStatic(member))
return false;
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:RefactoringAvailabilityTester.java
示例9: isPushDownAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isPushDownAvailable(final IMember member) throws JavaModelException {
if (!member.exists())
return false;
final int type= member.getElementType();
if (type != IJavaElement.METHOD && type != IJavaElement.FIELD)
return false;
if (JdtFlags.isEnum(member))
return false;
if (!Checks.isAvailable(member))
return false;
if (JdtFlags.isStatic(member))
return false;
if (type == IJavaElement.METHOD) {
final IMethod method= (IMethod) member;
if (method.isConstructor())
return false;
if (JdtFlags.isNative(method))
return false;
final IType declaring= method.getDeclaringType();
if (declaring != null && declaring.isAnnotation())
return false;
}
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:RefactoringAvailabilityTester.java
示例10: getMember
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private static IMember getMember(IStructuredSelection selection) throws JavaModelException {
if (selection.size() != 1)
return null;
Object element= selection.getFirstElement();
if (!(element instanceof IMember))
return null;
if (element instanceof IMethod) {
IMethod method= (IMethod)element;
String returnType= method.getReturnType();
if (PrimitiveType.toCode(Signature.toString(returnType)) != null)
return null;
return method;
} else if (element instanceof IField && !JdtFlags.isEnum((IMember) element)) {
return (IField)element;
}
return null;
}
示例11: isGeneralizeTypeAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isGeneralizeTypeAvailable(final IStructuredSelection selection) throws JavaModelException {
if (selection.size() == 1) {
final Object element= selection.getFirstElement();
if (element instanceof IMethod) {
final IMethod method= (IMethod) element;
if (!method.exists())
return false;
final String type= method.getReturnType();
if (PrimitiveType.toCode(Signature.toString(type)) == null)
return Checks.isAvailable(method);
} else if (element instanceof IField) {
final IField field= (IField) element;
if (!field.exists())
return false;
if (!JdtFlags.isEnum(field))
return Checks.isAvailable(field);
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:RefactoringAvailabilityTester.java
示例12: isConvertAnonymousAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isConvertAnonymousAvailable(final IType type) throws JavaModelException {
if (Checks.isAvailable(type)) {
final IJavaElement element = type.getParent();
if (element instanceof IField && JdtFlags.isEnum((IMember) element)) return false;
return type.isAnonymous();
}
return false;
}
示例13: isMoveAvailable
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
public static boolean isMoveAvailable(final IResource[] resources, final IJavaElement[] elements)
throws JavaModelException {
if (elements != null) {
for (int index = 0; index < elements.length; index++) {
IJavaElement element = elements[index];
if (element == null || !element.exists()) return false;
if ((element instanceof IType) && ((IType) element).isLocal()) return false;
if ((element instanceof IPackageDeclaration)) return false;
if (element instanceof IField && JdtFlags.isEnum((IMember) element)) return false;
}
}
return ReorgPolicyFactory.createMovePolicy(resources, elements).canEnable();
}
示例14: getNodesToDelete
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private static ASTNode[] getNodesToDelete(IJavaElement element, CompilationUnit cuNode)
throws JavaModelException {
// fields are different because you don't delete the whole declaration but only a fragment of it
if (element.getElementType() == IJavaElement.FIELD) {
if (JdtFlags.isEnum((IField) element))
return new ASTNode[] {
ASTNodeSearchUtil.getEnumConstantDeclaration((IField) element, cuNode)
};
else
return new ASTNode[] {
ASTNodeSearchUtil.getFieldDeclarationFragmentNode((IField) element, cuNode)
};
}
if (element.getElementType() == IJavaElement.TYPE && ((IType) element).isLocal()) {
IType type = (IType) element;
if (type.isAnonymous()) {
if (type.getParent().getElementType() == IJavaElement.FIELD) {
EnumConstantDeclaration enumDecl =
ASTNodeSearchUtil.getEnumConstantDeclaration((IField) element.getParent(), cuNode);
if (enumDecl != null && enumDecl.getAnonymousClassDeclaration() != null) {
return new ASTNode[] {enumDecl.getAnonymousClassDeclaration()};
}
}
ClassInstanceCreation creation =
ASTNodeSearchUtil.getClassInstanceCreationNode(type, cuNode);
if (creation != null) {
if (creation.getLocationInParent() == ExpressionStatement.EXPRESSION_PROPERTY) {
return new ASTNode[] {creation.getParent()};
} else if (creation.getLocationInParent()
== VariableDeclarationFragment.INITIALIZER_PROPERTY) {
return new ASTNode[] {creation};
}
return new ASTNode[] {creation.getAnonymousClassDeclaration()};
}
return new ASTNode[0];
} else {
ASTNode[] nodes = ASTNodeSearchUtil.getDeclarationNodes(element, cuNode);
// we have to delete the TypeDeclarationStatement
nodes[0] = nodes[0].getParent();
return nodes;
}
}
return ASTNodeSearchUtil.getDeclarationNodes(element, cuNode);
}
示例15: canRunOn
import org.eclipse.jdt.internal.corext.util.JdtFlags; //导入方法依赖的package包/类
private boolean canRunOn(IField[] fields) throws JavaModelException {
if (fields == null || fields.length == 0)
return false;
int count= 0;
for (int index= 0; index < fields.length; index++) {
if (!JdtFlags.isEnum(fields[index]))
count++;
}
if (count == 0)
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_not_applicable);
return (count > 0);
}