private IType[] compilationUnitTypes() { try { return this.compilationUnit.getTypes(); } catch (JavaModelException e) { //TODO not throwing an exception because of tests, should I be? //throw new RuntimeException(e); return new IType[0]; } }
private boolean willHaveAllTopLevelTypesDeleted(ICompilationUnit cu) throws JavaModelException { Set elementSet= new HashSet(Arrays.asList(fJavaElements)); IType[] topLevelTypes= cu.getTypes(); for (int i= 0; i < topLevelTypes.length; i++) { if (! elementSet.contains(topLevelTypes[i])) return false; } return true; }
public static IType getMainType(ICompilationUnit cu) throws JavaModelException{ IType[] types= cu.getTypes(); for (int i = 0; i < types.length; i++) { if (isMainType(types[i])) { return types[i]; } } return null; }
private boolean hasMembersToSort(ICompilationUnit[] units) throws JavaModelException { for (int i= 0; i < units.length; i++) { if (hasMembersToSort(units[i].getTypes())) return true; } return false; }
private static Collection<String> getTopLevelTypeNames(ICompilationUnit iCompilationUnit) throws CoreException { IType[] types= iCompilationUnit.getTypes(); List<String> result= new ArrayList<>(types.length); for (int i= 0; i < types.length; i++) { result.add(types[i].getElementName()); } return result; }
public static IType getMainType(ICompilationUnit cu) throws JavaModelException{ IType[] types= cu.getTypes(); for (int i = 0; i < types.length; i++) { if (isMainType(types[i])) return types[i]; } return null; }
private static Collection<String> getTopLevelTypeNames(ICompilationUnit iCompilationUnit) throws CoreException { IType[] types= iCompilationUnit.getTypes(); List<String> result= new ArrayList<>(types.length); for (int i= 0; i < types.length; i++) { result.add(types[i].getElementName()); } return result; }
public static IType getMainType(ICompilationUnit cu) throws JavaModelException{ IType[] types= cu.getTypes(); for (int i = 0; i < types.length; i++) { if (isMainType(types[i])) return types[i]; } return null; }
for (ICompilationUnit unit : mypackage.getCompilationUnits()) { IType[] types = unit.getTypes(); for (int i = 0; i < types.length; i++) { IType type = types[i]; IMethod[] methods = type.getMethods();
public static IType getMainType(ICompilationUnit cu) throws JavaModelException{ IType[] types= cu.getTypes(); for (int i = 0; i < types.length; i++) { if (isMainType(types[i])) return types[i]; } return null; }
private boolean hasMembersToSort(ICompilationUnit[] units) throws JavaModelException { for (int i= 0; i < units.length; i++) { if (hasMembersToSort(units[i].getTypes())) return true; } return false; }
private void addContainedTypes(IPackageFragment pack, List<IType> typesCollector) throws JavaModelException { IJavaElement[] children= pack.getChildren(); for (int c= 0; c < children.length; c++) { IJavaElement child= children[c]; if (child instanceof ICompilationUnit) { typesCollector.addAll(Arrays.asList(((ICompilationUnit) child).getTypes())); } else if (child instanceof IOrdinaryClassFile) { typesCollector.add(((IOrdinaryClassFile) child).getType()); } } }
private void addContainedTypes(IPackageFragment pack, List<IType> typesCollector) throws JavaModelException { IJavaElement[] children= pack.getChildren(); for (int c= 0; c < children.length; c++) { IJavaElement child= children[c]; if (child instanceof ICompilationUnit) { typesCollector.addAll(Arrays.asList(((ICompilationUnit) child).getTypes())); } else if (child instanceof IOrdinaryClassFile) { typesCollector.add(((IOrdinaryClassFile) child).getType()); } } }
private void addContainedTypes(IPackageFragment pack, List typesCollector) throws JavaModelException { IJavaElement[] children= pack.getChildren(); for (int c= 0; c < children.length; c++) { IJavaElement child= children[c]; if (child instanceof ICompilationUnit) { typesCollector.addAll(Arrays.asList(((ICompilationUnit) child).getTypes())); } else if (child instanceof IClassFile) { typesCollector.add(((IClassFile) child).getType()); } } }
private SearchPatternData tryIfPropertyCuSelected(ICompilationUnit compilationUnit) throws JavaModelException { IStorage bundle= getResourceBundle(compilationUnit); if (!(bundle instanceof IFile)) return null; return new SearchPatternData(compilationUnit.getTypes()[0], (IFile) bundle); }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
private static void searchInPackage(List<TestItem> resultList, SearchTestItemParams params) throws JavaModelException { final IPackageFragment packageFragment = JDTUtils.resolvePackage(params.getUri()); for (final ICompilationUnit unit : packageFragment.getCompilationUnits()) { for (final IType type : unit.getTypes()) { resultList.add(TestItemUtils.constructTestItem(type, TestLevel.CLASS)); } } }
public void move(ICompilationUnit unit, MoveArguments args) throws CoreException { add(unit, args, null); IType[] types= unit.getTypes(); for (int tt= 0; tt < types.length; tt++) { add(types[tt], args, null); } IResource resourceDestination= getResourceDestination(args); if (resourceDestination != null && unit.getResource() != null) { getResourceModifications().addMove(unit.getResource(), new MoveArguments(resourceDestination, args.getUpdateReferences())); } }
private static SearchResultGroup[] getReferences(ICompilationUnit unit, IProgressMonitor pm, RefactoringStatus status) throws CoreException { final SearchPattern pattern= RefactoringSearchEngine.createOrPattern(unit.getTypes(), IJavaSearchConstants.REFERENCES); if (pattern != null) { String binaryRefsDescription= Messages.format(RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description , BasicElementLabels.getFileName(unit)); ReferencesInBinaryContext binaryRefs= new ReferencesInBinaryContext(binaryRefsDescription); Collector requestor= new Collector(((IPackageFragment) unit.getParent()), binaryRefs); IJavaSearchScope scope= RefactoringScopeFactory.create(unit, true, false); SearchResultGroup[] result= RefactoringSearchEngine.search(pattern, scope, requestor, new SubProgressMonitor(pm, 1), status); binaryRefs.addErrorIfNecessary(status); return result; } return new SearchResultGroup[] {}; }