diff options
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers')
13 files changed, 0 insertions, 1552 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java deleted file mode 100644 index 09c40c345..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainer.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; - -/** - * Common function for source containers. - * <p> - * Clients implementing source containers should subclass this class. - * </p> - * @since 3.0 - */ -public abstract class AbstractSourceContainer extends PlatformObject implements ISourceContainer { - - public static final Object[] EMPTY = new Object[0]; - - private ISourceLookupDirector fDirector; - - /** - * Throws an exception with the given message and underlying exception. - * - * @param message error message - * @param exception underlying exception, or <code>null</code> - * @throws CoreException - */ - protected void abort(String message, Throwable exception) throws CoreException { - IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, exception); - throw new CoreException(status); - } - - /* (non-Javadoc) - * - * By default, do nothing. Subclasses should override as requried. - * - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#dispose() - */ - public void dispose() { - fDirector = null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getSourceContainers() - */ - public ISourceContainer[] getSourceContainers() throws CoreException { - return new ISourceContainer[0]; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite() - */ - public boolean isComposite() { - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#init(org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector) - */ - public void init(ISourceLookupDirector director) { - fDirector = director; - } - - /** - * Returns the source lookup director this source container registered - * in, or <code>null</code> if none. - * - * @return the source lookup director this source container registered - * in, or <code>null</code> if none - */ - protected ISourceLookupDirector getDirector() { - return fDirector; - } - - /** - * Returns whether this container's source lookup director is configured - * to search for duplicate source elements. - * - * @return whether this container's source lookup director is configured - * to search for duplicate source elements - */ - protected boolean isFindDuplicates() { - return getDirector().isFindDuplicates(); - } - - /** - * Returns the source container type identified by the given id, - * or <code>null</code> if none. - * - * @param id source container type identifier - * @return source container type or <code>null</code> - */ - protected ISourceContainerType getSourceContainerType(String id) { - return DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(id); - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainerTypeDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainerTypeDelegate.java deleted file mode 100644 index 9d07e21c9..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/AbstractSourceContainerTypeDelegate.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Common function for source container type delegates. - * <p> - * Clients implementing source container delegates should subclass this class. - * </p> - * @since 3.0 - */ -public abstract class AbstractSourceContainerTypeDelegate implements ISourceContainerTypeDelegate { - - /** - * Throws an exception with the given message and underlying exception. - * - * @param message error message - * @param exception underlying exception, or <code>null</code> - * @throws CoreException - */ - protected void abort(String message, Throwable exception) throws CoreException { - IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, exception); - throw new CoreException(status); - } - - /** - * Creates and returns a new XML document. - * - * @return a new XML document - * @throws CoreException if unable to create a new document - */ - protected Document newDocument()throws CoreException { - return DebugPlugin.newDocument(); - } - - /** - * Returns the given XML document as a string. - * - * @param document document to serialize - * @return the given XML document as a string - * @throws CoreException if unable to serialize the document - */ - protected String serializeDocument(Document document) throws CoreException { - return DebugPlugin.serializeDocument(document); - } - - /** - * Parses the given XML document, returning its root element. - * - * @param document XML document as a string - * @return the document's root element - * @throws CoreException if unable to parse the document - */ - protected Element parseDocument(String document) throws CoreException { - return DebugPlugin.parseDocument(document); - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java deleted file mode 100644 index 0d311228a..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ArchiveSourceContainer.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; - -/** - * Archive source container for an archive in the workspace. Returns instances - * of <code>ZipEntryStorage</code> as source elemetns. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class ArchiveSourceContainer extends AbstractSourceContainer { - - private IFile fFile; - private boolean fDetectRoot; - private ExternalArchiveSourceContainer fDelegateContainer; - - /** - * Unique identifier for the archive source container type - * (value <code>org.eclipse.debug.core.containerType.archive</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.archive"; //$NON-NLS-1$ - - /** - * Creates an archive source container on the given file. - * - * @param archive archive in the workspace - * @param detectRootPath whether a root path should be detected. When - * <code>true</code>, searching is performed relative to a root path - * within the archive based on fully qualified file names. The root - * path is automatically determined when the first successful search - * is performed. For example, when searching for a file named - * <code>a/b/c.d</code>, and an entry in the archive named - * <code>r/a/b/c.d</code> exists, the root path is set to <code>r</code>. - * From that point on, searching is performed relative to <code>r</code>. - * When <code>false</code>, searching is performed by - * matching file names as suffixes to the entries in the archive. - */ - public ArchiveSourceContainer(IFile archive, boolean detectRootPath) { - fFile = archive; - fDetectRoot = detectRootPath; - if (archive.exists() && archive.getLocation() != null) { - fDelegateContainer = new ExternalArchiveSourceContainer(archive.getLocation().toOSString(), detectRootPath); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName() - */ - public String getName() { - return fFile.getName(); - } - - /** - * Returns the associated file in the workspace. - * - * @return associated file in the workspace - */ - public IFile getFile() { - return fFile; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return obj instanceof ArchiveSourceContainer && - ((ArchiveSourceContainer)obj).getName().equals(getName()); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getName().hashCode(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String) - */ - public Object[] findSourceElements(String name) throws CoreException { - ExternalArchiveSourceContainer container = getDelegateContainer(); - if (container != null) { - return container.findSourceElements(name); - } - return EMPTY; - } - - /** - * Returns the underlying external archive source container. - * - * @return underlying external archive source container - * @since 3.0.1.1 - */ - private ExternalArchiveSourceContainer getDelegateContainer() { - return fDelegateContainer; - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#init(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) - */ - public void init(ISourceLookupDirector director) { - super.init(director); - if (fDelegateContainer != null) { - fDelegateContainer.init(director); - } - } - /* (non-Javadoc) - * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose() - */ - public void dispose() { - super.dispose(); - if (fDelegateContainer != null) { - fDelegateContainer.dispose(); - } - } - - /** - * Returns whether root paths are automatically detected in this - * archive source container. - * - * @return whether root paths are automatically detected in this - * archive source container - * @since 3.0.1.1 - */ - public boolean isDetectRoot() { - return fDetectRoot; - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java deleted file mode 100644 index 7ab80f92c..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; - -/** - * A source container of source containers. - * <p> - * Clients implementing composite source containers should subclass - * this class. - * </p> - * @since 3.0 - */ -public abstract class CompositeSourceContainer extends AbstractSourceContainer { - - private ISourceContainer[] fContainers; - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite() - */ - public boolean isComposite() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String) - */ - public Object[] findSourceElements(String name) throws CoreException { - return findSourceElements(name, getSourceContainers()); - } - - /** - * Returns a collection of source elements in the given containers corresponding to - * the given name. Returns an empty collection if no source elements are found. - * This source container's source lookup director specifies if duplicate - * source elements should be searched for, via <code>isFindDuplicates()</code>. - * When <code>false</code> the returned collection should contain at most one - * source element. If this is a composite container, the containers contained - * by this container are also searched. - * <p> - * The format of the given name is implementation specific but generally conforms - * to the format of a file name. If a source container does not recognize the - * name format provided, an empty collection should be returned. A source container - * may or may not require names to be fully qualified (i.e. be qualified with directory - * names). - * </p> - * @param name the name of the source element to search for - * @param containers the containers to search - * @return a collection of source elements corresponding to the given name - * @exception CoreException if an exception occurrs while searching for source elements - */ - protected Object[] findSourceElements(String name, ISourceContainer[] containers) throws CoreException { - List results = null; - CoreException single = null; - MultiStatus multiStatus = null; - if (isFindDuplicates()) { - results = new ArrayList(); - } - for (int i = 0; i < containers.length; i++) { - ISourceContainer container = containers[i]; - try { - Object[] objects = container.findSourceElements(name); - if (objects.length > 0) { - if (isFindDuplicates()) { - for (int j = 0; j < objects.length; j++) { - results.add(objects[j]); - } - } else { - if (objects.length == 1) { - return objects; - } - return new Object[]{objects[0]}; - } - } - } catch (CoreException e) { - if (single == null) { - single = e; - } else if (multiStatus == null) { - multiStatus = new MultiStatus(DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, new IStatus[]{single.getStatus()}, SourceLookupMessages.getString("CompositeSourceContainer.0"), null); //$NON-NLS-1$ - multiStatus.add(e.getStatus()); - } else { - multiStatus.add(e.getStatus()); - } - } - } - if (results == null) { - if (multiStatus != null) { - throw new CoreException(multiStatus); - } else if (single != null) { - throw single; - } - return EMPTY; - } - return results.toArray(); - } - - /** - * Creates the source containers in this composite container. - * Subclasses should override this methods. - * - * @throws CoreException if unable to create the containers - */ - protected abstract ISourceContainer[] createSourceContainers() throws CoreException; - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getSourceContainers() - */ - public synchronized ISourceContainer[] getSourceContainers() throws CoreException { - if (fContainers == null) { - fContainers = createSourceContainers(); - for (int i = 0; i < fContainers.length; i++) { - ISourceContainer container = fContainers[i]; - container.init(getDirector()); - } - } - return fContainers; - } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#dispose() - */ - public void dispose() { - super.dispose(); - if (fContainers != null) { - for (int i = 0; i < fContainers.length; i++) { - ISourceContainer container = fContainers[i]; - container.dispose(); - } - } - fContainers = null; - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java deleted file mode 100644 index f3f5c6b82..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DefaultSourceContainer.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; -import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; - -/** - * A source container that computers the default source lookup path - * for a launch configuration on each launch using a launch configuration's - * associated source path computer. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class DefaultSourceContainer extends CompositeSourceContainer { - - /** - * Unique identifier for the default source container type - * (value <code>org.eclipse.debug.core.containerType.default</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.default"; //$NON-NLS-1$ - - /** - * Constructs a default source container. - */ - public DefaultSourceContainer() { - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return obj instanceof DefaultSourceContainer; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getClass().hashCode(); - } - - /** - * Returns the launch configuration for which a default source lookup - * path will be computed, or <code>null</code> if none. - * - * @return the launch configuration for which a default source lookup - * path will be computed, or <code>null</code> - */ - protected ILaunchConfiguration getLaunchConfiguration() { - ISourceLookupDirector director = getDirector(); - if (director != null) { - return director.getLaunchConfiguration(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /** - * Returns the source path computer to use, or <code>null</code> - * if none. - * - * @return the source path computer to use, or <code>null</code> - * if none - */ - private ISourcePathComputer getSourcePathComputer() { - return getDirector().getSourcePathComputer(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName() - */ - public String getName() { - return SourceLookupMessages.getString("DefaultSourceContainer.0"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers() - */ - protected ISourceContainer[] createSourceContainers() throws CoreException { - ISourcePathComputer sourcePathComputer = getSourcePathComputer(); - if (sourcePathComputer == null) { - return new ISourceContainer[0]; - } - return sourcePathComputer.computeSourceContainers(getLaunchConfiguration(), null); - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java deleted file mode 100644 index a6d85e83c..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; - -/** - * A directory in the local file system. Source elements returned - * from <code>findSourceElements(...)</code> are instances - * of <code>LocalFileStorage</code>. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ - -public class DirectorySourceContainer extends CompositeSourceContainer { - - // root directory - private File fDirectory; - // whether to search subfolders - private boolean fSubfolders = false; - /** - * Unique identifier for the directory source container type - * (value <code>org.eclipse.debug.core.containerType.directory</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.directory"; //$NON-NLS-1$ - - /** - * Consutructs an external folder container for the - * directory identified by the given path. - * - * @param dirPath path to a directory in the local file system - * @param subfolders whether folders within the root directory - * should be searched for source elements - */ - public DirectorySourceContainer(IPath dirPath, boolean subfolders) { - this(dirPath.toFile(), subfolders); - } - - /** - * Consutructs an external folder container for the - * directory identified by the given file. - * - * @param dir a directory in the local file system - * @param subfolders whether folders within the root directory - * should be searched for source elements - */ - public DirectorySourceContainer(File dir, boolean subfolders) { - fDirectory = dir; - fSubfolders = subfolders; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName() - */ - public String getName() { - return fDirectory.getName(); - } - - /** - * Returns the root directory in the local file system associated - * with this source container. - * - * @return the root directory in the local file system associated - * with this source container - */ - public File getDirectory() { - return fDirectory; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String) - */ - public Object[] findSourceElements(String name) throws CoreException { - ArrayList sources = new ArrayList(); - File directory = getDirectory(); - File file = new File(directory, name); - if (file.exists() && file.isFile()) { - sources.add(new LocalFileStorage(file)); - } - - //check subfolders - if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) { - ISourceContainer[] containers = getSourceContainers(); - for (int i=0; i < containers.length; i++) { - Object[] objects = containers[i].findSourceElements(name); - if (objects == null || objects.length == 0) { - continue; - } - if (isFindDuplicates()) { - for(int j=0; j < objects.length; j++) - sources.add(objects[j]); - } else { - sources.add(objects[0]); - break; - } - } - } - - if(sources.isEmpty()) - return EMPTY; - return sources.toArray(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite() - */ - public boolean isComposite() { - return fSubfolders; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (obj instanceof DirectorySourceContainer) { - DirectorySourceContainer container = (DirectorySourceContainer) obj; - return container.getDirectory().equals(getDirectory()); - } - return false; - } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getDirectory().hashCode(); - } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers() - */ - protected ISourceContainer[] createSourceContainers() throws CoreException { - if (isComposite()) { - String[] files = fDirectory.list(); - if (files != null) { - List dirs = new ArrayList(); - for (int i = 0; i < files.length; i++) { - String name = files[i]; - File file = new File(getDirectory(), name); - if (file.exists() && file.isDirectory()) { - dirs.add(new DirectorySourceContainer(file, true)); - } - } - ISourceContainer[] containers = (ISourceContainer[]) dirs.toArray(new ISourceContainer[dirs.size()]); - for (int i = 0; i < containers.length; i++) { - ISourceContainer container = containers[i]; - container.init(getDirector()); - } - return containers; - } - } - return new ISourceContainer[0]; - } - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java deleted file mode 100644 index dfa3ed052..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import java.io.IOException; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils; - -/** - * An archive in the local file system. Returns instances - * of <code>ZipEntryStorage</code> as source elemetns. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class ExternalArchiveSourceContainer extends AbstractSourceContainer { - - private boolean fDetectRoots = false; - private Map fRoots = new HashMap(5); - private String fArchivePath = null; - /** - * Unique identifier for the external archive source container type - * (value <code>org.eclipse.debug.core.containerType.externalArchive</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.externalArchive"; //$NON-NLS-1$ - - /** - * Creates an archive source container on the archive at the - * specified location in the local file system. - * - * @param archivePath path to the archive in the local file system - * @param detectRootPaths whether root container paths should be detected. When - * <code>true</code>, searching is performed relative to a root path - * within the archive based on fully qualified file names. A root - * path is automatically determined for each file type when the first - * successful search is performed. For example, when searching for a file - * named <code>a/b/c.d</code>, and an entry in the archive named - * <code>r/a/b/c.d</code> exists, the root path is set to <code>r</code> - * for file type <code>d</code>. - * From that point on, searching is performed relative to <code>r</code> - * for files of type <code>d</code>. - * When searching for an unqualified file name, root containers are not - * considered. - * When <code>false</code>, searching is performed by - * matching file names as suffixes to the entries in the archive. - */ - public ExternalArchiveSourceContainer(String archivePath, boolean detectRootPaths) { - fArchivePath = archivePath; - fDetectRoots = detectRootPaths; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String) - */ - public Object[] findSourceElements(String name) throws CoreException { - name = name.replace('\\', '/'); - ZipFile file = getArchive(); - synchronized (file) { - boolean isQualfied = name.indexOf('/') > 0; - if (fDetectRoots && isQualfied) { - String root = getRoot(file, name); - if (root != null) { - if (root.length() > 0) { - name = root + name; - } - ZipEntry entry = file.getEntry(name); - if (entry != null) { - return new Object[]{new ZipEntryStorage(file, entry)}; - } - } - } else { - // try exact match - ZipEntry entry = file.getEntry(name); - if (entry != null) { - // can't be any dups if there is an exact match - return new Object[]{new ZipEntryStorage(file, entry)}; - } - // search - Enumeration entries = file.entries(); - List matches = null; - while (entries.hasMoreElements()) { - entry = (ZipEntry)entries.nextElement(); - String entryName = entry.getName(); - if (entryName.endsWith(name)) { - if (isQualfied || entryName.length() == name.length() || entryName.charAt(entryName.length() - name.length() - 1) == '/') { - if (isFindDuplicates()) { - if (matches == null) { - matches = new ArrayList(); - } - matches.add(new ZipEntryStorage(file, entry)); - } else { - return new Object[]{new ZipEntryStorage(file, entry)}; - } - } - } - } - if (matches != null) { - return matches.toArray(); - } - } - } - return EMPTY; - } - - /** - * Returns the root path in this archive for the given file name, based - * on its type, or <code>null</code> if none. Detects a root if a root has - * not yet been detected for the given file type. - * - * @param file zip file to search in - * @param name file name - * @exception CoreException if an exception occurrs while detecting the root - */ - private String getRoot(ZipFile file, String name) throws CoreException { - int index = name.lastIndexOf('.'); - String fileType = null; - if (index >= 0) { - fileType = name.substring(index); - } else { - // no filetype, use "" as key - fileType = ""; //$NON-NLS-1$ - } - String root = (String) fRoots.get(fileType); - if (root == null) { - root = detectRoot(file, name); - if (root != null) { - fRoots.put(fileType, root); - } - } - return root; - } - - /** - * Detects and returns the root path in this archive by searching for an entry - * with the given name, as a suffix. - * - * @param file zip file to search in - * @param name entry to search for - * @return root - * @exception CoreException if an exception occurrs while detecting the root - */ - private String detectRoot(ZipFile file, String name) throws CoreException { - synchronized (file) { - Enumeration entries = file.entries(); - try { - while (entries.hasMoreElements()) { - ZipEntry entry = (ZipEntry)entries.nextElement(); - String entryName = entry.getName(); - if (entryName.endsWith(name)) { - int rootLength = entryName.length() - name.length(); - if (rootLength > 0) { - return entryName.substring(0, rootLength); - } - return ""; //$NON-NLS-1$ - } - } - } catch (IllegalStateException e) { - abort(MessageFormat.format(SourceLookupMessages.getString("ExternalArchiveSourceContainer.1"), new String[] {getName()}), e); //$NON-NLS-1$ - } - } - return null; - } - - /** - * Returns the archive to search in. - * - * @throws CoreException if unable to access the archive - */ - private ZipFile getArchive() throws CoreException { - try { - return SourceLookupUtils.getZipFile(fArchivePath); - } catch (IOException e) { - abort(MessageFormat.format(SourceLookupMessages.getString("ExternalArchiveSourceContainer.2"), new String[]{fArchivePath}), e); //$NON-NLS-1$ - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName() - */ - public String getName() { - return fArchivePath; - } - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /** - * Returns whether root paths are automatically detected in this - * archive source container. - * - * @return whether root paths are automatically detected in this - * archive source container - */ - public boolean isDetectRoot() { - return fDetectRoots; - } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return obj instanceof ExternalArchiveSourceContainer && - ((ExternalArchiveSourceContainer)obj).getName().equals(getName()); - } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getName().hashCode(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#dispose() - */ - public void dispose() { - super.dispose(); - fRoots.clear(); - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java deleted file mode 100644 index 3310f9f31..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/FolderSourceContainer.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.internal.core.sourcelookup.containers.*; - -/** - * A folder in the workspace. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class FolderSourceContainer extends ContainerSourceContainer { - - /** - * Unique identifier for the folder source container type - * (value <code>org.eclipse.debug.core.containerType.folder</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.folder"; //$NON-NLS-1$ - - - /** - * Constructs a source container on the given folder. - * - * @param folder the folder to search for source in - * @param subfolders whether to search nested folders - */ - public FolderSourceContainer(IContainer folder, boolean subfolders) { - super(folder, subfolders); - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java deleted file mode 100644 index dbdf75fbc..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/LocalFileStorage.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; - -/** - * Implementation of storage for a local file - * (<code>java.io.File</code>). - * <p> - * This class may be instantiated; it is not intended to be subclassed. - * </p> - * @see IStorage - * @since 3.0 - */ -public class LocalFileStorage extends PlatformObject implements IStorage { - - /** - * The file this storage refers to. - */ - private File fFile; - - /** - * Constructs and returns storage for the given file. - * - * @param file a local file - */ - public LocalFileStorage(File file){ - setFile(file); - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getContents() - */ - public InputStream getContents() throws CoreException { - try { - return new FileInputStream(getFile()); - } catch (IOException e){ - throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, SourceLookupMessages.getString("LocalFileStorage.0"), e)); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getFullPath() - */ - public IPath getFullPath() { - try { - return new Path(getFile().getCanonicalPath()); - } catch (IOException e) { - DebugPlugin.log(e); - return null; - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getName() - */ - public String getName() { - return getFile().getName(); - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#isReadOnly() - */ - public boolean isReadOnly() { - return true; - } - - /** - * Sets the file associated with this storage - * - * @param file a local file - */ - private void setFile(File file) { - fFile = file; - } - - /** - * Returns the file asscoiated with this storage - * - * @return file - */ - public File getFile() { - return fFile; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object object) { - return object instanceof LocalFileStorage && - getFile().equals(((LocalFileStorage)object).getFile()); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getFile().hashCode(); - } -}
\ No newline at end of file diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java deleted file mode 100644 index ce0361e43..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java +++ /dev/null @@ -1,110 +0,0 @@ - /******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.internal.core.sourcelookup.containers.*; - -/** - * A project in the workspace. Source is searched for in the root project - * folder and all folders within the project recursively. Optionally, - * referenced projects may be searched as well. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class ProjectSourceContainer extends ContainerSourceContainer { - - boolean fReferencedProjects=false; - /** - * Unique identifier for the project source container type - * (value <code>org.eclipse.debug.core.containerType.project</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.project"; //$NON-NLS-1$ - - /** - * Constructs a project source container. - * - * @param project the project to search for source in - * @param referenced whether referenced projects should be considered - */ - public ProjectSourceContainer(IProject project, boolean referenced) { - super(project, true); - fReferencedProjects = referenced; - } - - /** - * Returns whether referenced projects are considered. - * - * @return whether referenced projects are considered - */ - public boolean isSearchReferencedProjects() { - return fReferencedProjects; - } - - /** - * Returns the project this source container references. - * - * @return the project this source container references - */ - public IProject getProject() { - return (IProject) getContainer(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#isComposite() - */ - public boolean isComposite() { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers() - */ - protected ISourceContainer[] createSourceContainers() throws CoreException { - if (getProject().isOpen()) { - if (isSearchReferencedProjects()) { - IProject project = getProject(); - IProject[] projects = project.getReferencedProjects(); - ISourceContainer[] folders = super.createSourceContainers(); - List all = new ArrayList(folders.length + projects.length); - for (int i = 0; i < folders.length; i++) { - all.add(folders[i]); - } - for (int i = 0; i < projects.length; i++) { - if (project.exists() && project.isOpen()) { - ProjectSourceContainer container = new ProjectSourceContainer(projects[i], true); - container.init(getDirector()); - all.add(container); - } - } - return (ISourceContainer[]) all.toArray(new ISourceContainer[all.size()]); - } - return super.createSourceContainers(); - } - return new ISourceContainer[0]; - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java deleted file mode 100644 index 786a55ecd..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/WorkspaceSourceContainer.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.sourcelookup.ISourceContainer; -import org.eclipse.debug.core.sourcelookup.ISourceContainerType; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; - -/** - * All projects in the workspace. - * <p> - * Clients may instantiate this class. This class is not intended to - * be subclassed. - * </p> - * @since 3.0 - */ -public class WorkspaceSourceContainer extends CompositeSourceContainer { - - /** - * Unique identifier for the workspace source container type - * (value <code>org.eclipse.debug.core.containerType.workspace</code>). - */ - public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.workspace"; //$NON-NLS-1$ - - public WorkspaceSourceContainer() { - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName() - */ - public String getName() { - return SourceLookupMessages.getString("WorkspaceSourceContainer.0"); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - return obj instanceof WorkspaceSourceContainer; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return ResourcesPlugin.getWorkspace().hashCode(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getType() - */ - public ISourceContainerType getType() { - return getSourceContainerType(TYPE_ID); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers() - */ - protected ISourceContainer[] createSourceContainers() throws CoreException { - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - ISourceContainer[] containers = new ISourceContainer[projects.length]; - for (int i = 0; i < projects.length; i++) { - ISourceContainer container = new ProjectSourceContainer(projects[i], false); - container.init(getDirector()); - containers[i] = container; - } - return containers; - } - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java deleted file mode 100644 index e5ad45a72..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.core.sourcelookup.containers; - - -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; - -/** - * Storage implementation for zip entries. - * <p> - * This class may be instantiated; it is not intended to be subclassed. - * </p> - * @see IStorage - * @since 3.0 - */ -public class ZipEntryStorage extends PlatformObject implements IStorage { - - /** - * Zip file associated with zip entry - */ - private ZipFile fArchive; - - /** - * Zip entry - */ - private ZipEntry fZipEntry; - - /** - * Constructs a new storage implementation for the - * given zip entry in the specified zip file - * - * @param archive zip file - * @param entry zip entry - */ - public ZipEntryStorage(ZipFile archive, ZipEntry entry) { - setArchive(archive); - setZipEntry(entry); - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getContents() - */ - public InputStream getContents() throws CoreException { - try { - return getArchive().getInputStream(getZipEntry()); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, SourceLookupMessages.getString("ZipEntryStorage.0"), e)); //$NON-NLS-1$ - } - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getFullPath() - */ - public IPath getFullPath() { - return new Path(getArchive().getName()).append(getZipEntry().getName()); - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#getName() - */ - public String getName() { - int index = getZipEntry().getName().lastIndexOf('\\'); - if (index == -1) { - index = getZipEntry().getName().lastIndexOf('/'); - } - if (index == -1) { - return getZipEntry().getName(); - } - return getZipEntry().getName().substring(index + 1); - } - - /* (non-Javadoc) - * @see org.eclipse.core.resources.IStorage#isReadOnly() - */ - public boolean isReadOnly() { - return true; - } - - /** - * Sets the archive containing the zip entry. - * - * @param archive a zip file - */ - private void setArchive(ZipFile archive) { - fArchive = archive; - } - - /** - * Returns the archive containing the zip entry. - * - * @return zip file - */ - public ZipFile getArchive() { - return fArchive; - } - - /** - * Sets the entry that contains the source. - * - * @param entry the entry that contains the source - */ - private void setZipEntry(ZipEntry entry) { - fZipEntry = entry; - } - - /** - * Returns the entry that contains the source - * - * @return zip entry - */ - public ZipEntry getZipEntry() { - return fZipEntry; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object object) { - return object instanceof ZipEntryStorage && - getArchive().equals(((ZipEntryStorage)object).getArchive()) && - getZipEntry().getName().equals(((ZipEntryStorage)object).getZipEntry().getName()); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getZipEntry().getName().hashCode(); - } -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/package.html b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/package.html deleted file mode 100644 index 7125fb5a2..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/package.html +++ /dev/null @@ -1,20 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> - -<head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<title>Eclipse Debug Platform</title> -</head> - -<body bgcolor="#FFFFFF"> - -<p>Provides implementations of common source containers supporting source lookup.</p> - -<h2>Package Specification</h2> - -<p>This package provides implementations of common source containers, such as - archives, folders, and projects.</p> - -<blockquote> </blockquote> -</body> -</html> |