Commit bcadd2dd authored by Simon Barner's avatar Simon Barner

Avoid duplicated warnings for missing icons

Issue-Ref: 4003
Issue-Url: https://af3-developer.fortiss.org/issues/4003Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 8bba4e87
......@@ -8,7 +8,7 @@ FXEditorBase.java 40caf638c7b4c02da5aece0d9d58883bce630e76 GREEN
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java 86fb5b558794ffa6471ca343934592b6fa4277f6 GREEN
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN
ModelElementHandlerBase.java d0efc1e9ca2fbbefb861f1ae8176ad9ec08a08a8 GREEN
ModelElementHandlerBase.java fbd38bcaec6615bcc95be7fdb847f85577c8cd47 YELLOW
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 20fb1daea544123ea941743aafeb9ac59daf5356 GREEN
......
......@@ -22,8 +22,10 @@ import static org.fortiss.tooling.kernel.utils.LoggingUtils.warning;
import static org.fortiss.tooling.kernel.utils.ResourceUtils.getResourceURI;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
......@@ -53,6 +55,9 @@ public abstract class ModelElementHandlerBase<T extends EObject>
/** Stores the icon image. */
private Map<ImageDescriptor, Image> iconImages = new HashMap<ImageDescriptor, Image>();
/** Caches the known elements without icon. */
private Set<String> elementsWithOutIcons = new HashSet<>();
/** {@inheritDoc} */
@Override
public String getDescription(T element) {
......@@ -76,11 +81,14 @@ public abstract class ModelElementHandlerBase<T extends EObject>
if(pluginId == null || iconPath == null) {
String elementTypeName =
element != null ? element.getClass().getCanonicalName() : "<null>";
String pluginIdName = pluginId != null ? pluginId : "<null>";
String iconPathName = iconPath != null ? iconPath : "<null>";
warning(ToolingKernelUIActivator.getDefault(),
"Failed to load icon for " + elementTypeName + ". Plugin ID: " + pluginIdName +
", icon path: " + iconPathName);
if(!elementsWithOutIcons.contains(elementTypeName)) {
String pluginIdName = pluginId != null ? pluginId : "<null>";
String iconPathName = iconPath != null ? iconPath : "<null>";
warning(ToolingKernelUIActivator.getDefault(),
"Failed to load icon for " + elementTypeName + ". Plugin ID: " +
pluginIdName + ", icon path: " + iconPathName);
elementsWithOutIcons.add(elementTypeName);
}
return null;
}
return imageDescriptorFromBundle(pluginId, iconPath).orElse(null);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment