From 10945e9811e7a8fa4f202331bc3f82669a804936 Mon Sep 17 00:00:00 2001 From: Dmitriy Marmyshev Date: Mon, 1 Aug 2022 14:46:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=20=D0=BA=D0=BE=D0=B4-?= =?UTF-8?q?=D1=80=D0=B5=D0=B2=D1=8C=D1=8E=20#1077?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/right/InternalRightInfosService.java | 2 +- .../v8codestyle/right/check/RoleRightSetCheck.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) 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 getDefaultObjectsWithRight(RoleDescription description, IProgressMonitor monitor) { - Collection result = new LinkedList<>(); - IProject project = resourceLookup.getProject(description); Set objectIdForRole = getRoleTopObjects(project, description, monitor); @@ -347,6 +345,9 @@ public abstract class RoleRightSetCheck return Collections.emptyList(); } + // return only unique objects + Map 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 getRoleTopObjects(IProject project, RoleDescription description, IProgressMonitor monitor)