1 11 package org.eclipse.update.internal.configurator; 12 13 import org.eclipse.osgi.util.NLS; 14 15 16 18 public class PluginEntry { 19 20 private String pluginId; 21 private String pluginVersion; 22 private boolean isFragment = false; 23 private VersionedIdentifier versionId; 24 private String url; 25 26 public PluginEntry() { 27 super(); 28 } 29 30 34 public String getURL() { 35 return url; 36 } 37 38 41 public void setURL(String url) { 42 this.url = url; 43 } 44 45 50 public String getPluginIdentifier() { 51 return pluginId; 52 } 53 54 59 public String getPluginVersion() { 60 return pluginVersion; 61 } 62 63 70 public boolean isFragment() { 71 return isFragment; 72 } 73 74 80 void setPluginIdentifier(String pluginId) { 81 this.pluginId = pluginId; 82 } 83 84 90 void setPluginVersion(String pluginVersion) { 91 this.pluginVersion = pluginVersion; 92 } 93 94 100 public void isFragment(boolean isFragment) { 101 this.isFragment = isFragment; 102 } 103 104 107 public String toString() { 108 String msg = (getPluginIdentifier()!=null)?getPluginIdentifier().toString():""; msg += getPluginVersion()!=null?" "+getPluginVersion().toString():""; msg += isFragment()?" fragment":" plugin"; return msg; 112 } 113 114 115 118 public VersionedIdentifier getVersionedIdentifier() { 119 if (versionId != null) 120 return versionId; 121 122 String id = getPluginIdentifier(); 123 String ver = getPluginVersion(); 124 if (id != null && ver != null) { 125 try { 126 versionId = new VersionedIdentifier(id, ver); 127 return versionId; 128 } catch (Exception e) { 129 Utils.log(NLS.bind(Messages.PluginEntry_versionError, (new String [] { id, ver }))); 130 } 131 } 132 133 versionId = new VersionedIdentifier("",null); return versionId; 135 } 136 137 141 void setVersionedIdentifier(VersionedIdentifier identifier) { 142 setPluginIdentifier(identifier.getIdentifier()); 143 setPluginVersion(identifier.getVersion().toString()); 144 } 145 146 153 public boolean equals(Object object) { 154 if (!(object instanceof PluginEntry)) 155 return false; 156 PluginEntry e = (PluginEntry) object; 157 return getVersionedIdentifier().equals(e.getVersionedIdentifier()); 158 } 159 160 163 public int hashCode() { 164 return getVersionedIdentifier().hashCode(); 165 } 166 } 167 | Popular Tags |