diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/InternalRightInfosService.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/InternalRightInfosService.java index b44d667d..3fed04c0 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/InternalRightInfosService.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/InternalRightInfosService.java @@ -60,7 +60,7 @@ public class InternalRightInfosService } /** - * Gets the rights of some {@link EClass} of configuration metadata object that may has some rights. + * Gets the rights of some {@link EClass} of configuration metadata object that may have some rights. * * @param eClass the {@link EClass} of configuration metadata object that has some rights, cannot be {@code null}. * @param context the context object of the configuration to determine platform version, cannot be {@code null}. diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java index d5eccf16..7efd621a 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java @@ -26,9 +26,9 @@ import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.ROLE_DESCRIPT import java.text.MessageFormat; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -251,7 +251,7 @@ public abstract class RoleRightSetCheck } else { - // add marker as closer as possible to the probleb place in the model + // add marker as closer as possible to the problem place in the model resultAceptor.addIssue(message, objectRights, OBJECT_RIGHTS__OBJECT); } } @@ -337,8 +337,6 @@ public abstract class RoleRightSetCheck private Collection<MdObject> getDefaultObjectsWithRight(RoleDescription description, IProgressMonitor monitor) { - Collection<MdObject> result = new LinkedList<>(); - IProject project = resourceLookup.getProject(description); Set<Long> objectIdForRole = getRoleTopObjects(project, description, monitor); @@ -347,6 +345,9 @@ public abstract class RoleRightSetCheck return Collections.emptyList(); } + // return only unique objects + Map<Long, MdObject> result = new HashMap<>(); + IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(project); RightsModelUtil.SUPPORTED_RIGHT_ECLASSES.stream().forEach(eClass -> { @@ -371,12 +372,12 @@ public abstract class RoleRightSetCheck if (!objectIdForRole.contains(bmObjectId)) { - result.add((MdObject)object); + result.put(bmObjectId, (MdObject)object); } } } }); - return result; + return result.values(); } private Set<Long> getRoleTopObjects(IProject project, RoleDescription description, IProgressMonitor monitor)