X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java
index fc9fcd8..2c58dba 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java
@@ -10,28 +10,28 @@
*******************************************************************************/
package net.sourceforge.phpdt.internal.core;
-import java.io.File;
+//import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import net.sourceforge.phpdt.core.IClasspathEntry;
+//import net.sourceforge.phpdt.core.IClasspathEntry;
import net.sourceforge.phpdt.core.ICompilationUnit;
import net.sourceforge.phpdt.core.IJavaElement;
import net.sourceforge.phpdt.core.IJavaProject;
import net.sourceforge.phpdt.core.IPackageFragment;
import net.sourceforge.phpdt.core.IPackageFragmentRoot;
import net.sourceforge.phpdt.core.IType;
-import net.sourceforge.phpdt.core.IWorkingCopy;
-import net.sourceforge.phpdt.core.JavaCore;
+//import net.sourceforge.phpdt.core.IWorkingCopy;
+//import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.internal.core.util.PerThreadObject;
-import net.sourceforge.phpdt.internal.core.util.Util;
+//import net.sourceforge.phpdt.internal.core.util.Util;
-import org.eclipse.core.resources.IResource;
+//import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
+//import org.eclipse.core.runtime.IPath;
/**
* A NameLookup
provides name resolution within a Java project.
@@ -194,35 +194,35 @@ public class NameLookup {
* The name must be fully qualified (eg "java.lang.Object",
* "java.util.Hashtable$Entry")
*/
- public ICompilationUnit findCompilationUnit(String qualifiedTypeName) {
- String pkgName = IPackageFragment.DEFAULT_PACKAGE_NAME;
- String cuName = qualifiedTypeName;
-
- int index = qualifiedTypeName.lastIndexOf('.');
- if (index != -1) {
- pkgName = qualifiedTypeName.substring(0, index);
- cuName = qualifiedTypeName.substring(index + 1);
- }
- index = cuName.indexOf('$');
- if (index != -1) {
- cuName = cuName.substring(0, index);
- }
- cuName += ".java"; //$NON-NLS-1$
- IPackageFragment[] frags = (IPackageFragment[]) fPackageFragments
- .get(pkgName);
- if (frags != null) {
- for (int i = 0; i < frags.length; i++) {
- IPackageFragment frag = frags[i];
- // if (!(frag instanceof JarPackageFragment)) {
- // ICompilationUnit cu= frag.getCompilationUnit(cuName);
- // if (cu != null && cu.exists()) {
- // return cu;
- // }
- // }
- }
- }
- return null;
- }
+// public ICompilationUnit findCompilationUnit(String qualifiedTypeName) {
+// String pkgName = IPackageFragment.DEFAULT_PACKAGE_NAME;
+// String cuName = qualifiedTypeName;
+//
+// int index = qualifiedTypeName.lastIndexOf('.');
+// if (index != -1) {
+// pkgName = qualifiedTypeName.substring(0, index);
+// cuName = qualifiedTypeName.substring(index + 1);
+// }
+// index = cuName.indexOf('$');
+// if (index != -1) {
+// cuName = cuName.substring(0, index);
+// }
+// cuName += ".java"; //$NON-NLS-1$
+// IPackageFragment[] frags = (IPackageFragment[]) fPackageFragments
+// .get(pkgName);
+// if (frags != null) {
+// for (int i = 0; i < frags.length; i++) {
+// //IPackageFragment frag = frags[i];
+// // if (!(frag instanceof JarPackageFragment)) {
+// // ICompilationUnit cu= frag.getCompilationUnit(cuName);
+// // if (cu != null && cu.exists()) {
+// // return cu;
+// // }
+// // }
+// }
+// }
+// return null;
+// }
/**
* Returns the package fragment whose path matches the given (absolute)
@@ -232,79 +232,79 @@ public class NameLookup {
* to the workbench: "/Project/src" - external to the workbench:
* "c:/jdk/classes.zip/java/lang"
*/
- public IPackageFragment findPackageFragment(IPath path) {
- if (!path.isAbsolute()) {
- throw new IllegalArgumentException(Util.bind("path.mustBeAbsolute")); //$NON-NLS-1$
- }
- /*
- * this code should rather use the package fragment map to find the
- * candidate package, then check if the respective enclosing root maps
- * to the one on this given IPath.
- */
- IResource possibleFragment = workspace.getRoot().findMember(path);
- if (possibleFragment == null) {
- // external jar
- for (int i = 0; i < fPackageFragmentRoots.length; i++) {
- IPackageFragmentRoot root = fPackageFragmentRoots[i];
- if (!root.isExternal()) {
- continue;
- }
- IPath rootPath = root.getPath();
- int matchingCount = rootPath.matchingFirstSegments(path);
- if (matchingCount != 0) {
- String name = path.toOSString();
- // + 1 is for the File.separatorChar
- name = name.substring(rootPath.toOSString().length() + 1,
- name.length());
- name = name.replace(File.separatorChar, '.');
- IJavaElement[] list = null;
- try {
- list = root.getChildren();
- } catch (JavaModelException npe) {
- continue; // the package fragment root is not present;
- }
- int elementCount = list.length;
- for (int j = 0; j < elementCount; j++) {
- IPackageFragment packageFragment = (IPackageFragment) list[j];
- if (nameMatches(name, packageFragment, false)) {
- return packageFragment;
- }
- }
- }
- }
- } else {
- IJavaElement fromFactory = JavaCore.create(possibleFragment);
- if (fromFactory == null) {
- return null;
- }
- if (fromFactory instanceof IPackageFragment) {
- return (IPackageFragment) fromFactory;
- } else if (fromFactory instanceof IJavaProject) {
- // default package in a default root
- JavaProject project = (JavaProject) fromFactory;
- try {
- IClasspathEntry entry = project.getClasspathEntryFor(path);
- if (entry != null) {
- IPackageFragmentRoot root = project
- .getPackageFragmentRoot(project.getResource());
- IPackageFragment[] pkgs = (IPackageFragment[]) fPackageFragments
- .get(IPackageFragment.DEFAULT_PACKAGE_NAME);
- if (pkgs == null) {
- return null;
- }
- for (int i = 0; i < pkgs.length; i++) {
- if (pkgs[i].getParent().equals(root)) {
- return pkgs[i];
- }
- }
- }
- } catch (JavaModelException e) {
- return null;
- }
- }
- }
- return null;
- }
+// public IPackageFragment findPackageFragment(IPath path) {
+// if (!path.isAbsolute()) {
+// throw new IllegalArgumentException(Util.bind("path.mustBeAbsolute")); //$NON-NLS-1$
+// }
+// /*
+// * this code should rather use the package fragment map to find the
+// * candidate package, then check if the respective enclosing root maps
+// * to the one on this given IPath.
+// */
+// IResource possibleFragment = workspace.getRoot().findMember(path);
+// if (possibleFragment == null) {
+// // external jar
+// for (int i = 0; i < fPackageFragmentRoots.length; i++) {
+// IPackageFragmentRoot root = fPackageFragmentRoots[i];
+// if (!root.isExternal()) {
+// continue;
+// }
+// IPath rootPath = root.getPath();
+// int matchingCount = rootPath.matchingFirstSegments(path);
+// if (matchingCount != 0) {
+// String name = path.toOSString();
+// // + 1 is for the File.separatorChar
+// name = name.substring(rootPath.toOSString().length() + 1,
+// name.length());
+// name = name.replace(File.separatorChar, '.');
+// IJavaElement[] list = null;
+// try {
+// list = root.getChildren();
+// } catch (JavaModelException npe) {
+// continue; // the package fragment root is not present;
+// }
+// int elementCount = list.length;
+// for (int j = 0; j < elementCount; j++) {
+// IPackageFragment packageFragment = (IPackageFragment) list[j];
+// if (nameMatches(name, packageFragment, false)) {
+// return packageFragment;
+// }
+// }
+// }
+// }
+// } else {
+// IJavaElement fromFactory = JavaCore.create(possibleFragment);
+// if (fromFactory == null) {
+// return null;
+// }
+// if (fromFactory instanceof IPackageFragment) {
+// return (IPackageFragment) fromFactory;
+// } else if (fromFactory instanceof IJavaProject) {
+// // default package in a default root
+// JavaProject project = (JavaProject) fromFactory;
+// try {
+// IClasspathEntry entry = project.getClasspathEntryFor(path);
+// if (entry != null) {
+// IPackageFragmentRoot root = project
+// .getPackageFragmentRoot(project.getResource());
+// IPackageFragment[] pkgs = (IPackageFragment[]) fPackageFragments
+// .get(IPackageFragment.DEFAULT_PACKAGE_NAME);
+// if (pkgs == null) {
+// return null;
+// }
+// for (int i = 0; i < pkgs.length; i++) {
+// if (pkgs[i].getParent().equals(root)) {
+// return pkgs[i];
+// }
+// }
+// }
+// } catch (JavaModelException e) {
+// return null;
+// }
+// }
+// }
+// return null;
+// }
/**
* Returns the package fragments whose name matches the given (qualified)
@@ -776,25 +776,25 @@ public class NameLookup {
* their compilation units. null
means that no special
* compilation units should be used.
*/
- public void setUnitsToLookInside(IWorkingCopy[] unitsToLookInside) {
-
- if (unitsToLookInside == null) {
- this.unitsToLookInside.setCurrent(null);
- } else {
- HashMap workingCopies = new HashMap();
- this.unitsToLookInside.setCurrent(workingCopies);
- for (int i = 0, length = unitsToLookInside.length; i < length; i++) {
- IWorkingCopy unitToLookInside = unitsToLookInside[i];
- ICompilationUnit original = (ICompilationUnit) unitToLookInside
- .getOriginalElement();
- if (original != null) {
- workingCopies.put(original, unitToLookInside);
- } else {
- workingCopies.put(unitToLookInside, unitToLookInside);
- }
- }
- }
- }
+// public void setUnitsToLookInside(IWorkingCopy[] unitsToLookInside) {
+//
+// if (unitsToLookInside == null) {
+// this.unitsToLookInside.setCurrent(null);
+// } else {
+// HashMap workingCopies = new HashMap();
+// this.unitsToLookInside.setCurrent(workingCopies);
+// for (int i = 0, length = unitsToLookInside.length; i < length; i++) {
+// IWorkingCopy unitToLookInside = unitsToLookInside[i];
+// ICompilationUnit original = (ICompilationUnit) unitToLookInside
+// .getOriginalElement();
+// if (original != null) {
+// workingCopies.put(original, unitToLookInside);
+// } else {
+// workingCopies.put(unitToLookInside, unitToLookInside);
+// }
+// }
+// }
+// }
/**
* Notifies the given requestor of all types (classes and interfaces) in the