1 11 package org.eclipse.debug.core.sourcelookup.containers; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.debug.core.DebugPlugin; 15 import org.eclipse.debug.core.ILaunchConfiguration; 16 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 17 import org.eclipse.debug.core.sourcelookup.ISourceContainerType; 18 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; 19 import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; 20 import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages; 21 22 32 public class DefaultSourceContainer extends CompositeSourceContainer { 33 34 38 public static final String TYPE_ID = DebugPlugin.getUniqueIdentifier() + ".containerType.default"; 40 43 public DefaultSourceContainer() { 44 } 45 46 49 public boolean equals(Object obj) { 50 return obj instanceof DefaultSourceContainer; 51 } 52 53 56 public int hashCode() { 57 return getClass().hashCode(); 58 } 59 60 67 protected ILaunchConfiguration getLaunchConfiguration() { 68 ISourceLookupDirector director = getDirector(); 69 if (director != null) { 70 return director.getLaunchConfiguration(); 71 } 72 return null; 73 } 74 75 78 public ISourceContainerType getType() { 79 return getSourceContainerType(TYPE_ID); 80 } 81 82 89 private ISourcePathComputer getSourcePathComputer() { 90 ISourceLookupDirector director = getDirector(); 91 if (director != null) { 92 return director.getSourcePathComputer(); 93 } 94 return null; 95 } 96 97 100 public String getName() { 101 return SourceLookupMessages.DefaultSourceContainer_0; 102 } 103 104 107 protected ISourceContainer[] createSourceContainers() throws CoreException { 108 ISourcePathComputer sourcePathComputer = getSourcePathComputer(); 109 if (sourcePathComputer != null) { 110 ILaunchConfiguration config= getLaunchConfiguration(); 111 if (config != null) { 112 return sourcePathComputer.computeSourceContainers(config, null); 113 } 114 } 115 116 return new ISourceContainer[0]; 117 } 118 } | Popular Tags |