1 11 package org.eclipse.debug.core.sourcelookup.containers; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.core.runtime.PlatformObject; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.debug.core.DebugPlugin; 18 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 19 import org.eclipse.debug.core.sourcelookup.ISourceContainerType; 20 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; 21 22 29 public abstract class AbstractSourceContainer extends PlatformObject implements ISourceContainer { 30 31 public static final Object [] EMPTY = new Object [0]; 32 33 private ISourceLookupDirector fDirector; 34 35 42 protected void abort(String message, Throwable exception) throws CoreException { 43 IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, exception); 44 throw new CoreException(status); 45 } 46 47 55 protected void warn(String message, Throwable exception) throws CoreException { 56 IStatus status = new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, message, exception); 57 throw new CoreException(status); 58 } 59 60 66 public void dispose() { 67 fDirector = null; 68 } 69 70 73 public ISourceContainer[] getSourceContainers() throws CoreException { 74 return new ISourceContainer[0]; 75 } 76 77 80 public boolean isComposite() { 81 return false; 82 } 83 84 87 public void init(ISourceLookupDirector director) { 88 fDirector = director; 89 } 90 91 98 protected ISourceLookupDirector getDirector() { 99 return fDirector; 100 } 101 102 109 protected boolean isFindDuplicates() { 110 if (getDirector() != null) { 111 return getDirector().isFindDuplicates(); 112 } 113 return false; 114 } 115 116 123 protected ISourceContainerType getSourceContainerType(String id) { 124 return DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(id); 125 } 126 } 127 | Popular Tags |