Commit e5008af8 authored by Simon Barner's avatar Simon Barner
Browse files

registerConstraintUI(): Fix check for duplicate UI registrations

* Check for duplicates was based on "cstrClass" (of type Class), whereas
  the registration is based on the class name
* Note: This change does not affect the actual registration, hence no
  change in behavior is expected.
* Revealed by warning on unlikely argument of (type Class) for
  string2cstrMap.get()

Issue-Ref: 3539
Issue-Url: https://af3-developer.fortiss.org/issues/3539

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 7995b049
ActionService.java e29126b5947c9fd2f1d82bb87001b9d0ead50c3b GREEN
AllocationEditPartFactoryService.java 81bd227736013f1157ba9d0f79a9f3deefe10064 GREEN
ConstraintLabelDecorator.java ac138bfc97ea3b2f8fde0497ade915e4cd942af1 GREEN
ConstraintUIService.java 308dc3df69cbd18a91a051038a77b6e1184937cc GREEN
ConstraintUIService.java 433e35bb1c9bbc628c6ee070ff45632400becf4a YELLOW
ContextMenuService.java ca3c899293f25b70ce8e5f0d86ca2f9683329d81 GREEN
EditPartFactoryService.java e9180c0020f1769d9e24ef3c08f9ca5599dbc5c3 GREEN
MarkerService.java b01b7706034691683df7bbc2e7828c42574b3147 GREEN
......
......@@ -100,12 +100,12 @@ public final class ConstraintUIService
@Override
public void registerConstraintUI(Class<? extends IConstraintUI> cstrUIClass,
Class<? extends IConstraint> cstrClass) {
if(string2cstrMap.get(cstrClass) != null) {
String name = cstrClass.getName();
String name = cstrClass.getName();
if(string2cstrMap.get(name) != null) {
warning(ToolingKernelActivator.getDefault(),
"Encountered more than one registered constraint UI associated with " + name);
}
string2cstrMap.put(cstrClass.getName(), cstrClass);
string2cstrMap.put(name, cstrClass);
cstr2cstrUIMap.put(cstrClass, cstrUIClass);
try {
instanceMap.put(cstrUIClass, cstrUIClass.getConstructor().newInstance());
......
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