From 7703e5b03860dedc21ed3ca9d44a25efd77d264b Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 23 Dec 2009 17:54:22 +0000 Subject: [PATCH] Refactory: remove unused classes, imports, fields and methods. --- .../internal/core/CompilationUnitElementInfo.java | 6 +- .../phpdt/internal/core/CopyElementsOperation.java | 8 +- .../core/CopyResourceElementsOperation.java | 8 +- .../phpdt/internal/core/DeltaProcessingState.java | 268 +++++----- .../phpdt/internal/core/DeltaProcessor.java | 263 +++++----- .../phpdt/internal/core/JavaElementDelta.java | 48 +- .../internal/core/JavaElementDeltaBuilder.java | 14 +- .../phpdt/internal/core/JavaElementRequestor.java | 72 ++-- .../sourceforge/phpdt/internal/core/JavaModel.java | 32 +- .../phpdt/internal/core/JavaModelInfo.java | 68 ++-- .../phpdt/internal/core/JavaModelManager.java | 542 ++++++++++---------- .../phpdt/internal/core/JavaModelOperation.java | 86 ++-- .../phpdt/internal/core/JavaProject.java | 258 +++++----- .../internal/core/JavaProjectElementInfo.java | 286 +++++----- .../phpdt/internal/core/NameLookup.java | 256 +++++----- .../phpdt/internal/core/OverflowingLRUCache.java | 36 +- .../phpdt/internal/core/PackageFragmentInfo.java | 46 +- .../phpdt/internal/core/PackageFragmentRoot.java | 50 +- .../internal/core/PackageFragmentRootInfo.java | 20 +- .../core/ReconcileWorkingCopyOperation.java | 10 +- .../phpdt/internal/core/SearchableEnvironment.java | 14 +- .../core/SearchableEnvironmentRequestor.java | 8 +- .../internal/core/SourceFieldElementInfo.java | 8 +- .../phpdt/internal/core/SourceTypeElementInfo.java | 6 +- 24 files changed, 1209 insertions(+), 1204 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitElementInfo.java index 3ec282a..1b75d03 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitElementInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitElementInfo.java @@ -28,9 +28,9 @@ import net.sourceforge.phpdt.core.ISourceRange; /** * Returns the length of the source string. */ - public int getSourceLength() { - return sourceLength; - } +// public int getSourceLength() { +// return sourceLength; +// } protected ISourceRange getSourceRange() { return new SourceRange(0, sourceLength); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyElementsOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyElementsOperation.java index 825af93..a216c16 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyElementsOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyElementsOperation.java @@ -76,10 +76,10 @@ public class CopyElementsOperation extends MultiOperation { * When executed, this operation will copy the given elements to the given * container. */ - public CopyElementsOperation(IJavaElement[] elementsToCopy, - IJavaElement destContainer, boolean force) { - this(elementsToCopy, new IJavaElement[] { destContainer }, force); - } +// public CopyElementsOperation(IJavaElement[] elementsToCopy, +// IJavaElement destContainer, boolean force) { +// this(elementsToCopy, new IJavaElement[] { destContainer }, force); +// } /** * Returns the String to use as the main task name for diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java index fe25204..001c096 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java @@ -110,10 +110,10 @@ public class CopyResourceElementsOperation extends MultiOperation { * When executed, this operation will copy the given resources to the given * container. */ - public CopyResourceElementsOperation(IJavaElement[] resourcesToCopy, - IJavaElement destContainer, boolean force) { - this(resourcesToCopy, new IJavaElement[] { destContainer }, force); - } +// public CopyResourceElementsOperation(IJavaElement[] resourcesToCopy, +// IJavaElement destContainer, boolean force) { +// this(resourcesToCopy, new IJavaElement[] { destContainer }, force); +// } /** * Returns the children of source which are affected by this diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessingState.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessingState.java index 8df22ae..904991d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessingState.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessingState.java @@ -199,44 +199,44 @@ public class DeltaProcessingState implements IResourceChangeListener { * is reacting to some notification iteration by adding/changing/removing * any of the other (for example, if it deregisters itself). */ - public void addElementChangedListener(IElementChangedListener listener, - int eventMask) { - for (int i = 0; i < this.elementChangedListenerCount; i++) { - if (this.elementChangedListeners[i].equals(listener)) { - - // only clone the masks, since we could be in the middle of - // notifications and one listener decide to change - // any event mask of another listeners (yet not notified). - int cloneLength = this.elementChangedListenerMasks.length; - System - .arraycopy( - this.elementChangedListenerMasks, - 0, - this.elementChangedListenerMasks = new int[cloneLength], - 0, cloneLength); - this.elementChangedListenerMasks[i] = eventMask; // could be - // different - return; - } - } - // may need to grow, no need to clone, since iterators will have cached - // original arrays and max boundary and we only add to the end. - int length; - if ((length = this.elementChangedListeners.length) == this.elementChangedListenerCount) { - System - .arraycopy( - this.elementChangedListeners, - 0, - this.elementChangedListeners = new IElementChangedListener[length * 2], - 0, length); - System.arraycopy(this.elementChangedListenerMasks, 0, - this.elementChangedListenerMasks = new int[length * 2], 0, - length); - } - this.elementChangedListeners[this.elementChangedListenerCount] = listener; - this.elementChangedListenerMasks[this.elementChangedListenerCount] = eventMask; - this.elementChangedListenerCount++; - } +// public void addElementChangedListener(IElementChangedListener listener, +// int eventMask) { +// for (int i = 0; i < this.elementChangedListenerCount; i++) { +// if (this.elementChangedListeners[i].equals(listener)) { +// +// // only clone the masks, since we could be in the middle of +// // notifications and one listener decide to change +// // any event mask of another listeners (yet not notified). +// int cloneLength = this.elementChangedListenerMasks.length; +// System +// .arraycopy( +// this.elementChangedListenerMasks, +// 0, +// this.elementChangedListenerMasks = new int[cloneLength], +// 0, cloneLength); +// this.elementChangedListenerMasks[i] = eventMask; // could be +// // different +// return; +// } +// } +// // may need to grow, no need to clone, since iterators will have cached +// // original arrays and max boundary and we only add to the end. +// int length; +// if ((length = this.elementChangedListeners.length) == this.elementChangedListenerCount) { +// System +// .arraycopy( +// this.elementChangedListeners, +// 0, +// this.elementChangedListeners = new IElementChangedListener[length * 2], +// 0, length); +// System.arraycopy(this.elementChangedListenerMasks, 0, +// this.elementChangedListenerMasks = new int[length * 2], 0, +// length); +// } +// this.elementChangedListeners[this.elementChangedListenerCount] = listener; +// this.elementChangedListenerMasks[this.elementChangedListenerCount] = eventMask; +// this.elementChangedListenerCount++; +// } public void addPreResourceChangedListener(IResourceChangeListener listener) { for (int i = 0; i < this.preResourceChangeListenerCount; i++) { @@ -270,23 +270,23 @@ public class DeltaProcessingState implements IResourceChangeListener { return deltaProcessor; } - public void performClasspathResourceChange(JavaProject project, - IClasspathEntry[] oldResolvedPath, - IClasspathEntry[] newResolvedPath, IClasspathEntry[] newRawPath, - boolean canChangeResources) throws JavaModelException { - ProjectUpdateInfo info = new ProjectUpdateInfo(); - info.project = project; - info.oldResolvedPath = oldResolvedPath; - info.newResolvedPath = newResolvedPath; - info.newRawPath = newRawPath; - if (canChangeResources) { - this.projectUpdates.remove(project); // remove possibly awaiting - // one - info.updateProjectReferencesIfNecessary(); - return; - } - this.recordProjectUpdate(info); - } +// public void performClasspathResourceChange(JavaProject project, +// IClasspathEntry[] oldResolvedPath, +// IClasspathEntry[] newResolvedPath, IClasspathEntry[] newRawPath, +// boolean canChangeResources) throws JavaModelException { +// ProjectUpdateInfo info = new ProjectUpdateInfo(); +// info.project = project; +// info.oldResolvedPath = oldResolvedPath; +// info.newResolvedPath = newResolvedPath; +// info.newRawPath = newRawPath; +// if (canChangeResources) { +// this.projectUpdates.remove(project); // remove possibly awaiting +// // one +// info.updateProjectReferencesIfNecessary(); +// return; +// } +// this.recordProjectUpdate(info); +// } public void initializeRoots() { @@ -403,18 +403,18 @@ public class DeltaProcessingState implements IResourceChangeListener { } } - public synchronized void recordProjectUpdate(ProjectUpdateInfo newInfo) { - - JavaProject project = newInfo.project; - ProjectUpdateInfo oldInfo = (ProjectUpdateInfo) this.projectUpdates - .get(project); - if (oldInfo != null) { // refresh new classpath information - oldInfo.newRawPath = newInfo.newRawPath; - oldInfo.newResolvedPath = newInfo.newResolvedPath; - } else { - this.projectUpdates.put(project, newInfo); - } - } +// public synchronized void recordProjectUpdate(ProjectUpdateInfo newInfo) { +// +// JavaProject project = newInfo.project; +// ProjectUpdateInfo oldInfo = (ProjectUpdateInfo) this.projectUpdates +// .get(project); +// if (oldInfo != null) { // refresh new classpath information +// oldInfo.newRawPath = newInfo.newRawPath; +// oldInfo.newResolvedPath = newInfo.newResolvedPath; +// } else { +// this.projectUpdates.put(project, newInfo); +// } +// } public synchronized ProjectUpdateInfo[] removeAllProjectUpdates() { int length = this.projectUpdates.size(); @@ -426,73 +426,73 @@ public class DeltaProcessingState implements IResourceChangeListener { return updates; } - public void removeElementChangedListener(IElementChangedListener listener) { - - for (int i = 0; i < this.elementChangedListenerCount; i++) { - - if (this.elementChangedListeners[i].equals(listener)) { - - // need to clone defensively since we might be in the middle of - // listener notifications (#fire) - int length = this.elementChangedListeners.length; - IElementChangedListener[] newListeners = new IElementChangedListener[length]; - System.arraycopy(this.elementChangedListeners, 0, newListeners, - 0, i); - int[] newMasks = new int[length]; - System.arraycopy(this.elementChangedListenerMasks, 0, newMasks, - 0, i); - - // copy trailing listeners - int trailingLength = this.elementChangedListenerCount - i - 1; - if (trailingLength > 0) { - System.arraycopy(this.elementChangedListeners, i + 1, - newListeners, i, trailingLength); - System.arraycopy(this.elementChangedListenerMasks, i + 1, - newMasks, i, trailingLength); - } - - // update manager listener state (#fire need to iterate over - // original listeners through a local variable to hold onto - // the original ones) - this.elementChangedListeners = newListeners; - this.elementChangedListenerMasks = newMasks; - this.elementChangedListenerCount--; - return; - } - } - } - - public void removePreResourceChangedListener( - IResourceChangeListener listener) { - - for (int i = 0; i < this.preResourceChangeListenerCount; i++) { - - if (this.preResourceChangeListeners[i].equals(listener)) { - - // need to clone defensively since we might be in the middle of - // listener notifications (#fire) - int length = this.preResourceChangeListeners.length; - IResourceChangeListener[] newListeners = new IResourceChangeListener[length]; - System.arraycopy(this.preResourceChangeListeners, 0, - newListeners, 0, i); - - // copy trailing listeners - int trailingLength = this.preResourceChangeListenerCount - i - - 1; - if (trailingLength > 0) { - System.arraycopy(this.preResourceChangeListeners, i + 1, - newListeners, i, trailingLength); - } - - // update manager listener state (#fire need to iterate over - // original listeners through a local variable to hold onto - // the original ones) - this.preResourceChangeListeners = newListeners; - this.preResourceChangeListenerCount--; - return; - } - } - } +// public void removeElementChangedListener(IElementChangedListener listener) { +// +// for (int i = 0; i < this.elementChangedListenerCount; i++) { +// +// if (this.elementChangedListeners[i].equals(listener)) { +// +// // need to clone defensively since we might be in the middle of +// // listener notifications (#fire) +// int length = this.elementChangedListeners.length; +// IElementChangedListener[] newListeners = new IElementChangedListener[length]; +// System.arraycopy(this.elementChangedListeners, 0, newListeners, +// 0, i); +// int[] newMasks = new int[length]; +// System.arraycopy(this.elementChangedListenerMasks, 0, newMasks, +// 0, i); +// +// // copy trailing listeners +// int trailingLength = this.elementChangedListenerCount - i - 1; +// if (trailingLength > 0) { +// System.arraycopy(this.elementChangedListeners, i + 1, +// newListeners, i, trailingLength); +// System.arraycopy(this.elementChangedListenerMasks, i + 1, +// newMasks, i, trailingLength); +// } +// +// // update manager listener state (#fire need to iterate over +// // original listeners through a local variable to hold onto +// // the original ones) +// this.elementChangedListeners = newListeners; +// this.elementChangedListenerMasks = newMasks; +// this.elementChangedListenerCount--; +// return; +// } +// } +// } + +// public void removePreResourceChangedListener( +// IResourceChangeListener listener) { +// +// for (int i = 0; i < this.preResourceChangeListenerCount; i++) { +// +// if (this.preResourceChangeListeners[i].equals(listener)) { +// +// // need to clone defensively since we might be in the middle of +// // listener notifications (#fire) +// int length = this.preResourceChangeListeners.length; +// IResourceChangeListener[] newListeners = new IResourceChangeListener[length]; +// System.arraycopy(this.preResourceChangeListeners, 0, +// newListeners, 0, i); +// +// // copy trailing listeners +// int trailingLength = this.preResourceChangeListenerCount - i +// - 1; +// if (trailingLength > 0) { +// System.arraycopy(this.preResourceChangeListeners, i + 1, +// newListeners, i, trailingLength); +// } +// +// // update manager listener state (#fire need to iterate over +// // original listeners through a local variable to hold onto +// // the original ones) +// this.preResourceChangeListeners = newListeners; +// this.preResourceChangeListenerCount--; +// return; +// } +// } +// } public void resourceChanged(final IResourceChangeEvent event) { boolean isPostChange = event.getType() == IResourceChangeEvent.POST_CHANGE; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java index 11028bb..454705e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.core; -import java.io.File; +//import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -19,7 +19,7 @@ import java.util.Iterator; import java.util.Map; import net.sourceforge.phpdt.core.ElementChangedEvent; -import net.sourceforge.phpdt.core.IClasspathEntry; +//import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IElementChangedListener; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaElementDelta; @@ -40,12 +40,12 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; +//import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.ISafeRunnable; //import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.QualifiedName; +//import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.SafeRunner; /** @@ -317,28 +317,28 @@ public class DeltaProcessor implements IResourceChangeListener { * Adds the given project and its dependents to the list of the projects to * update. */ - void addToProjectsToUpdateWithDependents(IProject project) { - this.projectsToUpdate.add(JavaCore.create(project)); - // this.addDependentProjects(project.getFullPath(), - // this.projectsToUpdate); - } +// void addToProjectsToUpdateWithDependents(IProject project) { +// this.projectsToUpdate.add(JavaCore.create(project)); +// // this.addDependentProjects(project.getFullPath(), +// // this.projectsToUpdate); +// } /** * Adds the given child handle to its parent's cache of children. */ - protected void addToParentInfo(Openable child) { - - Openable parent = (Openable) child.getParent(); - if (parent != null && parent.isOpen()) { - try { - JavaElementInfo info = (JavaElementInfo) parent - .getElementInfo(); - info.addChild(child); - } catch (JavaModelException e) { - // do nothing - we already checked if open - } - } - } +// protected void addToParentInfo(Openable child) { +// +// Openable parent = (Openable) child.getParent(); +// if (parent != null && parent.isOpen()) { +// try { +// JavaElementInfo info = (JavaElementInfo) parent +// .getElementInfo(); +// info.addChild(child); +// } catch (JavaModelException e) { +// // do nothing - we already checked if open +// } +// } +// } /** * Check all external archive (referenced by given roots, projects or model) @@ -1209,91 +1209,91 @@ public class DeltaProcessor implements IResourceChangeListener { * Answer a combination of the lastModified stamp and the size. Used for * detecting external JAR changes */ - public static long getTimeStamp(File file) { - return file.lastModified() + file.length(); - } - - public void initializeRoots() { - // remember roots infos as old roots infos - this.oldRoots = this.roots == null ? new HashMap() : this.roots; - this.oldOtherRoots = this.otherRoots == null ? new HashMap() - : this.otherRoots; - - // recompute root infos only if necessary - if (!rootsAreStale) - return; - - this.roots = new HashMap(); - this.otherRoots = new HashMap(); - this.sourceAttachments = new HashMap(); - - IJavaModel model = this.manager.getJavaModel(); - IJavaProject[] projects; - try { - projects = model.getJavaProjects(); - } catch (JavaModelException e) { - // nothing can be done - return; - } - for (int i = 0, length = projects.length; i < length; i++) { - IJavaProject project = projects[i]; - IClasspathEntry[] classpath; - try { - classpath = project.getResolvedClasspath(true); - } catch (JavaModelException e) { - // continue with next project - continue; - } - for (int j = 0, classpathLength = classpath.length; j < classpathLength; j++) { - IClasspathEntry entry = classpath[j]; - if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) - continue; - - // root path - IPath path = entry.getPath(); - if (this.roots.get(path) == null) { - this.roots.put(path, new RootInfo(project, path, - ((ClasspathEntry) entry) - .fullExclusionPatternChars())); - } else { - ArrayList rootList = (ArrayList) this.otherRoots.get(path); - if (rootList == null) { - rootList = new ArrayList(); - this.otherRoots.put(path, rootList); - } - rootList.add(new RootInfo(project, path, - ((ClasspathEntry) entry) - .fullExclusionPatternChars())); - } +// public static long getTimeStamp(File file) { +// return file.lastModified() + file.length(); +// } - // source attachment path - if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY) - continue; - QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, - "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; - String propertyString = null; - try { - propertyString = ResourcesPlugin.getWorkspace().getRoot() - .getPersistentProperty(qName); - } catch (CoreException e) { - continue; - } - IPath sourceAttachmentPath; - // if (propertyString != null) { - // int index= - // propertyString.lastIndexOf(JarPackageFragmentRoot.ATTACHMENT_PROPERTY_DELIMITER); - // sourceAttachmentPath = (index < 0) ? new Path(propertyString) - // : new Path(propertyString.substring(0, index)); - // } else { - sourceAttachmentPath = entry.getSourceAttachmentPath(); - // } - if (sourceAttachmentPath != null) { - this.sourceAttachments.put(sourceAttachmentPath, path); - } - } - } - this.rootsAreStale = false; - } +// public void initializeRoots() { +// // remember roots infos as old roots infos +// this.oldRoots = this.roots == null ? new HashMap() : this.roots; +// this.oldOtherRoots = this.otherRoots == null ? new HashMap() +// : this.otherRoots; +// +// // recompute root infos only if necessary +// if (!rootsAreStale) +// return; +// +// this.roots = new HashMap(); +// this.otherRoots = new HashMap(); +// this.sourceAttachments = new HashMap(); +// +// IJavaModel model = this.manager.getJavaModel(); +// IJavaProject[] projects; +// try { +// projects = model.getJavaProjects(); +// } catch (JavaModelException e) { +// // nothing can be done +// return; +// } +// for (int i = 0, length = projects.length; i < length; i++) { +// IJavaProject project = projects[i]; +// IClasspathEntry[] classpath; +// try { +// classpath = project.getResolvedClasspath(true); +// } catch (JavaModelException e) { +// // continue with next project +// continue; +// } +// for (int j = 0, classpathLength = classpath.length; j < classpathLength; j++) { +// IClasspathEntry entry = classpath[j]; +// if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) +// continue; +// +// // root path +// IPath path = entry.getPath(); +// if (this.roots.get(path) == null) { +// this.roots.put(path, new RootInfo(project, path, +// ((ClasspathEntry) entry) +// .fullExclusionPatternChars())); +// } else { +// ArrayList rootList = (ArrayList) this.otherRoots.get(path); +// if (rootList == null) { +// rootList = new ArrayList(); +// this.otherRoots.put(path, rootList); +// } +// rootList.add(new RootInfo(project, path, +// ((ClasspathEntry) entry) +// .fullExclusionPatternChars())); +// } +// +// // source attachment path +// if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY) +// continue; +// QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, +// "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; +// String propertyString = null; +// try { +// propertyString = ResourcesPlugin.getWorkspace().getRoot() +// .getPersistentProperty(qName); +// } catch (CoreException e) { +// continue; +// } +// IPath sourceAttachmentPath; +// // if (propertyString != null) { +// // int index= +// // propertyString.lastIndexOf(JarPackageFragmentRoot.ATTACHMENT_PROPERTY_DELIMITER); +// // sourceAttachmentPath = (index < 0) ? new Path(propertyString) +// // : new Path(propertyString.substring(0, index)); +// // } else { +// sourceAttachmentPath = entry.getSourceAttachmentPath(); +// // } +// if (sourceAttachmentPath != null) { +// this.sourceAttachments.put(sourceAttachmentPath, path); +// } +// } +// } +// this.rootsAreStale = false; +// } /* * Returns whether a given delta contains some information relevant to the @@ -1305,6 +1305,11 @@ public class DeltaProcessor implements IResourceChangeListener { if (rootDelta != null) { // use local exception to quickly escape from delta traversal class FoundRelevantDeltaException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = -7732598607464929404L; } try { rootDelta.accept(new IResourceDeltaVisitor() { @@ -2347,15 +2352,15 @@ public class DeltaProcessor implements IResourceChangeListener { /* * Finds the root info this path is included in. Returns null if not found. */ - RootInfo enclosingRootInfo(IPath path, int kind) { - while (path != null && path.segmentCount() > 0) { - RootInfo rootInfo = this.rootInfo(path, kind); - if (rootInfo != null) - return rootInfo; - path = path.removeLastSegments(1); - } - return null; - } +// RootInfo enclosingRootInfo(IPath path, int kind) { +// while (path != null && path.segmentCount() > 0) { +// RootInfo rootInfo = this.rootInfo(path, kind); +// if (rootInfo != null) +// return rootInfo; +// path = path.removeLastSegments(1); +// } +// return null; +// } /* * Fire Java Model delta, flushing them after the fact after post_change @@ -2456,25 +2461,25 @@ public class DeltaProcessor implements IResourceChangeListener { * Returns the root info for the given path. Look in the old roots table if * kind is REMOVED. */ - RootInfo rootInfo(IPath path, int kind) { - if (kind == IResourceDelta.REMOVED) { - return (RootInfo) this.oldRoots.get(path); - } else { - return (RootInfo) this.roots.get(path); - } - } +// RootInfo rootInfo(IPath path, int kind) { +// if (kind == IResourceDelta.REMOVED) { +// return (RootInfo) this.oldRoots.get(path); +// } else { +// return (RootInfo) this.roots.get(path); +// } +// } /* * Returns the other root infos for the given path. Look in the old other * roots table if kind is REMOVED. */ - ArrayList otherRootsInfo(IPath path, int kind) { - if (kind == IResourceDelta.REMOVED) { - return (ArrayList) this.oldOtherRoots.get(path); - } else { - return (ArrayList) this.otherRoots.get(path); - } - } +// ArrayList otherRootsInfo(IPath path, int kind) { +// if (kind == IResourceDelta.REMOVED) { +// return (ArrayList) this.oldOtherRoots.get(path); +// } else { +// return (ArrayList) this.otherRoots.get(path); +// } +// } /** * Converts an IResourceDelta and its children into the diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDelta.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDelta.java index 4e3ef02..6ca12ff 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDelta.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDelta.java @@ -318,12 +318,12 @@ public class JavaElementDelta extends SimpleDelta implements IJavaElementDelta { /** * Creates the nested deltas for a closed element. */ - public void closed(IJavaElement element) { - JavaElementDelta delta = new JavaElementDelta(element); - delta.fKind = CHANGED; - delta.fChangeFlags |= F_CLOSED; - insertDeltaTree(element, delta); - } +// public void closed(IJavaElement element) { +// JavaElementDelta delta = new JavaElementDelta(element); +// delta.fKind = CHANGED; +// delta.fChangeFlags |= F_CLOSED; +// insertDeltaTree(element, delta); +// } /** * Creates the nested delta deltas based on the affected element its delta, @@ -635,12 +635,12 @@ public class JavaElementDelta extends SimpleDelta implements IJavaElementDelta { /** * Creates the nested deltas for an opened element. */ - public void opened(IJavaElement element) { - JavaElementDelta delta = new JavaElementDelta(element); - delta.fKind = CHANGED; - delta.fChangeFlags |= F_OPENED; - insertDeltaTree(element, delta); - } +// public void opened(IJavaElement element) { +// JavaElementDelta delta = new JavaElementDelta(element); +// delta.fKind = CHANGED; +// delta.fChangeFlags |= F_OPENED; +// insertDeltaTree(element, delta); +// } /** * Removes the child delta from the collection of affected children. @@ -705,12 +705,12 @@ public class JavaElementDelta extends SimpleDelta implements IJavaElementDelta { * create the root delta and then a change operation should call this * method. */ - public void sourceAttached(IJavaElement element) { - JavaElementDelta attachedDelta = new JavaElementDelta(element); - attachedDelta.fKind = CHANGED; - attachedDelta.fChangeFlags |= F_SOURCEATTACHED; - insertDeltaTree(element, attachedDelta); - } +// public void sourceAttached(IJavaElement element) { +// JavaElementDelta attachedDelta = new JavaElementDelta(element); +// attachedDelta.fKind = CHANGED; +// attachedDelta.fChangeFlags |= F_SOURCEATTACHED; +// insertDeltaTree(element, attachedDelta); +// } /** * Creates the nested deltas resulting from a change operation. Convenience @@ -718,12 +718,12 @@ public class JavaElementDelta extends SimpleDelta implements IJavaElementDelta { * create the root delta and then a change operation should call this * method. */ - public void sourceDetached(IJavaElement element) { - JavaElementDelta detachedDelta = new JavaElementDelta(element); - detachedDelta.fKind = CHANGED; - detachedDelta.fChangeFlags |= F_SOURCEDETACHED; - insertDeltaTree(element, detachedDelta); - } +// public void sourceDetached(IJavaElement element) { +// JavaElementDelta detachedDelta = new JavaElementDelta(element); +// detachedDelta.fKind = CHANGED; +// detachedDelta.fChangeFlags |= F_SOURCEDETACHED; +// insertDeltaTree(element, detachedDelta); +// } /** * Returns a string representation of this delta's structure suitable for diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDeltaBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDeltaBuilder.java index 709cfef..7928158 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDeltaBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementDeltaBuilder.java @@ -100,13 +100,13 @@ public class JavaElementDeltaBuilder { * Creates a java element comparator on a java element looking only * 'maxDepth' levels deep. */ - public JavaElementDeltaBuilder(IJavaElement javaElement, int maxDepth) { - this.javaElement = javaElement; - this.maxDepth = maxDepth; - this.initialize(); - this.recordElementInfo(javaElement, (JavaModel) this.javaElement - .getJavaModel(), 0); - } +// public JavaElementDeltaBuilder(IJavaElement javaElement, int maxDepth) { +// this.javaElement = javaElement; +// this.maxDepth = maxDepth; +// this.initialize(); +// this.recordElementInfo(javaElement, (JavaModel) this.javaElement +// .getJavaModel(), 0); +// } /** * Repairs the positioning information after an element has been added diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementRequestor.java index 00fa191..219600d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementRequestor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaElementRequestor.java @@ -139,15 +139,15 @@ public class JavaElementRequestor implements IJavaElementRequestor { /** * @see IJavaElementRequestor */ - public IField[] getFields() { - if (fFields == null) { - return fgEmptyFieldArray; - } - int size = fFields.size(); - IField[] results = new IField[size]; - fFields.toArray(results); - return results; - } +// public IField[] getFields() { +// if (fFields == null) { +// return fgEmptyFieldArray; +// } +// int size = fFields.size(); +// IField[] results = new IField[size]; +// fFields.toArray(results); +// return results; +// } /** * @see IJavaElementRequestor @@ -164,28 +164,28 @@ public class JavaElementRequestor implements IJavaElementRequestor { /** * @see IJavaElementRequestor */ - public IType[] getMemberTypes() { - if (fMemberTypes == null) { - return fgEmptyTypeArray; - } - int size = fMemberTypes.size(); - IType[] results = new IType[size]; - fMemberTypes.toArray(results); - return results; - } +// public IType[] getMemberTypes() { +// if (fMemberTypes == null) { +// return fgEmptyTypeArray; +// } +// int size = fMemberTypes.size(); +// IType[] results = new IType[size]; +// fMemberTypes.toArray(results); +// return results; +// } /** * @see IJavaElementRequestor */ - public IMethod[] getMethods() { - if (fMethods == null) { - return fgEmptyMethodArray; - } - int size = fMethods.size(); - IMethod[] results = new IMethod[size]; - fMethods.toArray(results); - return results; - } +// public IMethod[] getMethods() { +// if (fMethods == null) { +// return fgEmptyMethodArray; +// } +// int size = fMethods.size(); +// IMethod[] results = new IMethod[size]; +// fMethods.toArray(results); +// return results; +// } /** * @see IJavaElementRequestor @@ -203,15 +203,15 @@ public class JavaElementRequestor implements IJavaElementRequestor { /** * @see IJavaElementRequestor */ - public IType[] getTypes() { - if (fTypes == null) { - return fgEmptyTypeArray; - } - int size = fTypes.size(); - IType[] results = new IType[size]; - fTypes.toArray(results); - return results; - } +// public IType[] getTypes() { +// if (fTypes == null) { +// return fgEmptyTypeArray; +// } +// int size = fTypes.size(); +// IType[] results = new IType[size]; +// fTypes.toArray(results); +// return results; +// } /** * @see IJavaElementRequestor diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java index 23ab5ef..795d489 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModel.java @@ -185,22 +185,22 @@ public class JavaModel extends Openable implements IJavaModel { /** */ - protected boolean generateInfos(OpenableElementInfo info, - IProgressMonitor pm, Map newElements, IResource underlyingResource) - throws JavaModelException { - - JavaModelManager.getJavaModelManager().putInfo(this, info); - // determine my children - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() - .getProjects(); - for (int i = 0, max = projects.length; i < max; i++) { - IProject project = projects[i]; - if (JavaProject.hasJavaNature(project)) { - info.addChild(getJavaProject(project)); - } - } - return true; - } +// protected boolean generateInfos(OpenableElementInfo info, +// IProgressMonitor pm, Map newElements, IResource underlyingResource) +// throws JavaModelException { +// +// JavaModelManager.getJavaModelManager().putInfo(this, info); +// // determine my children +// IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() +// .getProjects(); +// for (int i = 0, max = projects.length; i < max; i++) { +// IProject project = projects[i]; +// if (JavaProject.hasJavaNature(project)) { +// info.addChild(getJavaProject(project)); +// } +// } +// return true; +// } /** * Returns the IJavaElement represented by the diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelInfo.java index 4dce222..b77f855 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelInfo.java @@ -12,8 +12,8 @@ package net.sourceforge.phpdt.internal.core; import net.sourceforge.phpdt.core.IJavaModel; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; +//import org.eclipse.core.resources.IProject; +//import org.eclipse.core.resources.ResourcesPlugin; /** * Implementation of IJavaModel. A Java Model is specific to a workspace. @@ -36,40 +36,40 @@ public class JavaModelInfo extends OpenableElementInfo { /** * Compute the non-java resources contained in this java project. */ - private Object[] computeNonJavaResources() { - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() - .getProjects(); - int length = projects.length; - Object[] nonJavaResources = null; - int index = 0; - for (int i = 0; i < length; i++) { - IProject project = projects[i]; - if (!JavaProject.hasJavaNature(project)) { - if (nonJavaResources == null) { - nonJavaResources = new Object[length]; - } - nonJavaResources[index++] = project; - } - } - if (index == 0) - return NO_NON_JAVA_RESOURCES; - if (index < length) { - System.arraycopy(nonJavaResources, 0, - nonJavaResources = new Object[index], 0, index); - } - return nonJavaResources; - } +// private Object[] computeNonJavaResources() { +// IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() +// .getProjects(); +// int length = projects.length; +// Object[] nonJavaResources = null; +// int index = 0; +// for (int i = 0; i < length; i++) { +// IProject project = projects[i]; +// if (!JavaProject.hasJavaNature(project)) { +// if (nonJavaResources == null) { +// nonJavaResources = new Object[length]; +// } +// nonJavaResources[index++] = project; +// } +// } +// if (index == 0) +// return NO_NON_JAVA_RESOURCES; +// if (index < length) { +// System.arraycopy(nonJavaResources, 0, +// nonJavaResources = new Object[index], 0, index); +// } +// return nonJavaResources; +// } /** * Returns an array of non-java resources contained in the receiver. */ - Object[] getNonJavaResources() { - - Object[] nonJavaResources = this.nonJavaResources; - if (nonJavaResources == null) { - nonJavaResources = computeNonJavaResources(); - this.nonJavaResources = nonJavaResources; - } - return nonJavaResources; - } +// Object[] getNonJavaResources() { +// +// Object[] nonJavaResources = this.nonJavaResources; +// if (nonJavaResources == null) { +// nonJavaResources = computeNonJavaResources(); +// this.nonJavaResources = nonJavaResources; +// } +// return nonJavaResources; +// } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java index fd46139..4d83115 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java @@ -26,7 +26,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.WeakHashMap; -import java.util.zip.ZipFile; +//import java.util.zip.ZipFile; import net.sourceforge.phpdt.core.ElementChangedEvent; import net.sourceforge.phpdt.core.IClasspathEntry; @@ -57,10 +57,10 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.ISaveContext; import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceDescription; +//import org.eclipse.core.resources.IWorkspace; +//import org.eclipse.core.resources.IWorkspaceDescription; import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; +//import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; @@ -69,7 +69,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; +//import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.core.runtime.Status; @@ -154,11 +154,11 @@ public class JavaModelManager implements ISaveParticipant { // public String toString() { return getDescription(); } // }; - private static final String INDEX_MANAGER_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/indexmanager"; //$NON-NLS-1$ +// private static final String INDEX_MANAGER_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/indexmanager"; //$NON-NLS-1$ - private static final String COMPILER_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/compiler"; //$NON-NLS-1$ +// private static final String COMPILER_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/compiler"; //$NON-NLS-1$ private static final String JAVAMODEL_DEBUG = PHPeclipsePlugin.PLUGIN_ID + "/debug/javamodel"; //$NON-NLS-1$ @@ -172,8 +172,8 @@ public class JavaModelManager implements ISaveParticipant { private static final String DELTA_DEBUG = PHPeclipsePlugin.PLUGIN_ID + "/debug/javadelta"; //$NON-NLS-1$ - private static final String HIERARCHY_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/hierarchy"; //$NON-NLS-1$ +// private static final String HIERARCHY_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/hierarchy"; //$NON-NLS-1$ private static final String POST_ACTION_DEBUG = PHPeclipsePlugin.PLUGIN_ID + "/debug/postaction"; //$NON-NLS-1$ @@ -181,17 +181,17 @@ public class JavaModelManager implements ISaveParticipant { private static final String BUILDER_DEBUG = PHPeclipsePlugin.PLUGIN_ID + "/debug/builder"; //$NON-NLS-1$ - private static final String COMPLETION_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/completion"; //$NON-NLS-1$ +// private static final String COMPLETION_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/completion"; //$NON-NLS-1$ - private static final String SELECTION_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/selection"; //$NON-NLS-1$ - - private static final String SHARED_WC_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/sharedworkingcopy"; //$NON-NLS-1$ - - private static final String SEARCH_DEBUG = PHPeclipsePlugin.PLUGIN_ID - + "/debug/search"; //$NON-NLS-1$ +// private static final String SELECTION_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/selection"; //$NON-NLS-1$ +// +// private static final String SHARED_WC_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/sharedworkingcopy"; //$NON-NLS-1$ +// +// private static final String SEARCH_DEBUG = PHPeclipsePlugin.PLUGIN_ID +// + "/debug/search"; //$NON-NLS-1$ public final static IWorkingCopy[] NoWorkingCopy = new IWorkingCopy[0]; @@ -802,7 +802,7 @@ public class JavaModelManager implements ISaveParticipant { * to java.io.ZipFile) NOTE: this object itself is used as a lock to * synchronize creation/removal of entries */ - private HashMap zipFiles = new HashMap(); + //private HashMap zipFiles = new HashMap(); /** * Update the classpath variable cache @@ -848,11 +848,11 @@ public class JavaModelManager implements ISaveParticipant { /** * @deprecated - discard once debug has converted to not using it */ - public void addElementChangedListener(IElementChangedListener listener) { - this.addElementChangedListener(listener, - ElementChangedEvent.POST_CHANGE - | ElementChangedEvent.POST_RECONCILE); - } +// public void addElementChangedListener(IElementChangedListener listener) { +// this.addElementChangedListener(listener, +// ElementChangedEvent.POST_CHANGE +// | ElementChangedEvent.POST_RECONCILE); +// } /** * addElementChangedListener method comment. Need to clone defensively the @@ -902,32 +902,32 @@ public class JavaModelManager implements ISaveParticipant { /** * Starts caching ZipFiles. Ignores if there are already clients. */ - public void cacheZipFiles() { - synchronized (this.zipFiles) { - Thread currentThread = Thread.currentThread(); - if (this.zipFiles.get(currentThread) != null) - return; - this.zipFiles.put(currentThread, new HashMap()); - } - } - - public void closeZipFile(ZipFile zipFile) { - if (zipFile == null) - return; - synchronized (this.zipFiles) { - if (this.zipFiles.get(Thread.currentThread()) != null) { - return; // zip file will be closed by call to flushZipFiles - } - try { - if (JavaModelManager.ZIP_ACCESS_VERBOSE) { - System.out - .println("(" + Thread.currentThread() + ") [JavaModelManager.closeZipFile(ZipFile)] Closing ZipFile on " + zipFile.getName()); //$NON-NLS-1$ //$NON-NLS-2$ - } - zipFile.close(); - } catch (IOException e) { - } - } - } +// public void cacheZipFiles() { +// synchronized (this.zipFiles) { +// Thread currentThread = Thread.currentThread(); +// if (this.zipFiles.get(currentThread) != null) +// return; +// this.zipFiles.put(currentThread, new HashMap()); +// } +// } + +// public void closeZipFile(ZipFile zipFile) { +// if (zipFile == null) +// return; +// synchronized (this.zipFiles) { +// if (this.zipFiles.get(Thread.currentThread()) != null) { +// return; // zip file will be closed by call to flushZipFiles +// } +// try { +// if (JavaModelManager.ZIP_ACCESS_VERBOSE) { +// System.out +// .println("(" + Thread.currentThread() + ") [JavaModelManager.closeZipFile(ZipFile)] Closing ZipFile on " + zipFile.getName()); //$NON-NLS-1$ //$NON-NLS-2$ +// } +// zipFile.close(); +// } catch (IOException e) { +// } +// } +// } /** * Configure the plugin with respect to option settings defined in @@ -1221,26 +1221,26 @@ public class JavaModelManager implements ISaveParticipant { /** * Flushes ZipFiles cache if there are no more clients. */ - public void flushZipFiles() { - synchronized (this.zipFiles) { - Thread currentThread = Thread.currentThread(); - HashMap map = (HashMap) this.zipFiles.remove(currentThread); - if (map == null) - return; - Iterator iterator = map.values().iterator(); - while (iterator.hasNext()) { - try { - ZipFile zipFile = (ZipFile) iterator.next(); - if (JavaModelManager.ZIP_ACCESS_VERBOSE) { - System.out - .println("(" + currentThread + ") [JavaModelManager.flushZipFiles()] Closing ZipFile on " + zipFile.getName()); //$NON-NLS-1$//$NON-NLS-2$ - } - zipFile.close(); - } catch (IOException e) { - } - } - } - } +// public void flushZipFiles() { +// synchronized (this.zipFiles) { +// Thread currentThread = Thread.currentThread(); +// HashMap map = (HashMap) this.zipFiles.remove(currentThread); +// if (map == null) +// return; +// Iterator iterator = map.values().iterator(); +// while (iterator.hasNext()) { +// try { +// ZipFile zipFile = (ZipFile) iterator.next(); +// if (JavaModelManager.ZIP_ACCESS_VERBOSE) { +// System.out +// .println("(" + currentThread + ") [JavaModelManager.flushZipFiles()] Closing ZipFile on " + zipFile.getName()); //$NON-NLS-1$//$NON-NLS-2$ +// } +// zipFile.close(); +// } catch (IOException e) { +// } +// } +// } +// } public DeltaProcessor getDeltaProcessor() { return this.deltaState.getDeltaProcessor(); @@ -1445,31 +1445,31 @@ public class JavaModelManager implements ISaveParticipant { * Returns the name of the variables for which an CP variable initializer is * registered through an extension point */ - public static String[] getRegisteredVariableNames() { - - Plugin jdtCorePlugin = JavaCore.getPlugin(); - if (jdtCorePlugin == null) - return null; - - ArrayList variableList = new ArrayList(5); - // IExtensionPoint extension = - // jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); - // if (extension != null) { - // IExtension[] extensions = extension.getExtensions(); - // for(int i = 0; i < extensions.length; i++){ - // IConfigurationElement [] configElements = - // extensions[i].getConfigurationElements(); - // for(int j = 0; j < configElements.length; j++){ - // String varAttribute = configElements[j].getAttribute("variable"); - // //$NON-NLS-1$ - // if (varAttribute != null) variableList.add(varAttribute); - // } - // } - // } - String[] variableNames = new String[variableList.size()]; - variableList.toArray(variableNames); - return variableNames; - } +// public static String[] getRegisteredVariableNames() { +// +// Plugin jdtCorePlugin = JavaCore.getPlugin(); +// if (jdtCorePlugin == null) +// return null; +// +// ArrayList variableList = new ArrayList(5); +// // IExtensionPoint extension = +// // jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); +// // if (extension != null) { +// // IExtension[] extensions = extension.getExtensions(); +// // for(int i = 0; i < extensions.length; i++){ +// // IConfigurationElement [] configElements = +// // extensions[i].getConfigurationElements(); +// // for(int j = 0; j < configElements.length; j++){ +// // String varAttribute = configElements[j].getAttribute("variable"); +// // //$NON-NLS-1$ +// // if (varAttribute != null) variableList.add(varAttribute); +// // } +// // } +// // } +// String[] variableNames = new String[variableList.size()]; +// variableList.toArray(variableNames); +// return variableNames; +// } /** * Returns the name of the container IDs for which an CP container @@ -1530,74 +1530,74 @@ public class JavaModelManager implements ISaveParticipant { * @exception CoreException * If unable to create/open the ZipFile */ - public ZipFile getZipFile(IPath path) throws CoreException { - - synchronized (this.zipFiles) { // TODO: use PeThreadObject which does - // synchronization - Thread currentThread = Thread.currentThread(); - HashMap map = null; - ZipFile zipFile; - if ((map = (HashMap) this.zipFiles.get(currentThread)) != null - && (zipFile = (ZipFile) map.get(path)) != null) { - - return zipFile; - } - String fileSystemPath = null; - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource file = root.findMember(path); - if (path.isAbsolute() && file != null) { - if (file == null) { // external file - fileSystemPath = path.toOSString(); - } else { // internal resource (not an IFile or not existing) - IPath location; - if (file.getType() != IResource.FILE - || (location = file.getFullPath()) == null) { - throw new CoreException( - new Status( - IStatus.ERROR, - JavaCore.PLUGIN_ID, - -1, - Util - .bind( - "file.notFound", path.toString()), null)); //$NON-NLS-1$ - } - fileSystemPath = location.toOSString(); - } - } else if (!path.isAbsolute()) { - file = root.getFile(path); - if (file == null || file.getType() != IResource.FILE) { - throw new CoreException(new Status(IStatus.ERROR, - JavaCore.PLUGIN_ID, -1, Util.bind( - "file.notFound", path.toString()), null)); //$NON-NLS-1$ - } - IPath location = file.getFullPath(); - if (location == null) { - throw new CoreException(new Status(IStatus.ERROR, - JavaCore.PLUGIN_ID, -1, Util.bind( - "file.notFound", path.toString()), null)); //$NON-NLS-1$ - } - fileSystemPath = location.toOSString(); - } else { - fileSystemPath = path.toOSString(); - } - - try { - if (ZIP_ACCESS_VERBOSE) { - System.out - .println("(" + currentThread + ") [JavaModelManager.getZipFile(IPath)] Creating ZipFile on " + fileSystemPath); //$NON-NLS-1$ //$NON-NLS-2$ - } - zipFile = new ZipFile(fileSystemPath); - if (map != null) { - map.put(path, zipFile); - } - return zipFile; - } catch (IOException e) { - throw new CoreException(new Status(Status.ERROR, - JavaCore.PLUGIN_ID, -1, - Util.bind("status.IOException"), e)); //$NON-NLS-1$ - } - } - } +// public ZipFile getZipFile(IPath path) throws CoreException { +// +// synchronized (this.zipFiles) { // TODO: use PeThreadObject which does +// // synchronization +// Thread currentThread = Thread.currentThread(); +// HashMap map = null; +// ZipFile zipFile; +// if ((map = (HashMap) this.zipFiles.get(currentThread)) != null +// && (zipFile = (ZipFile) map.get(path)) != null) { +// +// return zipFile; +// } +// String fileSystemPath = null; +// IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); +// IResource file = root.findMember(path); +// if (path.isAbsolute() && file != null) { +// if (file == null) { // external file +// fileSystemPath = path.toOSString(); +// } else { // internal resource (not an IFile or not existing) +// IPath location; +// if (file.getType() != IResource.FILE +// || (location = file.getFullPath()) == null) { +// throw new CoreException( +// new Status( +// IStatus.ERROR, +// JavaCore.PLUGIN_ID, +// -1, +// Util +// .bind( +// "file.notFound", path.toString()), null)); //$NON-NLS-1$ +// } +// fileSystemPath = location.toOSString(); +// } +// } else if (!path.isAbsolute()) { +// file = root.getFile(path); +// if (file == null || file.getType() != IResource.FILE) { +// throw new CoreException(new Status(IStatus.ERROR, +// JavaCore.PLUGIN_ID, -1, Util.bind( +// "file.notFound", path.toString()), null)); //$NON-NLS-1$ +// } +// IPath location = file.getFullPath(); +// if (location == null) { +// throw new CoreException(new Status(IStatus.ERROR, +// JavaCore.PLUGIN_ID, -1, Util.bind( +// "file.notFound", path.toString()), null)); //$NON-NLS-1$ +// } +// fileSystemPath = location.toOSString(); +// } else { +// fileSystemPath = path.toOSString(); +// } +// +// try { +// if (ZIP_ACCESS_VERBOSE) { +// System.out +// .println("(" + currentThread + ") [JavaModelManager.getZipFile(IPath)] Creating ZipFile on " + fileSystemPath); //$NON-NLS-1$ //$NON-NLS-2$ +// } +// zipFile = new ZipFile(fileSystemPath); +// if (map != null) { +// map.put(path, zipFile); +// } +// return zipFile; +// } catch (IOException e) { +// throw new CoreException(new Status(Status.ERROR, +// JavaCore.PLUGIN_ID, -1, +// Util.bind("status.IOException"), e)); //$NON-NLS-1$ +// } +// } +// } /* * Returns whether there is a temporary cache for the current thread. @@ -1778,9 +1778,9 @@ public class JavaModelManager implements ISaveParticipant { public void prepareToSave(ISaveContext context) throws CoreException { } - protected void putInfo(IJavaElement element, Object info) { - this.cache.putInfo(element, info); - } +// protected void putInfo(IJavaElement element, Object info) { +// this.cache.putInfo(element, info); +// } /* * Puts the infos in the given map (keys are IJavaElements and values are @@ -2247,66 +2247,66 @@ public class JavaModelManager implements ISaveParticipant { * Record the order in which to build the java projects (batch build). This * order is based on the projects classpath settings. */ - protected void setBuildOrder(String[] javaBuildOrder) - throws JavaModelException { - - // optional behaviour - // possible value of index 0 is Compute - if (!JavaCore.COMPUTE.equals(JavaCore - .getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) - return; // cannot be customized at project level - - if (javaBuildOrder == null || javaBuildOrder.length <= 1) - return; - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceDescription description = workspace.getDescription(); - String[] wksBuildOrder = description.getBuildOrder(); - - String[] newOrder; - if (wksBuildOrder == null) { - newOrder = javaBuildOrder; - } else { - // remove projects which are already mentionned in java builder - // order - int javaCount = javaBuildOrder.length; - HashMap newSet = new HashMap(javaCount); // create a set for fast - // check - for (int i = 0; i < javaCount; i++) { - newSet.put(javaBuildOrder[i], javaBuildOrder[i]); - } - int removed = 0; - int oldCount = wksBuildOrder.length; - for (int i = 0; i < oldCount; i++) { - if (newSet.containsKey(wksBuildOrder[i])) { - wksBuildOrder[i] = null; - removed++; - } - } - // add Java ones first - newOrder = new String[oldCount - removed + javaCount]; - System.arraycopy(javaBuildOrder, 0, newOrder, 0, javaCount); // java - // projects - // are - // built - // first - - // copy previous items in their respective order - int index = javaCount; - for (int i = 0; i < oldCount; i++) { - if (wksBuildOrder[i] != null) { - newOrder[index++] = wksBuildOrder[i]; - } - } - } - // commit the new build order out - description.setBuildOrder(newOrder); - try { - workspace.setDescription(description); - } catch (CoreException e) { - throw new JavaModelException(e); - } - } +// protected void setBuildOrder(String[] javaBuildOrder) +// throws JavaModelException { +// +// // optional behaviour +// // possible value of index 0 is Compute +// if (!JavaCore.COMPUTE.equals(JavaCore +// .getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) +// return; // cannot be customized at project level +// +// if (javaBuildOrder == null || javaBuildOrder.length <= 1) +// return; +// +// IWorkspace workspace = ResourcesPlugin.getWorkspace(); +// IWorkspaceDescription description = workspace.getDescription(); +// String[] wksBuildOrder = description.getBuildOrder(); +// +// String[] newOrder; +// if (wksBuildOrder == null) { +// newOrder = javaBuildOrder; +// } else { +// // remove projects which are already mentionned in java builder +// // order +// int javaCount = javaBuildOrder.length; +// HashMap newSet = new HashMap(javaCount); // create a set for fast +// // check +// for (int i = 0; i < javaCount; i++) { +// newSet.put(javaBuildOrder[i], javaBuildOrder[i]); +// } +// int removed = 0; +// int oldCount = wksBuildOrder.length; +// for (int i = 0; i < oldCount; i++) { +// if (newSet.containsKey(wksBuildOrder[i])) { +// wksBuildOrder[i] = null; +// removed++; +// } +// } +// // add Java ones first +// newOrder = new String[oldCount - removed + javaCount]; +// System.arraycopy(javaBuildOrder, 0, newOrder, 0, javaCount); // java +// // projects +// // are +// // built +// // first +// +// // copy previous items in their respective order +// int index = javaCount; +// for (int i = 0; i < oldCount; i++) { +// if (wksBuildOrder[i] != null) { +// newOrder[index++] = wksBuildOrder[i]; +// } +// } +// } +// // commit the new build order out +// description.setBuildOrder(newOrder); +// try { +// workspace.setDescription(description); +// } catch (CoreException e) { +// throw new JavaModelException(e); +// } +// } /** * Sets the last built state for the given project, or null to reset it. @@ -2350,17 +2350,17 @@ public class JavaModelManager implements ISaveParticipant { * Turns the firing mode to on. That is, deltas that are/have been * registered will be fired. */ - public void startDeltas() { - this.isFiring = true; - } +// public void startDeltas() { +// this.isFiring = true; +// } /** * Turns the firing mode to off. That is, deltas that are/have been * registered will not be fired until deltas are started again. */ - public void stopDeltas() { - this.isFiring = false; - } +// public void stopDeltas() { +// this.isFiring = false; +// } /** * Update Java Model given some delta @@ -2382,42 +2382,42 @@ public class JavaModelManager implements ISaveParticipant { return (IPath) Variables.get(variableName); } - public static String[] variableNames() { - int length = Variables.size(); - String[] result = new String[length]; - Iterator vars = Variables.keySet().iterator(); - int index = 0; - while (vars.hasNext()) { - result[index++] = (String) vars.next(); - } - return result; - } - - public static void variablePut(String variableName, IPath variablePath) { - - // update cache - do not only rely on listener refresh - if (variablePath == null) { - Variables.remove(variableName); - PreviousSessionVariables.remove(variableName); - } else { - Variables.put(variableName, variablePath); - } - - // do not write out intermediate initialization value - if (variablePath == JavaModelManager.VariableInitializationInProgress) { - return; - } - Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); - String variableKey = CP_VARIABLE_PREFERENCES_PREFIX + variableName; - String variableString = variablePath == null ? CP_ENTRY_IGNORE - : variablePath.toString(); - preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this - // default to - // get rid of - // removed ones - preferences.setValue(variableKey, variableString); - JavaCore.getPlugin().savePluginPreferences(); - } +// public static String[] variableNames() { +// int length = Variables.size(); +// String[] result = new String[length]; +// Iterator vars = Variables.keySet().iterator(); +// int index = 0; +// while (vars.hasNext()) { +// result[index++] = (String) vars.next(); +// } +// return result; +// } + +// public static void variablePut(String variableName, IPath variablePath) { +// +// // update cache - do not only rely on listener refresh +// if (variablePath == null) { +// Variables.remove(variableName); +// PreviousSessionVariables.remove(variableName); +// } else { +// Variables.put(variableName, variablePath); +// } +// +// // do not write out intermediate initialization value +// if (variablePath == JavaModelManager.VariableInitializationInProgress) { +// return; +// } +// Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); +// String variableKey = CP_VARIABLE_PREFERENCES_PREFIX + variableName; +// String variableString = variablePath == null ? CP_ENTRY_IGNORE +// : variablePath.toString(); +// preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this +// // default to +// // get rid of +// // removed ones +// preferences.setValue(variableKey, variableString); +// JavaCore.getPlugin().savePluginPreferences(); +// } /* * Returns all the working copies which have the given owner. Adds the diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelOperation.java index 89a9a40..0803cd0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelOperation.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.core; -import java.io.InputStream; +//import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -27,7 +27,7 @@ import net.sourceforge.phpdt.internal.core.util.PerThreadObject; import net.sourceforge.phpdt.internal.core.util.Util; import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; +//import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceStatus; @@ -188,17 +188,17 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, /** * Common constructor for all Java Model operations. */ - protected JavaModelOperation(IJavaElement element) { - fElementsToProcess = new IJavaElement[] { element }; - } +// protected JavaModelOperation(IJavaElement element) { +// fElementsToProcess = new IJavaElement[] { element }; +// } /** * A common constructor for all Java Model operations. */ - protected JavaModelOperation(IJavaElement element, boolean force) { - fElementsToProcess = new IJavaElement[] { element }; - this.force = force; - } +// protected JavaModelOperation(IJavaElement element, boolean force) { +// fElementsToProcess = new IJavaElement[] { element }; +// this.force = force; +// } /* * Registers the given action at the end of the list of actions to run. @@ -309,18 +309,18 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, /** * Convenience method to create a file */ - protected void createFile(IContainer folder, String name, - InputStream contents, boolean force) throws JavaModelException { - IFile file = folder.getFile(new Path(name)); - try { - file.create(contents, force ? IResource.FORCE - | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, - getSubProgressMonitor(1)); - this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); - } catch (CoreException e) { - throw new JavaModelException(e); - } - } +// protected void createFile(IContainer folder, String name, +// InputStream contents, boolean force) throws JavaModelException { +// IFile file = folder.getFile(new Path(name)); +// try { +// file.create(contents, force ? IResource.FORCE +// | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, +// getSubProgressMonitor(1)); +// this.setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); +// } catch (CoreException e) { +// throw new JavaModelException(e); +// } +// } /** * Convenience method to create a folder @@ -414,14 +414,14 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, /* * Returns whether the given path is equals to one of the given other paths. */ - protected boolean equalsOneOf(IPath path, IPath[] otherPaths) { - for (int i = 0, length = otherPaths.length; i < length; i++) { - if (path.equals(otherPaths[i])) { - return true; - } - } - return false; - } +// protected boolean equalsOneOf(IPath path, IPath[] otherPaths) { +// for (int i = 0, length = otherPaths.length; i < length; i++) { +// if (path.equals(otherPaths[i])) { +// return true; +// } +// } +// return false; +// } /** * Verifies the operation can proceed and executes the operation. Subclasses @@ -578,16 +578,16 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, * Returns the parent elements to which this operation applies, or * null if not applicable. */ - protected IJavaElement[] getParentElements() { - return fParentElements; - } +// protected IJavaElement[] getParentElements() { +// return fParentElements; +// } /** * Returns the elements created by this operation. */ - public IJavaElement[] getResultElements() { - return resultElements; - } +// public IJavaElement[] getResultElements() { +// return resultElements; +// } /* * Returns the scheduling rule for this operation (i.e. the resource that @@ -774,14 +774,14 @@ public abstract class JavaModelOperation implements IWorkspaceRunnable, * Returns whether the given path is the prefix of one of the given other * paths. */ - protected boolean prefixesOneOf(IPath path, IPath[] otherPaths) { - for (int i = 0, length = otherPaths.length; i < length; i++) { - if (path.isPrefixOf(otherPaths[i])) { - return true; - } - } - return false; - } +// protected boolean prefixesOneOf(IPath path, IPath[] otherPaths) { +// for (int i = 0, length = otherPaths.length; i < length; i++) { +// if (path.isPrefixOf(otherPaths[i])) { +// return true; +// } +// } +// return false; +// } /* * Pushes the given operation on the stack of operations currently running diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java index 94ae854..cdfdb9f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java @@ -74,7 +74,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; -import org.eclipse.core.runtime.QualifiedName; +//import org.eclipse.core.runtime.QualifiedName; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -391,19 +391,19 @@ public class JavaProject extends Openable implements IJavaProject, /** * Adds a builder to the build spec for the given project. */ - protected void addToBuildSpec(String builderID) throws CoreException { - - IProjectDescription description = getProject().getDescription(); - ICommand javaCommand = getJavaCommand(description); - - if (javaCommand == null) { - - // Add a Java command to the build spec - ICommand command = description.newCommand(); - command.setBuilderName(builderID); - setJavaCommand(description, command); - } - } +// protected void addToBuildSpec(String builderID) throws CoreException { +// +// IProjectDescription description = getProject().getDescription(); +// ICommand javaCommand = getJavaCommand(description); +// +// if (javaCommand == null) { +// +// // Add a Java command to the build spec +// ICommand command = description.newCommand(); +// command.setBuilderName(builderID); +// setJavaCommand(description, command); +// } +// } /** * @see Openable @@ -793,10 +793,10 @@ public class JavaProject extends Openable implements IJavaProject, /** * Compute the file name to use for a given shared property */ - public String computeSharedPropertyFileName(QualifiedName qName) { - - return '.' + qName.getLocalName(); - } +// public String computeSharedPropertyFileName(QualifiedName qName) { +// +// return '.' + qName.getLocalName(); +// } /* * Returns whether the given resource is accessible through the children or @@ -1218,12 +1218,12 @@ public class JavaProject extends Openable implements IJavaProject, String typeName = path.lastSegment(); typeName = typeName.substring(0, typeName.length() - extension.length() - 1); - String qualifiedName = null; - if (packageName.length() > 0) { - qualifiedName = packageName + "." + typeName; //$NON-NLS-1$ - } else { - qualifiedName = typeName; - } + //String qualifiedName = null; +// if (packageName.length() > 0) { +// qualifiedName = packageName + "." + typeName; //$NON-NLS-1$ +// } else { +// qualifiedName = typeName; +// } // IType type = // getNameLookup().findType( // qualifiedName, @@ -1608,18 +1608,18 @@ public class JavaProject extends Openable implements IJavaProject, * Find the specific Java command amongst the build spec of a given * description */ - private ICommand getJavaCommand(IProjectDescription description) - throws CoreException { - - ICommand[] commands = description.getBuildSpec(); - for (int i = 0; i < commands.length; ++i) { - if (commands[i].getBuilderName().equals( - PHPeclipsePlugin.BUILDER_PARSER_ID)) { - return commands[i]; - } - } - return null; - } +// private ICommand getJavaCommand(IProjectDescription description) +// throws CoreException { +// +// ICommand[] commands = description.getBuildSpec(); +// for (int i = 0; i < commands.length; ++i) { +// if (commands[i].getBuilderName().equals( +// PHPeclipsePlugin.BUILDER_PARSER_ID)) { +// return commands[i]; +// } +// } +// return null; +// } /** * Convenience method that returns the specific type of info for a Java @@ -1905,21 +1905,21 @@ public class JavaProject extends Openable implements IJavaProject, * Returns the package fragment root prefixed by the given path, or an empty * collection if there are no such elements in the model. */ - protected IPackageFragmentRoot[] getPackageFragmentRoots(IPath path) - - throws JavaModelException { - IPackageFragmentRoot[] roots = getAllPackageFragmentRoots(); - ArrayList matches = new ArrayList(); - - for (int i = 0; i < roots.length; ++i) { - if (path.isPrefixOf(roots[i].getPath())) { - matches.add(roots[i]); - } - } - IPackageFragmentRoot[] copy = new IPackageFragmentRoot[matches.size()]; - matches.toArray(copy); - return copy; - } +// protected IPackageFragmentRoot[] getPackageFragmentRoots(IPath path) +// +// throws JavaModelException { +// IPackageFragmentRoot[] roots = getAllPackageFragmentRoots(); +// ArrayList matches = new ArrayList(); +// +// for (int i = 0; i < roots.length; ++i) { +// if (path.isPrefixOf(roots[i].getPath())) { +// matches.add(roots[i]); +// } +// } +// IPackageFragmentRoot[] copy = new IPackageFragmentRoot[matches.size()]; +// matches.toArray(copy); +// return copy; +// } /** * @see IJavaProject @@ -2527,60 +2527,60 @@ public class JavaProject extends Openable implements IJavaProject, /* * @see IJavaProject */ - public boolean isOnClasspath(IJavaElement element) { - IPath path = element.getPath(); - switch (element.getElementType()) { - case IJavaElement.PACKAGE_FRAGMENT_ROOT: - if (!((IPackageFragmentRoot) element).isArchive()) { - // ensure that folders are only excluded if all of their - // children are excluded - path = path.append("*"); //$NON-NLS-1$ - } - break; - case IJavaElement.PACKAGE_FRAGMENT: - if (!((IPackageFragmentRoot) element.getParent()).isArchive()) { - // ensure that folders are only excluded if all of their - // children are excluded - path = path.append("*"); //$NON-NLS-1$ - } - break; - } - return this.isOnClasspath(path); - } - - private boolean isOnClasspath(IPath path) { - IClasspathEntry[] classpath; - try { - classpath = this - .getResolvedClasspath(true/* ignore unresolved variable */); - } catch (JavaModelException e) { - return false; // not a Java project - } - for (int i = 0; i < classpath.length; i++) { - IClasspathEntry entry = classpath[i]; - if (entry.getPath().isPrefixOf(path) - && !Util.isExcluded(path, null, ((ClasspathEntry) entry) - .fullExclusionPatternChars(), true)) { - return true; - } - } - return false; - } +// public boolean isOnClasspath(IJavaElement element) { +// IPath path = element.getPath(); +// switch (element.getElementType()) { +// case IJavaElement.PACKAGE_FRAGMENT_ROOT: +// if (!((IPackageFragmentRoot) element).isArchive()) { +// // ensure that folders are only excluded if all of their +// // children are excluded +// path = path.append("*"); //$NON-NLS-1$ +// } +// break; +// case IJavaElement.PACKAGE_FRAGMENT: +// if (!((IPackageFragmentRoot) element.getParent()).isArchive()) { +// // ensure that folders are only excluded if all of their +// // children are excluded +// path = path.append("*"); //$NON-NLS-1$ +// } +// break; +// } +// return this.isOnClasspath(path); +// } + +// private boolean isOnClasspath(IPath path) { +// IClasspathEntry[] classpath; +// try { +// classpath = this +// .getResolvedClasspath(true/* ignore unresolved variable */); +// } catch (JavaModelException e) { +// return false; // not a Java project +// } +// for (int i = 0; i < classpath.length; i++) { +// IClasspathEntry entry = classpath[i]; +// if (entry.getPath().isPrefixOf(path) +// && !Util.isExcluded(path, null, ((ClasspathEntry) entry) +// .fullExclusionPatternChars(), true)) { +// return true; +// } +// } +// return false; +// } /* * @see IJavaProject */ - public boolean isOnClasspath(IResource resource) { - IPath path = resource.getFullPath(); - - // ensure that folders are only excluded if all of their children are - // excluded - if (resource.getType() == IResource.FOLDER) { - path = path.append("*"); //$NON-NLS-1$ - } - - return this.isOnClasspath(path); - } +// public boolean isOnClasspath(IResource resource) { +// IPath path = resource.getFullPath(); +// +// // ensure that folders are only excluded if all of their children are +// // excluded +// if (resource.getType() == IResource.FOLDER) { +// path = path.append("*"); //$NON-NLS-1$ +// } +// +// return this.isOnClasspath(path); +// } private IPath getPluginWorkingLocation() { return this.project.getWorkingLocation(JavaCore.PLUGIN_ID); @@ -2856,34 +2856,34 @@ public class JavaProject extends Openable implements IJavaProject, * Update the Java command in the build spec (replace existing one if * present, add one first if none). */ - private void setJavaCommand(IProjectDescription description, - ICommand newCommand) throws CoreException { - - ICommand[] oldCommands = description.getBuildSpec(); - ICommand oldJavaCommand = getJavaCommand(description); - ICommand[] newCommands; - - if (oldJavaCommand == null) { - // Add a Java build spec before other builders (1FWJK7I) - newCommands = new ICommand[oldCommands.length + 1]; - System - .arraycopy(oldCommands, 0, newCommands, 1, - oldCommands.length); - newCommands[0] = newCommand; - } else { - for (int i = 0, max = oldCommands.length; i < max; i++) { - if (oldCommands[i] == oldJavaCommand) { - oldCommands[i] = newCommand; - break; - } - } - newCommands = oldCommands; - } - - // Commit the spec change into the project - description.setBuildSpec(newCommands); - getProject().setDescription(description, null); - } +// private void setJavaCommand(IProjectDescription description, +// ICommand newCommand) throws CoreException { +// +// ICommand[] oldCommands = description.getBuildSpec(); +// ICommand oldJavaCommand = getJavaCommand(description); +// ICommand[] newCommands; +// +// if (oldJavaCommand == null) { +// // Add a Java build spec before other builders (1FWJK7I) +// newCommands = new ICommand[oldCommands.length + 1]; +// System +// .arraycopy(oldCommands, 0, newCommands, 1, +// oldCommands.length); +// newCommands[0] = newCommand; +// } else { +// for (int i = 0, max = oldCommands.length; i < max; i++) { +// if (oldCommands[i] == oldJavaCommand) { +// oldCommands[i] = newCommand; +// break; +// } +// } +// newCommands = oldCommands; +// } +// +// // Commit the spec change into the project +// description.setBuildSpec(newCommands); +// getProject().setDescription(description, null); +// } /** * @see net.sourceforge.phpdt.core.IJavaProject#setOptions(Map) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java index 53e57d0..3714834 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java @@ -10,15 +10,15 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.core; -import net.sourceforge.phpdt.core.IClasspathEntry; +//import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaProject; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.core.util.Util; +//import net.sourceforge.phpdt.core.JavaModelException; +//import net.sourceforge.phpdt.internal.core.util.Util; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; +//import org.eclipse.core.resources.IContainer; +//import org.eclipse.core.resources.IResource; +//import org.eclipse.core.runtime.CoreException; +//import org.eclipse.core.runtime.IPath; /** * Info for IJavaProject. @@ -48,125 +48,125 @@ class JavaProjectElementInfo extends OpenableElementInfo { /** * A array with all the non-java resources contained by this PackageFragment */ - private Object[] fNonJavaResources; + //private Object[] fNonJavaResources; /** * Create and initialize a new instance of the receiver */ public JavaProjectElementInfo() { - fNonJavaResources = null; + //fNonJavaResources = null; } /** * Compute the non-java resources contained in this java project. */ - private Object[] computeNonJavaResources(JavaProject project) { - - // determine if src == project and/or if bin == project - IPath projectPath = project.getProject().getFullPath(); - boolean srcIsProject = false; - //boolean binIsProject = false; - char[][] exclusionPatterns = null; - IClasspathEntry[] classpath = null; - IPath projectOutput = null; - try { - classpath = project - .getResolvedClasspath(true/* ignore unresolved variable */); - for (int i = 0; i < classpath.length; i++) { - IClasspathEntry entry = classpath[i]; - if (projectPath.equals(entry.getPath())) { - srcIsProject = true; - exclusionPatterns = ((ClasspathEntry) entry) - .fullExclusionPatternChars(); - break; - } - } - projectOutput = project.getOutputLocation(); - //binIsProject = projectPath.equals(projectOutput); - } catch (JavaModelException e) { - // ignore - } - - Object[] nonJavaResources = new IResource[5]; - int nonJavaResourcesCounter = 0; - try { - IResource[] members = ((IContainer) project.getResource()) - .members(); - for (int i = 0, max = members.length; i < max; i++) { - IResource res = members[i]; - switch (res.getType()) { - case IResource.FILE: - IPath resFullPath = res.getFullPath(); - //String resName = res.getName(); - - // ignore a jar file on the classpath - // if (ProjectPrefUtil.isArchiveFileName(resName) && - // this.isClasspathEntryOrOutputLocation(resFullPath, - // classpath, projectOutput)) { - // break; - // } - // ignore .java file if src == project - if (srcIsProject - // && ProjectPrefUtil.isValidCompilationUnitName(resName) - && !Util.isExcluded(res, exclusionPatterns)) { - break; - } - // ignore .class file if bin == project - // if (binIsProject && - // ProjectPrefUtil.isValidClassFileName(resName)) { - // break; - // } - // else add non java resource - if (nonJavaResources.length == nonJavaResourcesCounter) { - // resize - System - .arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), - 0, nonJavaResourcesCounter); - } - nonJavaResources[nonJavaResourcesCounter++] = res; - break; - case IResource.FOLDER: - resFullPath = res.getFullPath(); - - // ignore non-excluded folders on the classpath or that - // correspond to an output location - if ((srcIsProject - && !Util.isExcluded(res, exclusionPatterns) && Util - .isValidFolderNameForPackage(res.getName())) - || this.isClasspathEntryOrOutputLocation( - resFullPath, classpath, projectOutput)) { - break; - } - // else add non java resource - if (nonJavaResources.length == nonJavaResourcesCounter) { - // resize - System - .arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), - 0, nonJavaResourcesCounter); - } - nonJavaResources[nonJavaResourcesCounter++] = res; - } - } - if (nonJavaResources.length != nonJavaResourcesCounter) { - System - .arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter]), - 0, nonJavaResourcesCounter); - } - } catch (CoreException e) { - nonJavaResources = NO_NON_JAVA_RESOURCES; - nonJavaResourcesCounter = 0; - } - return nonJavaResources; - } +// private Object[] computeNonJavaResources(JavaProject project) { +// +// // determine if src == project and/or if bin == project +// IPath projectPath = project.getProject().getFullPath(); +// boolean srcIsProject = false; +// //boolean binIsProject = false; +// char[][] exclusionPatterns = null; +// IClasspathEntry[] classpath = null; +// IPath projectOutput = null; +// try { +// classpath = project +// .getResolvedClasspath(true/* ignore unresolved variable */); +// for (int i = 0; i < classpath.length; i++) { +// IClasspathEntry entry = classpath[i]; +// if (projectPath.equals(entry.getPath())) { +// srcIsProject = true; +// exclusionPatterns = ((ClasspathEntry) entry) +// .fullExclusionPatternChars(); +// break; +// } +// } +// projectOutput = project.getOutputLocation(); +// //binIsProject = projectPath.equals(projectOutput); +// } catch (JavaModelException e) { +// // ignore +// } +// +// Object[] nonJavaResources = new IResource[5]; +// int nonJavaResourcesCounter = 0; +// try { +// IResource[] members = ((IContainer) project.getResource()) +// .members(); +// for (int i = 0, max = members.length; i < max; i++) { +// IResource res = members[i]; +// switch (res.getType()) { +// case IResource.FILE: +// IPath resFullPath = res.getFullPath(); +// //String resName = res.getName(); +// +// // ignore a jar file on the classpath +// // if (ProjectPrefUtil.isArchiveFileName(resName) && +// // this.isClasspathEntryOrOutputLocation(resFullPath, +// // classpath, projectOutput)) { +// // break; +// // } +// // ignore .java file if src == project +// if (srcIsProject +// // && ProjectPrefUtil.isValidCompilationUnitName(resName) +// && !Util.isExcluded(res, exclusionPatterns)) { +// break; +// } +// // ignore .class file if bin == project +// // if (binIsProject && +// // ProjectPrefUtil.isValidClassFileName(resName)) { +// // break; +// // } +// // else add non java resource +// if (nonJavaResources.length == nonJavaResourcesCounter) { +// // resize +// System +// .arraycopy( +// nonJavaResources, +// 0, +// (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), +// 0, nonJavaResourcesCounter); +// } +// nonJavaResources[nonJavaResourcesCounter++] = res; +// break; +// case IResource.FOLDER: +// resFullPath = res.getFullPath(); +// +// // ignore non-excluded folders on the classpath or that +// // correspond to an output location +// if ((srcIsProject +// && !Util.isExcluded(res, exclusionPatterns) && Util +// .isValidFolderNameForPackage(res.getName())) +// || this.isClasspathEntryOrOutputLocation( +// resFullPath, classpath, projectOutput)) { +// break; +// } +// // else add non java resource +// if (nonJavaResources.length == nonJavaResourcesCounter) { +// // resize +// System +// .arraycopy( +// nonJavaResources, +// 0, +// (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), +// 0, nonJavaResourcesCounter); +// } +// nonJavaResources[nonJavaResourcesCounter++] = res; +// } +// } +// if (nonJavaResources.length != nonJavaResourcesCounter) { +// System +// .arraycopy( +// nonJavaResources, +// 0, +// (nonJavaResources = new IResource[nonJavaResourcesCounter]), +// 0, nonJavaResourcesCounter); +// } +// } catch (CoreException e) { +// nonJavaResources = NO_NON_JAVA_RESOURCES; +// nonJavaResourcesCounter = 0; +// } +// return nonJavaResources; +// } /** * @see IJavaProject @@ -179,15 +179,15 @@ class JavaProjectElementInfo extends OpenableElementInfo { /** * Returns an array of non-java resources contained in the receiver. */ - Object[] getNonJavaResources(JavaProject project) { - - Object[] nonJavaResources = fNonJavaResources; - if (nonJavaResources == null) { - nonJavaResources = computeNonJavaResources(project); - fNonJavaResources = nonJavaResources; - } - return nonJavaResources; - } +// Object[] getNonJavaResources(JavaProject project) { +// +// Object[] nonJavaResources = fNonJavaResources; +// if (nonJavaResources == null) { +// nonJavaResources = computeNonJavaResources(project); +// fNonJavaResources = nonJavaResources; +// } +// return nonJavaResources; +// } /** * @see IJavaProject @@ -200,23 +200,23 @@ class JavaProjectElementInfo extends OpenableElementInfo { * Returns whether the given path is a classpath entry or an output * location. */ - private boolean isClasspathEntryOrOutputLocation(IPath path, - IClasspathEntry[] resolvedClasspath, IPath projectOutput) { - if (projectOutput.equals(path)) - return true; - for (int i = 0, length = resolvedClasspath.length; i < length; i++) { - IClasspathEntry entry = resolvedClasspath[i]; - if (entry.getPath().equals(path)) { - return true; - } - IPath output; - if ((output = entry.getOutputLocation()) != null - && output.equals(path)) { - return true; - } - } - return false; - } +// private boolean isClasspathEntryOrOutputLocation(IPath path, +// IClasspathEntry[] resolvedClasspath, IPath projectOutput) { +// if (projectOutput.equals(path)) +// return true; +// for (int i = 0, length = resolvedClasspath.length; i < length; i++) { +// IClasspathEntry entry = resolvedClasspath[i]; +// if (entry.getPath().equals(path)) { +// return true; +// } +// IPath output; +// if ((output = entry.getOutputLocation()) != null +// && output.equals(path)) { +// return true; +// } +// } +// return false; +// } protected void setNameLookup(NameLookup newNameLookup) { @@ -232,7 +232,7 @@ class JavaProjectElementInfo extends OpenableElementInfo { */ synchronized void setNonJavaResources(Object[] resources) { - fNonJavaResources = resources; + //fNonJavaResources = resources; } // protected void setSearchableEnvironment(SearchableEnvironment 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 3effa69..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 diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/OverflowingLRUCache.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/OverflowingLRUCache.java index de4c7a4..2700928 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/OverflowingLRUCache.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/OverflowingLRUCache.java @@ -14,7 +14,7 @@ import java.util.Enumeration; import java.util.Iterator; import net.sourceforge.phpdt.internal.core.util.LRUCache; -import net.sourceforge.phpdt.internal.core.util.Util; +//import net.sourceforge.phpdt.internal.core.util.Util; /** * The OverflowingLRUCache is an LRUCache which attempts to @@ -157,9 +157,9 @@ public abstract class OverflowingLRUCache extends LRUCache { * * @return Hashtable of entries */ - public java.util.Hashtable getEntryTable() { - return fEntryTable; - } +// public java.util.Hashtable getEntryTable() { +// return fEntryTable; +// } /** * Returns the load factor for the cache. The load factor determines how @@ -167,16 +167,16 @@ public abstract class OverflowingLRUCache extends LRUCache { * * @return double */ - public double getLoadFactor() { - return fLoadFactor; - } +// public double getLoadFactor() { +// return fLoadFactor; +// } /** * @return The space by which the cache has overflown. */ - public int getOverflow() { - return fOverflow; - } +// public int getOverflow() { +// return fOverflow; +// } /** * Ensures there is the specified amount of free space in the receiver, by @@ -427,14 +427,14 @@ public abstract class OverflowingLRUCache extends LRUCache { * @throws IllegalArgumentException * when the new load factor is not in (0.0, 1.0] */ - public void setLoadFactor(double newLoadFactor) - throws IllegalArgumentException { - if (newLoadFactor <= 1.0 && newLoadFactor > 0.0) - fLoadFactor = newLoadFactor; - else - throw new IllegalArgumentException(Util - .bind("cache.invalidLoadFactor")); //$NON-NLS-1$ - } +// public void setLoadFactor(double newLoadFactor) +// throws IllegalArgumentException { +// if (newLoadFactor <= 1.0 && newLoadFactor > 0.0) +// fLoadFactor = newLoadFactor; +// else +// throw new IllegalArgumentException(Util +// .bind("cache.invalidLoadFactor")); //$NON-NLS-1$ +// } /** * Sets the maximum amount of space that the cache can store diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentInfo.java index 835ce31..1a4240f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentInfo.java @@ -10,10 +10,10 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.core; -import net.sourceforge.phpdt.core.JavaModelException; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; +//import net.sourceforge.phpdt.core.JavaModelException; +// +//import org.eclipse.core.resources.IContainer; +//import org.eclipse.core.resources.IResource; /** * Element info for PackageFragments. @@ -34,29 +34,29 @@ class PackageFragmentInfo extends OpenableElementInfo { /** */ - boolean containsJavaResources() { - return fChildren.length != 0; - } +// boolean containsJavaResources() { +// return fChildren.length != 0; +// } /** * Returns an array of non-java resources contained in the receiver. */ - Object[] getNonJavaResources(IResource underlyingResource, - PackageFragmentRoot rootHandle) { - Object[] nonJavaResources = fNonJavaResources; - if (nonJavaResources == null) { - try { - nonJavaResources = PackageFragmentRootInfo - .computeFolderNonJavaResources((JavaProject) rootHandle - .getJavaProject(), - (IContainer) underlyingResource, rootHandle - .fullExclusionPatternChars()); - } catch (JavaModelException e) { - } - fNonJavaResources = nonJavaResources; - } - return nonJavaResources; - } +// Object[] getNonJavaResources(IResource underlyingResource, +// PackageFragmentRoot rootHandle) { +// Object[] nonJavaResources = fNonJavaResources; +// if (nonJavaResources == null) { +// try { +// nonJavaResources = PackageFragmentRootInfo +// .computeFolderNonJavaResources((JavaProject) rootHandle +// .getJavaProject(), +// (IContainer) underlyingResource, rootHandle +// .fullExclusionPatternChars()); +// } catch (JavaModelException e) { +// } +// fNonJavaResources = nonJavaResources; +// } +// return nonJavaResources; +// } /** * Set the fNonJavaResources to res value diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java index bc678a6..d43b36b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java @@ -25,7 +25,7 @@ import net.sourceforge.phpdt.internal.core.util.MementoTokenizer; import net.sourceforge.phpdt.internal.core.util.Util; import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; +//import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -649,15 +649,15 @@ public class PackageFragmentRoot extends Openable implements /** * @see Openable */ - protected boolean generateInfos(OpenableElementInfo info, - IProgressMonitor pm, Map newElements, IResource underlyingResource) - throws JavaModelException { - - // ((PackageFragmentRootInfo) - // info).setRootKind(determineKind(underlyingResource)); - // return computeChildren(info); - return false; - } +// protected boolean generateInfos(OpenableElementInfo info, +// IProgressMonitor pm, Map newElements, IResource underlyingResource) +// throws JavaModelException { +// +// // ((PackageFragmentRootInfo) +// // info).setRootKind(determineKind(underlyingResource)); +// // return computeChildren(info); +// return false; +// } /** * @see JavaElement#getHandleMemento() @@ -776,21 +776,21 @@ public class PackageFragmentRoot extends Openable implements * Returns the package name for the given folder (which is a decendent of * this root). */ - protected String getPackageName(IFolder folder) throws JavaModelException { - IPath myPath = getPath(); - IPath pkgPath = folder.getFullPath(); - int mySegmentCount = myPath.segmentCount(); - int pkgSegmentCount = pkgPath.segmentCount(); - StringBuffer name = new StringBuffer( - IPackageFragment.DEFAULT_PACKAGE_NAME); - for (int i = mySegmentCount; i < pkgSegmentCount; i++) { - if (i > mySegmentCount) { - name.append('.'); - } - name.append(pkgPath.segment(i)); - } - return name.toString(); - } +// protected String getPackageName(IFolder folder) throws JavaModelException { +// IPath myPath = getPath(); +// IPath pkgPath = folder.getFullPath(); +// int mySegmentCount = myPath.segmentCount(); +// int pkgSegmentCount = pkgPath.segmentCount(); +// StringBuffer name = new StringBuffer( +// IPackageFragment.DEFAULT_PACKAGE_NAME); +// for (int i = mySegmentCount; i < pkgSegmentCount; i++) { +// if (i > mySegmentCount) { +// name.append('.'); +// } +// name.append(pkgPath.segment(i)); +// } +// return name.toString(); +// } /** * @see IJavaElement diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRootInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRootInfo.java index 3f3557b..c334413 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRootInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRootInfo.java @@ -153,16 +153,16 @@ class PackageFragmentRootInfo extends OpenableElementInfo { /** * Returns an array of non-java resources contained in the receiver. */ - synchronized Object[] getNonJavaResources(IJavaProject project, - IResource underlyingResource, PackageFragmentRoot handle) { - Object[] nonJavaResources = fNonJavaResources; - if (nonJavaResources == null) { - nonJavaResources = this.computeNonJavaResources(project, - underlyingResource, handle); - fNonJavaResources = nonJavaResources; - } - return nonJavaResources; - } +// synchronized Object[] getNonJavaResources(IJavaProject project, +// IResource underlyingResource, PackageFragmentRoot handle) { +// Object[] nonJavaResources = fNonJavaResources; +// if (nonJavaResources == null) { +// nonJavaResources = this.computeNonJavaResources(project, +// underlyingResource, handle); +// fNonJavaResources = nonJavaResources; +// } +// return nonJavaResources; +// } /** * Returns the kind of this root. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java index 409c229..95eeb1e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ReconcileWorkingCopyOperation.java @@ -34,11 +34,11 @@ public class ReconcileWorkingCopyOperation extends JavaModelOperation { // net.sourceforge.phpdt.core.dom.CompilationUnit ast; - public ReconcileWorkingCopyOperation(IJavaElement workingCopy, - boolean forceProblemDetection) { - super(new IJavaElement[] { workingCopy }); - this.forceProblemDetection = forceProblemDetection; - } +// public ReconcileWorkingCopyOperation(IJavaElement workingCopy, +// boolean forceProblemDetection) { +// super(new IJavaElement[] { workingCopy }); +// this.forceProblemDetection = forceProblemDetection; +// } public ReconcileWorkingCopyOperation(IJavaElement workingCopy, boolean creatAST, int astLevel, boolean forceProblemDetection, diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironment.java index 73fe296..b402aa8 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironment.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironment.java @@ -344,13 +344,13 @@ public class SearchableEnvironment implements ISearchableNameEnvironment, /** * Returns a printable string for the array. */ - protected String toStringCharChar(char[][] names) { - StringBuffer result = new StringBuffer(); - for (int i = 0; i < names.length; i++) { - result.append(toStringChar(names[i])); - } - return result.toString(); - } +// protected String toStringCharChar(char[][] names) { +// StringBuffer result = new StringBuffer(); +// for (int i = 0; i < names.length; i++) { +// result.append(toStringChar(names[i])); +// } +// return result.toString(); +// } public void cleanup() { } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironmentRequestor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironmentRequestor.java index 15cb8b0..904148e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironmentRequestor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SearchableEnvironmentRequestor.java @@ -39,10 +39,10 @@ class SearchableEnvironmentRequestor extends JavaElementRequestor implements * Constructs a SearchableEnvironmentRequestor that wraps the given * SearchRequestor. */ - public SearchableEnvironmentRequestor(ISearchRequestor requestor) { - fRequestor = requestor; - fUnitToSkip = null; - } +// public SearchableEnvironmentRequestor(ISearchRequestor requestor) { +// fRequestor = requestor; +// fUnitToSkip = null; +// } /** * Constructs a SearchableEnvironmentRequestor that wraps the given diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceFieldElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceFieldElementInfo.java index f860639..48c81d2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceFieldElementInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceFieldElementInfo.java @@ -10,7 +10,7 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.core; -import net.sourceforge.phpdt.core.Signature; +//import net.sourceforge.phpdt.core.Signature; import net.sourceforge.phpdt.internal.compiler.env.ISourceField; /** @@ -50,9 +50,9 @@ import net.sourceforge.phpdt.internal.compiler.env.ISourceField; * * @see Signature */ - protected String getTypeSignature() { - return Signature.createTypeSignature(this.typeName, false); - } +// protected String getTypeSignature() { +// return Signature.createTypeSignature(this.typeName, false); +// } /** * Sets the type name of the field. diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceTypeElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceTypeElementInfo.java index 5c41254..1801f56 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceTypeElementInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/SourceTypeElementInfo.java @@ -109,9 +109,9 @@ public class SourceTypeElementInfo extends MemberElementInfo implements /** * @see ISourceType */ - public char[] getEnclosingTypeName() { - return fEnclosingTypeName; - } +// public char[] getEnclosingTypeName() { +// return fEnclosingTypeName; +// } /** * @see ISourceType -- 1.7.1