Gets the url associated with this resource. @return the URL
()
| 124 | * @return the URL |
| 125 | */ |
| 126 | public URL getURL() { |
| 127 | if (url == null && file != null) { |
| 128 | String path = getAbsolutePath(); |
| 129 | try { |
| 130 | if (path.startsWith("/")) { //$NON-NLS-1$ |
| 131 | url = new URL("file:" + path); //$NON-NLS-1$ |
| 132 | } else { |
| 133 | url = new URL("file:/" + path); //$NON-NLS-1$ |
| 134 | } |
| 135 | } catch (MalformedURLException ex) { |
| 136 | ex.printStackTrace(); |
| 137 | } |
| 138 | } |
| 139 | if (contentURL != null) { |
| 140 | return contentURL; |
| 141 | } |
| 142 | return url; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Gets the file associated with this resource. |