Commit d66d3e7b authored by David Hoksza's avatar David Hoksza
Browse files

fix not working annotations when one of the annotations has a parameter selected

parent 52a9a187
Pipeline #4109 passed with stage
in 1 minute and 4 seconds
...@@ -225,7 +225,7 @@ public class ModelAnnotator { ...@@ -225,7 +225,7 @@ public class ModelAnnotator {
* @param progressUpdater * @param progressUpdater
* callback function used for updating progress of the function * callback function used for updating progress of the function
*/ */
public void performAnnotations(Model model, final IProgressUpdater progressUpdater) { public void performAnnotations(Model model, final IProgressUpdater progressUpdater) {
performAnnotations(model, progressUpdater, null, null); performAnnotations(model, progressUpdater, null, null);
} }
...@@ -241,7 +241,7 @@ public class ModelAnnotator { ...@@ -241,7 +241,7 @@ public class ModelAnnotator {
* callback function used for updating progress of the function * callback function used for updating progress of the function
*/ */
public void performAnnotations(Model model, final IProgressUpdater progressUpdater, public void performAnnotations(Model model, final IProgressUpdater progressUpdater,
Map<Class<?>, List<ElementAnnotator>> annotators, Map<Class<?>, List<UserAnnotatorsParam>> annotatorsParams) { Map<Class<?>, List<ElementAnnotator>> annotators, Map<Class<?>, List<UserAnnotatorsParam>> annotatorsParams) {
progressUpdater.setProgress(0); progressUpdater.setProgress(0);
List<Model> models = new ArrayList<Model>(); List<Model> models = new ArrayList<Model>();
models.add(model); models.add(model);
...@@ -338,7 +338,8 @@ public class ModelAnnotator { ...@@ -338,7 +338,8 @@ public class ModelAnnotator {
* callback function used to refresh progress of function execution * callback function used to refresh progress of function execution
*/ */
protected void annotateModel(Model model, IProgressUpdater progressUpdater, protected void annotateModel(Model model, IProgressUpdater progressUpdater,
Map<Class<?>, List<ElementAnnotator>> annotators, Map<Class<?>, List<UserAnnotatorsParam>> annotatorsParams) { Map<Class<?>, List<ElementAnnotator>> annotators, Map<Class<?>, List<UserAnnotatorsParam>> annotatorsParams) {
ElementUtils elementUtils = new ElementUtils(); ElementUtils elementUtils = new ElementUtils();
progressUpdater.setProgress(0); progressUpdater.setProgress(0);
...@@ -355,18 +356,19 @@ public class ModelAnnotator { ...@@ -355,18 +356,19 @@ public class ModelAnnotator {
if (list == null) { if (list == null) {
list = getDefaultAnnotators(); list = getDefaultAnnotators();
} }
for (ElementAnnotator elementAnnotator : list) { for (ElementAnnotator elementAnnotator : list) {
try { try {
if (annotatorsParams != null) { if (annotatorsParams != null) {
List<UserAnnotatorsParam> params = annotatorsParams.get(elementAnnotator.getClass()); List<UserAnnotatorsParam> params = annotatorsParams.get(elementAnnotator.getClass());
if (params != null) { if (params != null) {
elementAnnotator.annotateElement(element, params); elementAnnotator.annotateElement(element, params);
} else {
elementAnnotator.annotateElement(element);
} }
} else { } else {
elementAnnotator.annotateElement(element); elementAnnotator.annotateElement(element);
} }
} catch (AnnotatorException e) { } catch (AnnotatorException e) {
logger.warn(elementUtils.getElementTag(element) + " " + elementAnnotator.getCommonName() logger.warn(elementUtils.getElementTag(element) + " " + elementAnnotator.getCommonName()
+ " annotation problem: " + e.getMessage()); + " annotation problem: " + e.getMessage());
......
Supports Markdown
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