diff --git a/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/Template.java b/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/Template.java index 5195f0867e9..c35bc8840ee 100644 --- a/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/Template.java +++ b/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/Template.java @@ -43,6 +43,11 @@ public class Template { public ImageDescriptor getIcon() { String iconPath = element.getAttribute("icon"); //$NON-NLS-1$ + + if (iconPath == null) { + return null; + } + return AbstractUIPlugin.imageDescriptorFromPlugin(element.getNamespaceIdentifier(), iconPath); } diff --git a/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/TemplateTable.java b/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/TemplateTable.java index 36ca41917ad..0aaf7c8147c 100644 --- a/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/TemplateTable.java +++ b/bundles/org.eclipse.tools.templates.ui/src/org/eclipse/tools/templates/ui/internal/TemplateTable.java @@ -142,7 +142,7 @@ public class TemplateTable implements Listener { Template template = (Template) item.getData(); ImageDescriptor imageDesc = template.getIcon(); Image image = images.get(imageDesc); - if (image == null) { + if (image == null && imageDesc != null) { image = imageDesc.createImage(); images.put(imageDesc, image); } @@ -152,6 +152,8 @@ public class TemplateTable implements Listener { rect = image.getBounds(); y = event.y + Math.max(0, (event.height - rect.height) / 2); gc.drawImage(image, event.x + 4, y); + } else { + y = event.y + Math.max(0, (event.height - 48) / 2); } gc.setFont(fontBold); String name = template.getLabel();