1 11 package org.eclipse.debug.internal.core.sourcelookup; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IConfigurationElement; 15 import org.eclipse.core.runtime.IStatus; 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.ISourceContainerTypeDelegate; 21 22 27 public class SourceContainerType implements ISourceContainerType { 28 29 private ISourceContainerTypeDelegate fDelegate = null; 31 32 private IConfigurationElement fElement = null; 34 35 40 public SourceContainerType(IConfigurationElement element) { 41 fElement = element; 42 } 43 44 47 public ISourceContainer createSourceContainer(String memento) throws CoreException { 48 return getDelegate().createSourceContainer(memento); 49 } 50 53 public String getMemento(ISourceContainer container) throws CoreException { 54 if (this.equals(container.getType())) { 55 return getDelegate().getMemento(container); 56 } 57 IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, SourceLookupMessages.SourceContainerType_3, null); 58 throw new CoreException(status); 59 } 60 63 public String getName() { 64 return fElement.getAttribute("name"); } 66 69 public String getId() { 70 return fElement.getAttribute("id"); } 72 73 78 private ISourceContainerTypeDelegate getDelegate() throws CoreException { 79 if (fDelegate == null) { 80 fDelegate = (ISourceContainerTypeDelegate) fElement.createExecutableExtension("class"); } 82 return fDelegate; 83 } 84 87 public String getDescription() { 88 return fElement.getAttribute("description"); } 90 } 91 | Popular Tags |