Commit 03c59007 authored by Alexander Diewald's avatar Alexander Diewald

Merge branch '4003' into 'master'

4003: ModelElementHandler: avoid duplicated warnings for missing icons

See merge request !113
parents 8bba4e87 0e1ff178
......@@ -8,10 +8,10 @@ FXEditorBase.java 40caf638c7b4c02da5aece0d9d58883bce630e76 GREEN
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java 86fb5b558794ffa6471ca343934592b6fa4277f6 GREEN
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN
ModelElementHandlerBase.java d0efc1e9ca2fbbefb861f1ae8176ad9ec08a08a8 GREEN
ModelElementHandlerBase.java fbd38bcaec6615bcc95be7fdb847f85577c8cd47 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 20fb1daea544123ea941743aafeb9ac59daf5356 GREEN
PropertySectionBase.java a768b0b8f833999d31bdca1cf727f6bc48acc837 GREEN
TutorialStepUIAtomicBase.java cea2a158158b476de2108d2309afcf47f217b6d9 GREEN
TutorialStepUIAtomicWithWhitelistBase.java a9788ae514f62d27169c737ef59fb583234b5d43 GREEN
TutorialStepUICompositeBase.java 8225210eacb5b88de47d78280c5819f572f00ffa 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);
......
......@@ -374,7 +374,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* digits to be used in the String representation.
*/
private void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, NumberFormat nf) {
IValidator<?> numberValidator, NumberFormat nf) {
nf.setGroupingUsed(false);
performComplexTextBinding(dbc, text, observedValue, fromBigDecimal(nf), toBigDecimal(nf),
......@@ -386,7 +386,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* digits to be used in the String representation.
*/
protected void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
NumberFormat nf = getNumberInstance();
bindBigDecimalValue(text, observedValue, numberValidator, nf);
......@@ -397,7 +397,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* used in the String representation.
*/
protected void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, int maxFractionDigits) {
IValidator<?> numberValidator, int maxFractionDigits) {
NumberFormat nf = getNumberInstance();
nf.setMaximumFractionDigits(maxFractionDigits);
......@@ -426,7 +426,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* to be used in the String representation.
*/
protected void bindDoubleValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
performComplexTextBinding(dbc, text, observedValue, fromDouble(false), toDouble(false),
FLOAT_VALIDATOR, numberValidator);
}
......@@ -436,7 +436,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* used in the String representation.
*/
protected void bindDoubleValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, int maxFractionDigits) {
IValidator<?> numberValidator, int maxFractionDigits) {
NumberFormat nf = getNumberInstance();
nf.setMaximumFractionDigits(maxFractionDigits);
......@@ -456,7 +456,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
/** Binds a integer value. */
protected void bindIntegerValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
performComplexTextBinding(dbc, text, observedValue, fromInteger(false), toInteger(false),
INT_VALIDATOR, numberValidator);
}
......
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