1 11 12 package org.eclipse.ant.internal.core; 13 14 import java.io.File ; 15 import java.net.MalformedURLException ; 16 import java.net.URL ; 17 import org.eclipse.ant.core.AntCorePlugin; 18 import org.eclipse.ant.core.IAntClasspathEntry; 19 import org.eclipse.core.runtime.CoreException; 20 import org.eclipse.core.variables.VariablesPlugin; 21 22 public class AntClasspathEntry implements IAntClasspathEntry { 23 24 private String entryString; 25 private boolean eclipseRequired= false; 26 private URL url= null; 27 28 31 public String getLabel() { 32 33 return entryString; 34 } 35 36 39 public URL getEntryURL() { 40 if (url != null) { 41 return url; 42 } 43 try { 44 String expanded = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(entryString); 45 return new URL ("file:" + expanded); } catch (CoreException e) { 47 try { 48 return new URL ("file:" + entryString); } catch (MalformedURLException e1) { 50 return null; 51 } 52 } catch (MalformedURLException e) { 53 AntCorePlugin.log(e); 54 } 55 return null; 56 } 57 58 public AntClasspathEntry(String entryString) { 59 this.entryString= entryString; 60 } 61 62 public AntClasspathEntry(URL url) { 63 this.url= url; 64 this.entryString= new File (url.getPath()).getAbsolutePath(); 65 } 66 67 70 public boolean equals(Object obj) { 71 if (obj instanceof IAntClasspathEntry) { 72 IAntClasspathEntry other= (IAntClasspathEntry)obj; 73 return entryString.equals(other.getLabel()); 74 } 75 return false; 76 77 } 78 79 82 public int hashCode() { 83 return entryString.hashCode(); 84 } 85 86 89 public String toString() { 90 return getLabel(); 91 } 92 93 96 public boolean isEclipseRuntimeRequired() { 97 return eclipseRequired; 98 } 99 100 public void setEclipseRuntimeRequired(boolean eclipseRequired) { 101 this.eclipseRequired = eclipseRequired; 102 } 103 } | Popular Tags |