From 7820b9daefdca8ace3df83ed528d302dae6720b6 Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Sun, 24 Sep 2023 00:24:29 +0200 Subject: [PATCH 1/2] Not all custom search scopes were registered --- CHANGELOG.md | 1 + .../impl/DefaultSearchScopeConfigurator.java | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e62cfa24a..ac2f741e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - `SAP Commerce` tool window sometimes appears without any content [#725](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/725) - Register sub-modules source directories for custom modules [#728](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/728) - Register test source directories for custom backoffice modules [#736](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/736) +- Not all custom search scopes were registered [#738](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/738) ## [2023.2.8] diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java index 022d553d4..2ced5cd19 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java @@ -20,11 +20,12 @@ package com.intellij.idea.plugin.hybris.project.configurators.impl; import com.intellij.find.FindSettings; +import com.intellij.icons.AllIcons; import com.intellij.ide.projectView.impl.ModuleGroup; import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils; +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons; import com.intellij.idea.plugin.hybris.project.configurators.SearchScopeConfigurator; import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.ModifiableModuleModel; import com.intellij.openapi.progress.ProgressIndicator; @@ -33,6 +34,7 @@ import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NotNull; +import javax.swing.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -61,7 +63,7 @@ public void configure( NamedScope hybrisScope = null; if (groupExists(model, customGroupName)) { - customScope = createScope(customGroupName); + customScope = createScope(HybrisIcons.INSTANCE.getEXTENSION_CUSTOM(), customGroupName); newScopes.add(customScope); newScopes.add(new NamedScope( @@ -78,19 +80,19 @@ public void configure( )); } if (groupExists(model, platformGroupName)) { - platformScope = createScope(platformGroupName); + platformScope = createScope(HybrisIcons.INSTANCE.getMODULE_PLATFORM_GROUP(), platformGroupName); newScopes.add(platformScope); } if (groupExists(model, commerceGroupName)) { - commerceScope = createScope(commerceGroupName); + commerceScope = createScope(HybrisIcons.INSTANCE.getMODULE_COMMERCE_GROUP(), commerceGroupName); newScopes.add(commerceScope); } if (platformScope != null && commerceScope != null) { - hybrisScope = createScopeFor2Groups(platformGroupName, commerceGroupName); + hybrisScope = createScopeFor2Groups(HybrisIcons.INSTANCE.getEXTENSION_PLATFORM(), platformGroupName, commerceGroupName); newScopes.add(hybrisScope); } if (groupExists(model, nonHybrisGroupName)) { - newScopes.add(createScope(nonHybrisGroupName)); + newScopes.add(createScope(AllIcons.Ide.LocalScope, nonHybrisGroupName)); } newScopes.add(new NamedScope( HybrisI18NBundleUtils.message("hybris.scope.editable.all.ts.files"), @@ -151,21 +153,25 @@ private static void addOrReplaceScopes(@NotNull final Project project, @NotNull private static boolean groupExists(@NotNull final ModifiableModuleModel model, final String groupName) { return !new ModuleGroup(List.of(groupName)) - .modulesInGroup(model.getProject()) + .modulesInGroup(model.getProject(), true) .isEmpty(); } @NotNull - private static NamedScope createScope(@NotNull final String groupName) { + private static NamedScope createScope(final Icon icon, @NotNull final String groupName) { final FilePatternPackageSet filePatternPackageSet = new FilePatternPackageSet( groupName + '*', "*//*" ); - return new NamedScope(SEARCH_SCOPE_Y_PREFIX + ' ' + groupName, filePatternPackageSet); + return new NamedScope( + SEARCH_SCOPE_Y_PREFIX + ' ' + groupName, + icon, + filePatternPackageSet + ); } @NotNull - private static NamedScope createScopeFor2Groups(@NotNull final String firstGroupName, @NotNull final String secondGroupName) { + private static NamedScope createScopeFor2Groups(final Icon icon, @NotNull final String firstGroupName, @NotNull final String secondGroupName) { final FilePatternPackageSet firstFilePatternPackageSet = new FilePatternPackageSet( firstGroupName + '*', "*//*" @@ -179,7 +185,8 @@ private static NamedScope createScopeFor2Groups(@NotNull final String firstGroup secondFilePatternPackageSet ); return new NamedScope( - SEARCH_SCOPE_Y_PREFIX + ' ' + firstGroupName + ' ' + secondGroupName, + SEARCH_SCOPE_Y_PREFIX + ' ' + firstGroupName + " & " + secondGroupName, + icon, unionPackageSet ); } From 4b7c5e69299092704ce757a462af3416330befdc Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Sun, 24 Sep 2023 00:24:58 +0200 Subject: [PATCH 2/2] Not all custom search scopes were registered --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac2f741e3..6f0d2f1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ - `SAP Commerce` tool window sometimes appears without any content [#725](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/725) - Register sub-modules source directories for custom modules [#728](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/728) - Register test source directories for custom backoffice modules [#736](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/736) -- Not all custom search scopes were registered [#738](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/738) +- Not all custom search scopes registered [#738](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/738) ## [2023.2.8]