@Override public IJavaElement getJavaElement() throws JavaModelException { return fJavaProject.findType(fTypeName); } }
public static boolean hasTestCaseType(IJavaProject javaProject) { try { return javaProject != null && javaProject.findType(JUnitCorePlugin.TEST_SUPERCLASS_NAME) != null; } catch (JavaModelException e) { // not available } return false; }
@Override public IType findType(String typeName) throws JavaModelException { return project.findType(typeName); } };
private void filterProjectCandidatesByClass(String className) { projectCandidates = visitedClassNames.contains(className) ? projectCandidates : projectCandidates.stream().filter(p -> { try { return p.findType(className) != null; } catch (Exception e) { // ignore } return false; }).collect(Collectors.toList()); visitedClassNames.add(className); }
private IType getDeclaringType(IJavaProject project, String typeName) { try { return project.findType(typeName, (IProgressMonitor) null); } catch (JavaModelException e) { JavaPlugin.log(e); } return null; }
public IType findType(String builderClassName) throws JavaModelException { if (fLastValidBuilderType != null && builderClassName.equals(fLastValidBuilderType.getFullyQualifiedParameterizedName())) { return fLastValidBuilderType; } return fJavaProject.findType(builderClassName, (IProgressMonitor)null); }
public static IType findType(String packageName, String qualifiedTypeName, IJavaProject javaProject) { try { return javaProject.findType(packageName, qualifiedTypeName.replace('$', '.')); } catch (JavaModelException ex) { JptCorePlugin.log(ex); return null; } }
private static IType resolvePackageInfoType(IPackageFragment pack, String refTypeName) throws JavaModelException { // Note: The scoping rules of JLS7 6.3 are broken for package-info.java, see https://bugs.eclipse.org/216451#c4 // We follow the javadoc tool's implementation and only support fully-qualified type references: IJavaProject javaProject = pack.getJavaProject(); return javaProject.findType(refTypeName, (IProgressMonitor) null); }
private IType findType(IJavaProject project, String typeName) throws JavaModelException { if (project.exists()) { return project.findType(typeName); } return null; }
private IType findType(IJavaProject project, String typeName) throws JavaModelException { if (project.exists()) { return project.findType(typeName); } return null; }
private IJavaElement resolveJavaElement(IJavaProject project, CompletionProposal proposal) throws JavaModelException { char[] signature= proposal.getSignature(); String typeName= SignatureUtil.stripSignatureToFQN(String.valueOf(signature)); return project.findType(typeName); }
final IJavaProject project = ...; final IProgressMonitor monitor = ...; final IRegion region = JavaCore.newRegion(); region.add(project.findType("some.packagename.B")); final ITypeHierarchy typeHierarchy = project.newTypeHierarchy(region, monitor);
/** * Finds the factory class associated with the fully qualified name. * @param fullyQualifiedTypeName the fully qualified type name * @return the factory class, or <code>null</code> if not found * @throws JavaModelException if an error occurs while finding the factory class */ private IType findFactoryClass(String fullyQualifiedTypeName) throws JavaModelException { IType factoryType= getProject().findType(fullyQualifiedTypeName); if (factoryType == null) // presumably a non-primary type; try the search engine factoryType= findNonPrimaryType(fullyQualifiedTypeName, new NullProgressMonitor(), new RefactoringStatus()); return factoryType; }
private IType resolveType(String qualifiedTypeName) throws JavaModelException{ IType type= getDeclaringType().getJavaProject().findType(qualifiedTypeName); if (type == null) type= getDeclaringType().getJavaProject().findType(getDeclaringType().getPackageFragment().getElementName(), qualifiedTypeName); return type; }
private IType resolveType(String qualifiedTypeName) throws JavaModelException{ IType type= getDeclaringType().getJavaProject().findType(qualifiedTypeName); if (type == null) type= getDeclaringType().getJavaProject().findType(getDeclaringType().getPackageFragment().getElementName(), qualifiedTypeName); return type; }
private boolean isEclipseNLSAvailable() { if (fNLSRefactoring == null || fNLSRefactoring.getCu() == null) return false; IJavaProject jp= fNLSRefactoring.getCu().getJavaProject(); if (jp == null || !jp.exists()) return false; try { return jp.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$ } catch (JavaModelException e) { return false; } }
public boolean isEclipseNLSAvailable() { if (getCu() == null) return false; IJavaProject javaProject= getCu().getJavaProject(); if (javaProject == null || !javaProject.exists()) return false; try { return javaProject.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$ } catch (JavaModelException e) { return false; } }
private static void findTestCases(IJavaElement element, Set result, IProgressMonitor pm) throws JavaModelException { IJavaProject javaProject= element.getJavaProject(); IType testCaseType= javaProject.findType(JUnitCorePlugin.TEST_INTERFACE_NAME); if (testCaseType == null) return; IRegion region= CoreTestSearchEngine.getRegion(element); ITypeHierarchy typeHierarchy= javaProject.newTypeHierarchy(testCaseType, region, pm); CoreTestSearchEngine.findTestImplementorClasses(typeHierarchy, testCaseType, region, result); }
private IType resolveType(StackFrame frame) throws CoreException, DebugException { ISourceLookUpProvider sourceProvider = context.getProvider(ISourceLookUpProvider.class); if (sourceProvider instanceof JdtSourceLookUpProvider) { IJavaProject project = JdtUtils.findProject(frame, ((JdtSourceLookUpProvider) sourceProvider).getSourceContainers()); if (project != null) { return project.findType(JdtUtils.getDeclaringTypeName(frame)); } } return null; }
public static IType findTypeInPackage(IPackageFragment pack, String elementName) throws JavaModelException { Assert.isTrue(pack.exists()); Assert.isTrue(!pack.isReadOnly()); String packageName= pack.getElementName(); elementName= packageName.length() > 0 ? packageName + '.' + elementName : elementName; return pack.getJavaProject().findType(elementName, (IProgressMonitor) null); }