// } else if (((JavaProject)root.getJavaProject()).contains(resource)) {
// // create package handle
// IPath pkgPath = path.removeFirstSegments(root.getPath().segmentCount());
-// String pkg = Util.packageName(pkgPath);
+// String pkg = ProjectPrefUtil.packageName(pkgPath);
// if (pkg == null) return null;
// element = root.getPackageFragment(pkg);
// }
// IPackageFragmentRoot root = (IPackageFragmentRoot)this.currentElement;
// IPath rootPath = root.getPath();
// IPath pkgPath = path.removeLastSegments(1);
-// String pkgName = Util.packageName(pkgPath.removeFirstSegments(rootPath.segmentCount()));
+// String pkgName = ProjectPrefUtil.packageName(pkgPath.removeFirstSegments(rootPath.segmentCount()));
// if (pkgName != null) {
// pkgFragment = root.getPackageFragment(pkgName);
// }
// IResource resource = child.getResource();
// if (resource instanceof IFolder) {
// String folderName = resource.getName();
-// if (Util.isValidFolderNameForPackage(folderName)) {
+// if (ProjectPrefUtil.isValidFolderNameForPackage(folderName)) {
// String subpkgName =
// name.length() == 0 ?
// folderName :
// IResource resource = child.getResource();
// if (resource instanceof IFolder) {
// String folderName = resource.getName();
-// if (Util.isValidFolderNameForPackage(folderName)) {
+// if (ProjectPrefUtil.isValidFolderNameForPackage(folderName)) {
// String subpkgName =
// name.length() == 0 ?
// folderName :
// if (rootInfo == null) {
// rootInfo = this.enclosingRootInfo(res.getFullPath(), kind);
// }
-// if (rootInfo == null || Util.isExcluded(res, rootInfo.exclusionPatterns)) {
+// if (rootInfo == null || ProjectPrefUtil.isExcluded(res, rootInfo.exclusionPatterns)) {
// return NON_JAVA_RESOURCE;
// }
// if (res instanceof IFolder) {
-// if (Util.isValidFolderNameForPackage(res.getName())) {
+// if (ProjectPrefUtil.isValidFolderNameForPackage(res.getName())) {
// return IJavaElement.PACKAGE_FRAGMENT;
// } else {
// return NON_JAVA_RESOURCE;
// }
// } else {
// String fileName = res.getName();
-// if (Util.isValidCompilationUnitName(fileName)) {
+// if (ProjectPrefUtil.isValidCompilationUnitName(fileName)) {
// return IJavaElement.COMPILATION_UNIT;
-// } else if (Util.isValidClassFileName(fileName)) {
+// } else if (ProjectPrefUtil.isValidClassFileName(fileName)) {
// return IJavaElement.CLASS_FILE;
// } else if (this.rootInfo(res.getFullPath(), kind) != null) {
// // case of proj=src=bin and resource is a jar file on the classpath
// }
// } catch (JavaModelException e) {
// if (project.getProject().isAccessible()) {
-// Util.log(e, "Could not save classpath for "+ project.getPath()); //$NON-NLS-1$
+// ProjectPrefUtil.log(e, "Could not save classpath for "+ project.getPath()); //$NON-NLS-1$
// }
// }
// break;
// } catch (RuntimeException e) {
// // setRawClasspath might fire a delta, and a listener may throw an exception
// if (project.getProject().isAccessible()) {
-// Util.log(e, "Could not set classpath for "+ project.getPath()); //$NON-NLS-1$
+// ProjectPrefUtil.log(e, "Could not set classpath for "+ project.getPath()); //$NON-NLS-1$
// }
// break;
// } catch (JavaModelException e) { // CP failed validation
// // happens if the .classpath could not be written to disk
// project.createClasspathProblemMarker(new JavaModelStatus(
// IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT,
-// Util.bind("classpath.couldNotWriteClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
+// ProjectPrefUtil.bind("classpath.couldNotWriteClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
// } else {
// project.createClasspathProblemMarker(new JavaModelStatus(
// IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT,
-// Util.bind("classpath.invalidClasspathInClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
+// ProjectPrefUtil.bind("classpath.invalidClasspathInClasspathFile", project.getElementName(), e.getMessage()))); //$NON-NLS-1$
// }
// }
// break;
// // wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief
// Platform.run(new ISafeRunnable() {
// public void handleException(Throwable exception) {
-// Util.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$
+// ProjectPrefUtil.log(exception, "Exception occurred in listener of Java element change notification"); //$NON-NLS-1$
// }
// public void run() throws Exception {
// TypeHierarchy typeHierarchy = (TypeHierarchy)listener;
// IResource resource = child.getResource();
// if (resource instanceof IFile) {
// String name = resource.getName();
-// if (Util.isJavaFileName(name)) {
+// if (ProjectPrefUtil.isJavaFileName(name)) {
// Openable cu = (Openable)pkg.getCompilationUnit(name);
// this.updateIndex(cu, child);
-// } else if (Util.isClassFileName(name)) {
+// } else if (ProjectPrefUtil.isClassFileName(name)) {
// Openable classFile = (Openable)pkg.getClassFile(name);
// this.updateIndex(classFile, child);
// }
// }
// }
//}
+
/**
* Upadtes the index of the given root (assuming it's an addition or a removal).
* This is done recusively, pkg being the current package.