Skip to content

Commit

Permalink
[ui] Use Eclipse platform-uri syntax in image loader.
Browse files Browse the repository at this point in the history
see eclipse/xtext-eclipse#432

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jan 12, 2018
1 parent 8d1fe92 commit 4956d68
Showing 1 changed file with 11 additions and 9 deletions.
Expand Up @@ -43,22 +43,24 @@
@Singleton
public class QualifiedPluginImageHelper extends PluginImageHelper {

private static final String PLATFORM_URL_PREFIX = "platform:/plugin/"; //$NON-NLS-1$

private static final String PLATFORM_URL_SEPARATOR = "/"; //$NON-NLS-1$

/** Find the descriptor of the image with the given id.
*
* @param name the identifier of the image. It may be qualified with the plugin's id.
* @return the descriptor.
*/
protected ImageDescriptor findImage(String name) {
if (name != null) {
final int extIndex = name.lastIndexOf('.');
if (extIndex > 0) {
final int index = name.lastIndexOf('.', extIndex - 1);
if (index > 0) {
final String pluginId = name.substring(0, index);
final String imageId = name.substring(index + 1);
return AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,
if (name != null && name.startsWith(PLATFORM_URL_PREFIX)) {
final int index = name.indexOf(PLATFORM_URL_SEPARATOR, PLATFORM_URL_PREFIX.length());
if (index >= 0) {
final String pluginId = name.substring(
PLATFORM_URL_PREFIX.length(), index);
final String imageId = name.substring(index + 1);
return AbstractUIPlugin.imageDescriptorFromPlugin(pluginId,
getPathSuffix() + imageId);
}
}
}
return null;
Expand Down

0 comments on commit 4956d68

Please sign in to comment.