Java Code Examples for org.eclipse.jdt.core.JavaCore#newRegion()
The following examples show how to use
org.eclipse.jdt.core.JavaCore#newRegion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeHierarchyLifeCycle.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private ITypeHierarchy createTypeHierarchy(IJavaElement[] elements, IProgressMonitor pm) throws JavaModelException { if (elements.length == 1 && elements[0].getElementType() == IJavaElement.TYPE) { IType type= (IType)elements[0]; if (fIsSuperTypesOnly) { return type.newSupertypeHierarchy(pm); } else { return type.newTypeHierarchy(pm); } } else { IRegion region= JavaCore.newRegion(); for (int i= 0; i < elements.length; i++) { if (elements[i].getElementType() == IJavaElement.JAVA_PROJECT) { // for projects only add the contained source folders IPackageFragmentRoot[] roots= ((IJavaProject)elements[i]).getPackageFragmentRoots(); for (int j= 0; j < roots.length; j++) { if (!roots[j].isExternal()) { region.add(roots[j]); } } } else { region.add(elements[i]); } } return JavaCore.newTypeHierarchy(region, null, pm); } }
Example 2
Source File: ClassFinder.java From birt with Eclipse Public License 1.0 | 6 votes |
private IRegion getRegion( IJavaElement element ) throws JavaModelException { IRegion result = JavaCore.newRegion( ); if ( element.getElementType( ) == IJavaElement.JAVA_PROJECT ) { // for projects only add the contained source folders IPackageFragmentRoot[] roots = ( (IJavaProject) element ).getPackageFragmentRoots( ); for ( int i = 0; i < roots.length; i++ ) { if ( !roots[i].isArchive( ) ) { result.add( roots[i] ); } } } else { result.add( element ); } return result; }
Example 3
Source File: BusinessObjectModelRepositoryStore.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected IRegion regionWithBDM(final IJavaProject javaProject) throws JavaModelException { final IRegion newRegion = JavaCore.newRegion(); IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); if (rawClasspath != null) { final IClasspathEntry repositoryDependenciesClasspathEntry = find(asIterable(rawClasspath), repositoryDependenciesEntry(), null); final IPackageFragmentRoot[] fragmentRoots = javaProject .findPackageFragmentRoots(repositoryDependenciesClasspathEntry); if (fragmentRoots != null) { final IPackageFragmentRoot packageFragmentRoot = find(asIterable(fragmentRoots), withElementName(BDM_CLIENT_POJO_JAR_NAME), null); if (packageFragmentRoot != null) { newRegion.add(packageFragmentRoot); } } } return newRegion; }
Example 4
Source File: DebugSourceInstallingCompilationParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected List<IFile> findGeneratedJavaClassFiles(IJavaElement element) { IRegion region = JavaCore.newRegion(); region.add(element); List<IFile> result = Lists.newLinkedList(); for (IResource res : JavaCore.getGeneratedResources(region, false)) if (res instanceof IFile) result.add((IFile) res); return result; }
Example 5
Source File: RippleMethodFinder.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private void createHierarchyOfDeclarations(IProgressMonitor pm, WorkingCopyOwner owner) throws JavaModelException { IRegion region = JavaCore.newRegion(); for (Iterator<IMethod> iter = fDeclarations.iterator(); iter.hasNext();) { IType declaringType = iter.next().getDeclaringType(); region.add(declaringType); } fHierarchy = JavaCore.newTypeHierarchy(region, owner, pm); }
Example 6
Source File: RippleMethodFinder2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private void createHierarchyOfDeclarations(IProgressMonitor pm, WorkingCopyOwner owner) throws JavaModelException { IRegion region= JavaCore.newRegion(); for (Iterator<IMethod> iter= fDeclarations.iterator(); iter.hasNext();) { IType declaringType= iter.next().getDeclaringType(); region.add(declaringType); } fHierarchy= JavaCore.newTypeHierarchy(region, owner, pm); }
Example 7
Source File: RippleMethodFinder2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void createHierarchyOfDeclarations(IProgressMonitor pm, WorkingCopyOwner owner) throws JavaModelException { IRegion region= JavaCore.newRegion(); for (Iterator<IMethod> iter= fDeclarations.iterator(); iter.hasNext();) { IType declaringType= iter.next().getDeclaringType(); region.add(declaringType); } fHierarchy= JavaCore.newTypeHierarchy(region, owner, pm); }
Example 8
Source File: SerialVersionHashOperation.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static IFile getClassfile(ITypeBinding typeBinding) throws CoreException { // bug 191943 IType type= (IType) typeBinding.getJavaElement(); if (type == null || type.getCompilationUnit() == null) { return null; } IRegion region= JavaCore.newRegion(); region.add(type.getCompilationUnit()); String name= typeBinding.getBinaryName(); if (name != null) { int packStart= name.lastIndexOf('.'); if (packStart != -1) { name= name.substring(packStart + 1); } } else { throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, CorrectionMessages.SerialVersionHashOperation_error_classnotfound)); } name += ".class"; //$NON-NLS-1$ IResource[] classFiles= JavaCore.getGeneratedResources(region, false); for (int i= 0; i < classFiles.length; i++) { IResource resource= classFiles[i]; if (resource.getType() == IResource.FILE && resource.getName().equals(name)) { return (IFile) resource; } } throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, CorrectionMessages.SerialVersionHashOperation_error_classnotfound)); }