1 11 package org.eclipse.debug.core.sourcelookup.containers; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.resources.ResourcesPlugin; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.debug.core.DebugPlugin; 17 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 18 import org.eclipse.debug.core.sourcelookup.ISourceContainerType; 19 import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; 20 21 29 public class WorkspaceSourceContainer extends CompositeSourceContainer { 30 31 35 public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.workspace"; 37 public WorkspaceSourceContainer() { 38 } 39 40 43 public String getName() { 44 return SourceLookupMessages.WorkspaceSourceContainer_0; 45 } 46 47 50 public boolean equals(Object obj) { 51 return obj instanceof WorkspaceSourceContainer; 52 } 53 54 57 public int hashCode() { 58 return ResourcesPlugin.getWorkspace().hashCode(); 59 } 60 61 64 public ISourceContainerType getType() { 65 return getSourceContainerType(TYPE_ID); 66 } 67 68 71 protected ISourceContainer[] createSourceContainers() throws CoreException { 72 IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); 73 ISourceContainer[] containers = new ISourceContainer[projects.length]; 74 for (int i = 0; i < projects.length; i++) { 75 ISourceContainer container = new ProjectSourceContainer(projects[i], false); 76 container.init(getDirector()); 77 containers[i] = container; 78 } 79 return containers; 80 } 81 82 } 83 | Popular Tags |