1 11 package org.eclipse.jdt.internal.launching; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.Path; 15 import org.eclipse.debug.core.sourcelookup.ISourceContainer; 16 import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainerTypeDelegate; 17 import org.eclipse.jdt.launching.sourcelookup.containers.ClasspathContainerSourceContainer; 18 import org.w3c.dom.Document ; 19 import org.w3c.dom.Element ; 20 import org.w3c.dom.Node ; 21 22 27 public class ClasspathContainerSourceContainerTypeDelegate extends AbstractSourceContainerTypeDelegate { 28 29 32 public ISourceContainer createSourceContainer(String memento) throws CoreException { 33 Node node = parseDocument(memento); 34 if (node.getNodeType() == Node.ELEMENT_NODE) { 35 Element element = (Element )node; 36 if ("classpathContainer".equals(element.getNodeName())) { String string = element.getAttribute("path"); if (string == null || string.length() == 0) { 39 abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_5, null); 40 } 41 return new ClasspathContainerSourceContainer(new Path(string)); 42 } 43 abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_6, null); 44 } 45 abort(LaunchingMessages.ClasspathContainerSourceContainerTypeDelegate_7, null); 46 return null; 47 } 48 51 public String getMemento(ISourceContainer container) throws CoreException { 52 ClasspathContainerSourceContainer var = (ClasspathContainerSourceContainer) container; 53 Document document = newDocument(); 54 Element element = document.createElement("classpathContainer"); element.setAttribute("path", var.getPath().toString()); document.appendChild(element); 57 return serializeDocument(document); 58 } 59 } 60 | Popular Tags |