boolean result= false;
IType[] types = null;
if(IJavaElement.METHOD == ije.getElementType()) {
IMethod iMethod = (IMethod) ije;
ITestContent content = TypeParser.parseType(iMethod.getDeclaringType());
if(content.hasTestMethods()) {
result= content.isTestMethod(iMethod);
if(result) {
s_isTestCache.put(ije, Boolean.TRUE);
}
return result;
}
return false;
}
if(IJavaElement.COMPILATION_UNIT == ije.getElementType()) {
try {
types = ((ICompilationUnit) ije).getAllTypes();
}
catch(JavaModelException jme) {
TestNGPlugin.log(jme);
}
}
else if(IJavaElement.TYPE == ije.getElementType()) {
types = new IType[] {(IType) ije};
}
else {
return false;
}
if(null != types) {
for(int i = 0; i < types.length; i++) {
ITestContent testContent = TypeParser.parseType(types[i]);
if(testContent.hasTestMethods()) {
s_isTestCache.put(ije, Boolean.TRUE);
return true;
}
}
}