1 11 12 package org.eclipse.jdt.internal.launching; 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.debug.core.ILaunchConfiguration; 16 import org.eclipse.jdt.launching.IRuntimeClasspathEntry; 17 import org.w3c.dom.Document ; 18 import org.w3c.dom.Element ; 19 20 21 24 public class VariableClasspathEntry extends AbstractRuntimeClasspathEntry { 25 public static final String TYPE_ID = "org.eclipse.jdt.launching.classpathentry.variableClasspathEntry"; private String variableString; 27 28 31 public VariableClasspathEntry() {} 32 33 37 public VariableClasspathEntry(String variableString) { 38 this.variableString = variableString; 39 } 40 41 44 protected void buildMemento(Document document, Element memento) throws CoreException { 45 memento.setAttribute("variableString", variableString); memento.setAttribute("path", Integer.toString(getClasspathProperty())); } 48 49 52 public void initializeFrom(Element memento) throws CoreException { 53 variableString = memento.getAttribute("variableString"); String property = memento.getAttribute("path"); if(property != null && !"".equals(property)) { try { 57 setClasspathProperty(Integer.parseInt(property)); 58 } 59 catch(NumberFormatException nfe) {} 60 } 61 62 } 63 64 67 public String getTypeId() { 68 return TYPE_ID; 69 } 70 71 74 public IRuntimeClasspathEntry[] getRuntimeClasspathEntries(ILaunchConfiguration configuration) throws CoreException { 75 return new IRuntimeClasspathEntry[0]; 76 } 77 78 81 public String getName() { 82 return variableString; 83 } 84 85 88 public int getType() { 89 return OTHER; 90 } 91 94 public String getVariableString() { 95 return variableString; 96 } 97 100 public void setVariableString(String variableString) { 101 this.variableString = variableString; 102 } 103 104 107 public int hashCode() { 108 if (variableString != null) { 109 return variableString.hashCode(); 110 } 111 return 0; 112 } 113 114 117 public boolean equals(Object obj) { 118 if (obj instanceof VariableClasspathEntry) { 119 VariableClasspathEntry other= (VariableClasspathEntry)obj; 120 if (variableString != null) { 121 return variableString.equals(other.variableString); 122 } 123 } 124 return false; 125 } 126 } 127 | Popular Tags |