IJavaProject javaProject = element.getJavaProject();
if (Utils.isGWTProject(javaProject)) {
IPackageFragmentRoot testSourceFragmentRoot = handleTestSourceFolder(javaProject);
IPackageFragment elementPackage = handleTestPackage(element, testSourceFragmentRoot);
// handle class under test
IType classUnderTestType = (IType) element.getAncestor(IJavaElement.TYPE);
if (classUnderTestType == null) {
ICompilationUnit compilationUnit =
(ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
if (compilationUnit != null) {
classUnderTestType = compilationUnit.findPrimaryType();
}
}
if (classUnderTestType == null) {
setErrorState();
} else {
m_classUnderTestField.setText(classUnderTestType.getFullyQualifiedName());
setTypeName(classUnderTestType.getElementName() + "Test", true);
m_classUnderTestStatus =
new Status(IStatus.OK, Activator.PLUGIN_ID, IStatus.OK, null, null);
//
ModuleDescription module = Utils.getSingleModule(elementPackage);
if (module == null) {
setErrorState("GWT module for "
+ classUnderTestType.getFullyQualifiedName()
+ " not found.");
} else {
m_moduleId = module.getId();
}
}