From 177d34e88b368eebd97645c9b43414d7208af6e9 Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Mon, 20 Feb 2023 16:54:04 +0100 Subject: [PATCH] #234 | Improved representation of the available extensions listing --- resources/META-INF/plugin-release-info.xml | 1 + resources/icons/extension-cloud.svg | 55 +++ resources/icons/extension-cloud_dark.svg | 55 +++ resources/icons/extension-custom.svg | 28 ++ resources/icons/extension-custom_dark.svg | 28 ++ resources/icons/extension-ootb.svg | 36 ++ resources/icons/extension-ootb_dark.svg | 36 ++ .../hybris/ant/HybrisAntBuildListener.java | 6 +- .../ExtensionsNameCompletionProvider.kt | 38 +- ...equiredExtensionsNameCompletionProvider.kt | 6 +- .../EiUnknownExtensionDefinition.kt | 2 +- .../LeUnknownExtensionDefinition.kt | 3 +- .../ManifestCommerceExtensionInspection.kt | 4 +- .../plugin/hybris/common/HybrisConstants.kt | 391 +++++++++++------- .../common/services/CommonIdeaService.java | 2 + .../services/impl/DefaultCommonIdeaService.kt | 6 +- .../hybris/common/utils/HybrisIcons.java | 6 + .../impl/DefaultGradleConfigurator.java | 6 +- .../impl/DefaultMavenConfigurator.java | 2 +- .../DefaultModuleSettingsConfigurator.java | 6 +- .../DefaultHybrisProjectDescriptor.java | 6 +- .../descriptors/HybrisModuleDescriptor.java | 10 + .../HybrisModuleDescriptorType.java | 2 +- .../RegularHybrisModuleDescriptor.java | 40 +- .../ImportProjectProgressModalWindow.java | 22 +- .../wizard/HybrisWorkspaceRootStep.java | 10 +- .../HybrisJUnitExtension.java | 3 +- .../hybris/settings/ExtensionDescriptor.kt | 32 ++ ...teInstancesSettingsConfigurableProvider.kt | 2 +- .../settings/HybrisProjectSettings.java | 367 ---------------- .../hybris/settings/HybrisProjectSettings.kt | 50 +++ .../HybrisProjectSettingsComponent.java | 64 --- .../HybrisProjectSettingsComponent.kt | 73 ++++ ...brisProjectSettingsConfigurableProvider.kt | 2 +- .../plugin/hybris/settings/ModuleSettings.kt | 23 ++ .../forms/HybrisProjectSettingsForm.java | 18 +- .../HybrisProjectStructureStartupActivity.kt | 4 +- .../ManifestCommerceJsonSchemaFileProvider.kt | 2 +- .../ManifestDataHubJsonSchemaFileProvider.kt | 2 +- ...ascriptStorefrontJsonSchemaFileProvider.kt | 2 +- .../toolwindow/HybrisToolWindowFactory.kt | 2 +- .../plugin/hybris/view/HybrisProjectView.java | 6 +- 42 files changed, 799 insertions(+), 660 deletions(-) create mode 100644 resources/icons/extension-cloud.svg create mode 100644 resources/icons/extension-cloud_dark.svg create mode 100644 resources/icons/extension-custom.svg create mode 100644 resources/icons/extension-custom_dark.svg create mode 100644 resources/icons/extension-ootb.svg create mode 100644 resources/icons/extension-ootb_dark.svg create mode 100644 src/com/intellij/idea/plugin/hybris/settings/ExtensionDescriptor.kt delete mode 100644 src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.java create mode 100644 src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.kt delete mode 100644 src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java create mode 100644 src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.kt create mode 100644 src/com/intellij/idea/plugin/hybris/settings/ModuleSettings.kt diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml index fc49a03f1..019d1be2e 100644 --- a/resources/META-INF/plugin-release-info.xml +++ b/resources/META-INF/plugin-release-info.xml @@ -102,6 +102,7 @@
  • Feature: Added possibility to group by Item parent for Type System preview (#211)
  • Feature: Added completion and navigation for Index attributes within items.xml (#207)
  • Feature: Added completion for meta tags within extensioninfo.xml (#230)
  • +
  • Feature: Improved representation of the available extensions listing (#233)
  • Feature: Improved project startup performance (#210)
  • Feature: Added listing of references for id attribute within Business Process definition (#214)
  • Feature: Added listing of references for multiple Cockpitng definitions (#216)
  • diff --git a/resources/icons/extension-cloud.svg b/resources/icons/extension-cloud.svg new file mode 100644 index 000000000..3d772c69b --- /dev/null +++ b/resources/icons/extension-cloud.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/extension-cloud_dark.svg b/resources/icons/extension-cloud_dark.svg new file mode 100644 index 000000000..5a5616fc3 --- /dev/null +++ b/resources/icons/extension-cloud_dark.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/extension-custom.svg b/resources/icons/extension-custom.svg new file mode 100644 index 000000000..48580ff4e --- /dev/null +++ b/resources/icons/extension-custom.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/resources/icons/extension-custom_dark.svg b/resources/icons/extension-custom_dark.svg new file mode 100644 index 000000000..17a7273c9 --- /dev/null +++ b/resources/icons/extension-custom_dark.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/resources/icons/extension-ootb.svg b/resources/icons/extension-ootb.svg new file mode 100644 index 000000000..8c7dddf78 --- /dev/null +++ b/resources/icons/extension-ootb.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/extension-ootb_dark.svg b/resources/icons/extension-ootb_dark.svg new file mode 100644 index 000000000..47b54d239 --- /dev/null +++ b/resources/icons/extension-ootb_dark.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java b/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java index a815d86c5..3a26512f8 100644 --- a/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java +++ b/src/com/intellij/idea/plugin/hybris/ant/HybrisAntBuildListener.java @@ -91,10 +91,10 @@ public void buildFinished(final AntFinishedExecutionEvent event) { private void findAntResult(final Map resultMap) { for (Project project : ProjectManager.getInstance().getOpenProjects()) { - final HybrisProjectSettings hybrisProjectSettings = - HybrisProjectSettingsComponent.getInstance(project).getState(); + final var settings = HybrisProjectSettingsComponent.getInstance(project); + final var hybrisProjectSettings = settings.getState(); - if (!hybrisProjectSettings.isHybrisProject()) { + if (!settings.isHybrisProject()) { continue; } diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/ExtensionsNameCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/ExtensionsNameCompletionProvider.kt index 0174bfb97..c934e8edb 100644 --- a/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/ExtensionsNameCompletionProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/ExtensionsNameCompletionProvider.kt @@ -22,6 +22,9 @@ import com.intellij.codeInsight.completion.CompletionParameters import com.intellij.codeInsight.completion.CompletionProvider import com.intellij.codeInsight.completion.CompletionResultSet import com.intellij.codeInsight.lookup.LookupElementBuilder +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType +import com.intellij.idea.plugin.hybris.settings.ExtensionDescriptor import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent import com.intellij.openapi.application.ApplicationManager import com.intellij.util.ProcessingContext @@ -31,14 +34,39 @@ class ExtensionsNameCompletionProvider : CompletionProvider HybrisIcons.EXTENSION_CLOUD + HybrisModuleDescriptorType.CUSTOM -> HybrisIcons.EXTENSION_CUSTOM + HybrisModuleDescriptorType.EXT -> HybrisIcons.EXTENSION_EXT + HybrisModuleDescriptorType.OOTB -> HybrisIcons.EXTENSION_OOTB + HybrisModuleDescriptorType.PLATFORM -> HybrisIcons.EXTENSION_PLATFORM + else -> null + } + ) + } + .forEach { result.addElement(it) } + } + + private fun tail(extensionDescriptor: ExtensionDescriptor): String? { + val tail = listOfNotNull( + if (extensionDescriptor.deprecated) "deprecated" else null, + if (extensionDescriptor.extGenTemplateExtension) "template" else null, + if (extensionDescriptor.hacModule) "hac" else null, + if (extensionDescriptor.backofficeModule) "backoffice" else null, + ).joinToString(", ") + return if (tail.isBlank()) null + else " ($tail)" } companion object { val instance: CompletionProvider = - ApplicationManager.getApplication().getService(ExtensionsNameCompletionProvider::class.java) + ApplicationManager.getApplication().getService(ExtensionsNameCompletionProvider::class.java) } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/RequiredExtensionsNameCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/RequiredExtensionsNameCompletionProvider.kt index ae697cb57..7bf276e18 100644 --- a/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/RequiredExtensionsNameCompletionProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/codeInsight/completion/provider/RequiredExtensionsNameCompletionProvider.kt @@ -47,9 +47,9 @@ class RequiredExtensionsNameCompletionProvider: CompletionProvider()?.name == "storefrontAddons") || (parent is JsonProperty && JsonPsiUtil.isPropertyValue(o) && (parent.name == "name") && parent.parentOfType()?.name == "webapps")) - } - } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt index d91296e98..6c1bea618 100644 --- a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt +++ b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt @@ -31,6 +31,23 @@ object HybrisConstants { const val CCV2_CORE_CUSTOMIZE_NAME = "core-customize" const val CCV2_DATAHUB_NAME = "datahub" const val CCV2_JS_STOREFRONT_NAME = "js-storefront" + val CCV2_COMMERCE_CLOUD_EXTENSIONS = arrayOf( + "azurecloudhotfolder", + "cloudmediaconversion", + "cloudcommons", + "cloudhotfolder", + "cloudstorestorefront", + "cloudstoreinitialdata", + "cloudstorefulfilmentprocess", + "cloudstorefacades", + "cloudstorecore", + "cloudstorecockpits" + ) + val CCV2_COMMERCE_EXTENSION_PACKS = arrayOf( + "hybris-commerce-integrations", + "cx-commerce-crm-integrations", + "media-telco" + ) const val NOTIFICATION_GROUP_HYBRIS = "[y] SAP Commerce" @@ -199,11 +216,11 @@ object HybrisConstants { val TS_PRIMITIVE_TYPES = setOf(TS_PRIMITIVE_BYTE, TS_PRIMITIVE_SHORT, TS_PRIMITIVE_INT, TS_PRIMITIVE_LONG, TS_PRIMITIVE_FLOAT, TS_PRIMITIVE_DOUBLE, TS_PRIMITIVE_CHAR, TS_PRIMITIVE_BOOLEAN) val TS_TYPECODE_MIN_ALLOWED = 10000 - val TS_TYPECODE_RANGE_B2BCOMMERCE = TS_TYPECODE_MIN_ALLOWED .. 10099 - val TS_TYPECODE_RANGE_COMMONS = 13200 .. 13299 - val TS_TYPECODE_RANGE_XPRINT = 24400 .. 24599 - val TS_TYPECODE_RANGE_PRINT = 23400 .. 23999 - val TS_TYPECODE_RANGE_PROCESSING = 32700 .. 32799 + val TS_TYPECODE_RANGE_B2BCOMMERCE = TS_TYPECODE_MIN_ALLOWED..10099 + val TS_TYPECODE_RANGE_COMMONS = 13200..13299 + val TS_TYPECODE_RANGE_XPRINT = 24400..24599 + val TS_TYPECODE_RANGE_PRINT = 23400..23999 + val TS_TYPECODE_RANGE_PROCESSING = 32700..32799 val BP_NAVIGABLE_ELEMENTS = setOf("action", "end", "wait", "join", "notify", "split", "scriptAction", "choice") @@ -254,89 +271,152 @@ object HybrisConstants { private const val WEB_XML_FILE_NAME = "web.xml" private const val WEB_INF_DIRECTORY = "WEB-INF" - @JvmField val IMPEX_MODIFIER_BOOLEAN_VALUES = setOf("true", "false") - @JvmField val IMPEX_MODIFIER_MODE_VALUES = setOf("append", "remove") + @JvmField + val IMPEX_MODIFIER_BOOLEAN_VALUES = setOf("true", "false") + @JvmField + val IMPEX_MODIFIER_MODE_VALUES = setOf("append", "remove") const val IMPEX_CLASS_PROCESSOR = "de.hybris.platform.impex.jalo.imp.ImportProcessor" const val IMPEX_CLASS_TRANSLATOR = "de.hybris.platform.impex.jalo.translators.AbstractValueTranslator" const val IMPEX_CLASS_CELL_DECORATOR = "de.hybris.platform.util.CSVCellDecorator" - @JvmField val FLEXIBLE_SEARCH_KEYWORDS = hashSetOf("SELECT", "FROM", "WHERE", "ORDER", "LEFT", "JOIN", "ON", "BY", "ASC", "DESC") - @JvmField val RESERVED_TYPE_CODES_FILE = FileUtilRt.toSystemDependentName("resources/core/unittest/reservedTypecodes.txt") - @JvmField val HYBRIS_SERVER_SHELL_SCRIPT_NAME = FileUtilRt.toSystemDependentName("bin/platform/hybrisserver.sh") - - @JvmField val PLATFORM_MODULE = FileUtilRt.toSystemDependentName("hybris/bin/platform") - @JvmField val PLATFORM_MODULE_PREFIX = FileUtilRt.toSystemDependentName("/bin/platform/") - @JvmField val PLATFORM_EXT_MODULE_PREFIX = FileUtilRt.toSystemDependentName("bin/platform/ext/") - @JvmField val PLATFORM_OOTB_MODULE_PREFIX = FileUtilRt.toSystemDependentName("bin/ext-") - @JvmField val PLATFORM_OOTB_MODULE_PREFIX_2019 = FileUtilRt.toSystemDependentName("bin/modules/") - @JvmField val PLATFORM_DB_DRIVER = FileUtilRt.toSystemDependentName("lib/dbdriver") - - @JvmField val HYBRIS_OOTB_MODULE_PREFIX = FileUtilRt.toSystemDependentName("hybris/") + PLATFORM_OOTB_MODULE_PREFIX - @JvmField val HYBRIS_OOTB_MODULE_PREFIX_2019 = FileUtilRt.toSystemDependentName("hybris/") + PLATFORM_OOTB_MODULE_PREFIX_2019 - - @JvmField val EXCLUDE_TMP_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tmp") - @JvmField val EXCLUDE_TCSERVER_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tcServer") - @JvmField val EXCLUDE_TOMCAT_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tomcat") - @JvmField val EXCLUDE_TOMCAT_6_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tomcat-6") - @JvmField val EXCLUDE_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/lib") - @JvmField val EXCLUDE_RESOURCES_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/resources") - @JvmField val EXCLUDE_ECLIPSEBIN_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/eclipsebin") - - @JvmField val EXCLUDE_BOOTSTRAP_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/bootstrap") - @JvmField val EXCLUDE_ANT_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/apache-ant-") - @JvmField val EXCLUDE_IDEA_MODULE_FILES_DIRECTORY = FileUtilRt.toSystemDependentName("/idea-module-files") - @JvmField val EXCLUDE_LOG_DIRECTORY = FileUtilRt.toSystemDependentName("/log") - @JvmField val EXCLUDE_DATA_DIRECTORY = FileUtilRt.toSystemDependentName("/data") - @JvmField val EXCLUDE_SVN_DIRECTORY = FileUtilRt.toSystemDependentName("/.svn") - @JvmField val EXCLUDE_GIT_DIRECTORY = FileUtilRt.toSystemDependentName("/.git") - @JvmField val EXCLUDE_TEMP_DIRECTORY = FileUtilRt.toSystemDependentName("/temp") - @JvmField val EXCLUDE_IDEA_DIRECTORY = FileUtilRt.toSystemDependentName("/.idea") - @JvmField val EXCLUDE_MACOSX_DIRECTORY = FileUtilRt.toSystemDependentName("/__MACOSX") - - @JvmField val CUSTOM_MODULES_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("bin/custom") - @JvmField val CONFIG_RELATIVE_PATH = FileUtilRt.toSystemDependentName("/../../$EXTENSION_NAME_CONFIG") - @JvmField val ADVANCED_PROPERTIES = FileUtilRt.toSystemDependentName("$RESOURCES_DIRECTORY/advanced.properties") - @JvmField val BUILD_NUMBER_FILE_PATH = FileUtilRt.toSystemDependentName("/bin/platform/build.number") - - @JvmField val WEB_ROOT_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/$WEB_ROOT_DIRECTORY") - @JvmField val WEB_INF_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_ROOT_DIRECTORY_RELATIVE_PATH/$WEB_INF_DIRECTORY") - @JvmField val WEB_XML_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_INF_DIRECTORY_RELATIVE_PATH/$WEB_XML_FILE_NAME") - @JvmField val WEB_INF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("webroot/WEB-INF/lib") - @JvmField val WEB_INF_CLASSES_DIRECTORY = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/webroot/WEB-INF/classes") - @JvmField val WEB_SRC_DIRECTORY = FileUtilRt.toSystemDependentName("web/src") - @JvmField val WEB_WEBINF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/$WEB_INF_LIB_DIRECTORY") - - @JvmField val COMMONWEB_WEBINF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("$COMMON_WEB_MODULE_DIRECTORY/$WEB_INF_LIB_DIRECTORY") - @JvmField val HMC_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("hmc/$BIN_DIRECTORY") - @JvmField val DOC_SOURCES_JAR_DIRECTORY = FileUtilRt.toSystemDependentName("doc/sources") - - @JvmField val PL_BOOTSTRAP_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("bootstrap/$BIN_DIRECTORY") - @JvmField val PL_BOOTSTRAP_GEN_SRC_DIRECTORY = FileUtilRt.toSystemDependentName("bootstrap/$GEN_SRC_DIRECTORY") - @JvmField val PL_TOMCAT_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat/lib") - @JvmField val PL_TOMCAT_BIN_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat/$BIN_DIRECTORY") - @JvmField val PL_TOMCAT_6_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat-6/lib") - @JvmField val PL_TOMCAT_6_BIN_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat-6/$BIN_DIRECTORY") - @JvmField val JAVA_COMPILER_OUTPUT_PATH = FileUtilRt.toSystemDependentName("/classes") - - @JvmField val HAC_WEB_INF_CLASSES = FileUtilRt.toSystemDependentName("/bin/platform/ext/hac/web/webroot/WEB-INF/classes") - - @JvmField val BACKOFFICE_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("backoffice/$BIN_DIRECTORY") - @JvmField val BACKOFFICE_JAR_DIRECTORY = FileUtilRt.toSystemDependentName("resources/backoffice") - @JvmField val BACKOFFICE_WEB_INF_LIB = FileUtilRt.toSystemDependentName("/bin/ext-backoffice/backoffice/web/webroot/WEB-INF/lib") - @JvmField val BACKOFFICE_WEB_INF_LIB_2019 = FileUtilRt.toSystemDependentName("/bin/modules/backoffice-framework/backoffice/web/webroot/WEB-INF/lib") - @JvmField val BACKOFFICE_WEB_INF_CLASSES = FileUtilRt.toSystemDependentName("/bin/ext-backoffice/backoffice/web/webroot/WEB-INF/classes") - @JvmField val BACKOFFICE_WEB_INF_CLASSES_2019 = FileUtilRt.toSystemDependentName("/bin/modules/backoffice-framework/backoffice/web/webroot/WEB-INF/classes") - - @JvmField val QUERY_STORAGE_FOLDER_PATH = EXCLUDE_IDEA_DIRECTORY + File.separator + "consolestorage" - @JvmField val SRC_DIR_NAMES = listOf(SRC_DIRECTORY, SCALA_SRC_DIRECTORY) - @JvmField val TEST_SRC_DIR_NAMES = listOf(TEST_SRC_DIRECTORY, GROOVY_TEST_SRC_DIRECTORY, SCALA_TEST_SRC_DIRECTORY) - - @JvmField val LOCAL_GROUP_OVERRIDE_COMMENTS = """ + @JvmField + val FLEXIBLE_SEARCH_KEYWORDS = hashSetOf("SELECT", "FROM", "WHERE", "ORDER", "LEFT", "JOIN", "ON", "BY", "ASC", "DESC") + @JvmField + val RESERVED_TYPE_CODES_FILE = FileUtilRt.toSystemDependentName("resources/core/unittest/reservedTypecodes.txt") + @JvmField + val HYBRIS_SERVER_SHELL_SCRIPT_NAME = FileUtilRt.toSystemDependentName("bin/platform/hybrisserver.sh") + + @JvmField + val PLATFORM_MODULE = FileUtilRt.toSystemDependentName("hybris/bin/platform") + @JvmField + val PLATFORM_MODULE_PREFIX = FileUtilRt.toSystemDependentName("/bin/platform/") + @JvmField + val PLATFORM_EXT_MODULE_PREFIX = FileUtilRt.toSystemDependentName("bin/platform/ext/") + @JvmField + val PLATFORM_OOTB_MODULE_PREFIX = FileUtilRt.toSystemDependentName("bin/ext-") + @JvmField + val PLATFORM_OOTB_MODULE_PREFIX_2019 = FileUtilRt.toSystemDependentName("bin/modules/") + @JvmField + val PLATFORM_DB_DRIVER = FileUtilRt.toSystemDependentName("lib/dbdriver") + + @JvmField + val HYBRIS_OOTB_MODULE_PREFIX = FileUtilRt.toSystemDependentName("hybris/") + PLATFORM_OOTB_MODULE_PREFIX + @JvmField + val HYBRIS_OOTB_MODULE_PREFIX_2019 = FileUtilRt.toSystemDependentName("hybris/") + PLATFORM_OOTB_MODULE_PREFIX_2019 + + @JvmField + val EXCLUDE_TMP_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tmp") + @JvmField + val EXCLUDE_TCSERVER_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tcServer") + @JvmField + val EXCLUDE_TOMCAT_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tomcat") + @JvmField + val EXCLUDE_TOMCAT_6_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/tomcat-6") + @JvmField + val EXCLUDE_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/lib") + @JvmField + val EXCLUDE_RESOURCES_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/resources") + @JvmField + val EXCLUDE_ECLIPSEBIN_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/eclipsebin") + + @JvmField + val EXCLUDE_BOOTSTRAP_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/bootstrap") + @JvmField + val EXCLUDE_ANT_DIRECTORY = FileUtilRt.toSystemDependentName("/platform/apache-ant-") + @JvmField + val EXCLUDE_IDEA_MODULE_FILES_DIRECTORY = FileUtilRt.toSystemDependentName("/idea-module-files") + @JvmField + val EXCLUDE_LOG_DIRECTORY = FileUtilRt.toSystemDependentName("/log") + @JvmField + val EXCLUDE_DATA_DIRECTORY = FileUtilRt.toSystemDependentName("/data") + @JvmField + val EXCLUDE_SVN_DIRECTORY = FileUtilRt.toSystemDependentName("/.svn") + @JvmField + val EXCLUDE_GIT_DIRECTORY = FileUtilRt.toSystemDependentName("/.git") + @JvmField + val EXCLUDE_TEMP_DIRECTORY = FileUtilRt.toSystemDependentName("/temp") + @JvmField + val EXCLUDE_IDEA_DIRECTORY = FileUtilRt.toSystemDependentName("/.idea") + @JvmField + val EXCLUDE_MACOSX_DIRECTORY = FileUtilRt.toSystemDependentName("/__MACOSX") + + @JvmField + val CUSTOM_MODULES_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("bin/custom") + @JvmField + val CONFIG_RELATIVE_PATH = FileUtilRt.toSystemDependentName("/../../$EXTENSION_NAME_CONFIG") + @JvmField + val ADVANCED_PROPERTIES = FileUtilRt.toSystemDependentName("$RESOURCES_DIRECTORY/advanced.properties") + @JvmField + val BUILD_NUMBER_FILE_PATH = FileUtilRt.toSystemDependentName("/bin/platform/build.number") + + @JvmField + val WEB_ROOT_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/$WEB_ROOT_DIRECTORY") + @JvmField + val WEB_INF_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_ROOT_DIRECTORY_RELATIVE_PATH/$WEB_INF_DIRECTORY") + @JvmField + val WEB_XML_DIRECTORY_RELATIVE_PATH = FileUtilRt.toSystemDependentName("$WEB_INF_DIRECTORY_RELATIVE_PATH/$WEB_XML_FILE_NAME") + @JvmField + val WEB_INF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("webroot/WEB-INF/lib") + @JvmField + val WEB_INF_CLASSES_DIRECTORY = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/webroot/WEB-INF/classes") + @JvmField + val WEB_SRC_DIRECTORY = FileUtilRt.toSystemDependentName("web/src") + @JvmField + val WEB_WEBINF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("$WEB_MODULE_DIRECTORY/$WEB_INF_LIB_DIRECTORY") + + @JvmField + val COMMONWEB_WEBINF_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("$COMMON_WEB_MODULE_DIRECTORY/$WEB_INF_LIB_DIRECTORY") + @JvmField + val HMC_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("hmc/$BIN_DIRECTORY") + @JvmField + val DOC_SOURCES_JAR_DIRECTORY = FileUtilRt.toSystemDependentName("doc/sources") + + @JvmField + val PL_BOOTSTRAP_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("bootstrap/$BIN_DIRECTORY") + @JvmField + val PL_BOOTSTRAP_GEN_SRC_DIRECTORY = FileUtilRt.toSystemDependentName("bootstrap/$GEN_SRC_DIRECTORY") + @JvmField + val PL_TOMCAT_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat/lib") + @JvmField + val PL_TOMCAT_BIN_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat/$BIN_DIRECTORY") + @JvmField + val PL_TOMCAT_6_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat-6/lib") + @JvmField + val PL_TOMCAT_6_BIN_DIRECTORY = FileUtilRt.toSystemDependentName("tomcat-6/$BIN_DIRECTORY") + @JvmField + val JAVA_COMPILER_OUTPUT_PATH = FileUtilRt.toSystemDependentName("/classes") + + @JvmField + val HAC_WEB_INF_CLASSES = FileUtilRt.toSystemDependentName("/bin/platform/ext/hac/web/webroot/WEB-INF/classes") + + @JvmField + val BACKOFFICE_LIB_DIRECTORY = FileUtilRt.toSystemDependentName("backoffice/$BIN_DIRECTORY") + @JvmField + val BACKOFFICE_JAR_DIRECTORY = FileUtilRt.toSystemDependentName("resources/backoffice") + @JvmField + val BACKOFFICE_WEB_INF_LIB = FileUtilRt.toSystemDependentName("/bin/ext-backoffice/backoffice/web/webroot/WEB-INF/lib") + @JvmField + val BACKOFFICE_WEB_INF_LIB_2019 = FileUtilRt.toSystemDependentName("/bin/modules/backoffice-framework/backoffice/web/webroot/WEB-INF/lib") + @JvmField + val BACKOFFICE_WEB_INF_CLASSES = FileUtilRt.toSystemDependentName("/bin/ext-backoffice/backoffice/web/webroot/WEB-INF/classes") + @JvmField + val BACKOFFICE_WEB_INF_CLASSES_2019 = FileUtilRt.toSystemDependentName("/bin/modules/backoffice-framework/backoffice/web/webroot/WEB-INF/classes") + + @JvmField + val QUERY_STORAGE_FOLDER_PATH = EXCLUDE_IDEA_DIRECTORY + File.separator + "consolestorage" + @JvmField + val SRC_DIR_NAMES = listOf(SRC_DIRECTORY, SCALA_SRC_DIRECTORY) + @JvmField + val TEST_SRC_DIR_NAMES = listOf(TEST_SRC_DIRECTORY, GROOVY_TEST_SRC_DIRECTORY, SCALA_TEST_SRC_DIRECTORY) + + @JvmField + val LOCAL_GROUP_OVERRIDE_COMMENTS = """ In this file you can override default module grouping and add additional ant parameters. Add a property group.override and value group name. If you use subgroups use / as a separator. For example group.override=mygroup/mysubgroup """.trimIndent() - @JvmField val GLOBAL_GROUP_OVERRIDE_COMMENTS = """ + @JvmField + val GLOBAL_GROUP_OVERRIDE_COMMENTS = """ In this file you can override default module group for your extensions. Add a property .group.override and group name as a value. If you use subgroups use / as a separator. For example myextension.group.override=mygroup/mysubgroup. @@ -345,86 +425,89 @@ object HybrisConstants { Use ANT_OPTS to override ant properties. Current default value is ANT_OPTS=-Xmx512m -Dfile.encoding=UTF-8 """.trimIndent() - @JvmField val DICTIONARY_WORDS = setOf( - "argumenttype", - "atomictype", - "autocreate", - "backoffice", - "beanutils", - "builddate", - "cockpitng", - "collectiontype", - "columntype", - "creationmode", - "cronjobs", - "defaultvalue", - "dontoptimize", - "elementtype", - "extname", - "hybris", - "impex", - "itemtype", - "jalo", - "jaloclass", - "jaloonly", - "jalosession", - "jspc", - "jstl", - "maptypes", - "metatype", - "metatype", - "nimda", - "NOPMD", - "partof", - "pojos", - "positiveshort", - "postgresql", - "propertytable", - "releasedate", - "returntype", - "servicelayer", - "solr", - "solrconfig", - "sqlserver", - "taglibs", - "typecode", - "typegroup", - "typesystem", - "webroot", - "ybackoffice", - "ybootstrap" + @JvmField + val DICTIONARY_WORDS = setOf( + "argumenttype", + "atomictype", + "autocreate", + "backoffice", + "beanutils", + "builddate", + "cockpitng", + "collectiontype", + "columntype", + "creationmode", + "cronjobs", + "defaultvalue", + "dontoptimize", + "elementtype", + "extname", + "hybris", + "impex", + "itemtype", + "jalo", + "jaloclass", + "jaloonly", + "jalosession", + "jspc", + "jstl", + "maptypes", + "metatype", + "metatype", + "nimda", + "NOPMD", + "partof", + "pojos", + "positiveshort", + "postgresql", + "propertytable", + "releasedate", + "returntype", + "servicelayer", + "solr", + "solrconfig", + "sqlserver", + "taglibs", + "typecode", + "typegroup", + "typesystem", + "webroot", + "ybackoffice", + "ybootstrap" ) // See ideaIU-LATEST-EAP-SNAPSHOT/lib/resources_en.jar!/messages/ActionsBundle.properties // See ideaIU-LATEST-EAP-SNAPSHOT/lib/resources_en.jar!/messages/EditorBundle.properties - @JvmField val UNDO_REDO_EDITOR_ACTIONS = arrayOf("Undo", "Redo") + @JvmField + val UNDO_REDO_EDITOR_ACTIONS = arrayOf("Undo", "Redo") // See ideaIU-LATEST-EAP-SNAPSHOT/lib/resources_en.jar!/messages/ActionsBundle.properties // See ideaIU-LATEST-EAP-SNAPSHOT/lib/resources_en.jar!/messages/EditorBundle.properties - @JvmField val TYPING_EDITOR_ACTIONS = arrayOf( - "Typing", - "Delete to Word Start", - "Delete to Word End", - "Duplicate Line or Selection", - "Duplicate Entire Lines", - "Backspace", - "Delete", - "Delete Line", - "Cut", - "Paste", - "Paste _without Formatting", - "Paste without formatting, autoimport, literal escaping etc.", - "Paste from X clipboard", - "Hungry Backspace", - "Acts as the Backspace except that removes all whitespace symbols before the caret (if any)", - "Move Line Up", - "Move Line Down", - "Move Statement Up", - "Move Statement Down", - "Move Element Left", - "Move Element Right", - "Reformat Code", - "Undo Reformat Code", - "Auto-Indent Lines" + @JvmField + val TYPING_EDITOR_ACTIONS = arrayOf( + "Typing", + "Delete to Word Start", + "Delete to Word End", + "Duplicate Line or Selection", + "Duplicate Entire Lines", + "Backspace", + "Delete", + "Delete Line", + "Cut", + "Paste", + "Paste _without Formatting", + "Paste without formatting, autoimport, literal escaping etc.", + "Paste from X clipboard", + "Hungry Backspace", + "Acts as the Backspace except that removes all whitespace symbols before the caret (if any)", + "Move Line Up", + "Move Line Down", + "Move Statement Up", + "Move Statement Down", + "Move Element Left", + "Move Element Right", + "Reformat Code", + "Undo Reformat Code", + "Auto-Indent Lines" ) } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java b/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java index 572166f65..a5c0c829f 100644 --- a/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java +++ b/src/com/intellij/idea/plugin/hybris/common/services/CommonIdeaService.java @@ -71,4 +71,6 @@ static CommonIdeaService getInstance() { @NotNull String getActiveSslProtocol(@NotNull Project project, @Nullable HybrisRemoteConnectionSettings settings); + + void refreshProjectSettings(Project project); } diff --git a/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt b/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt index 1f2c5894b..89b62d328 100644 --- a/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt +++ b/src/com/intellij/idea/plugin/hybris/common/services/impl/DefaultCommonIdeaService.kt @@ -70,7 +70,7 @@ class DefaultCommonIdeaService : CommonIdeaService { } override fun isHybrisProject(project: Project): Boolean { - return HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + return HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() } override fun isOutDatedHybrisProject(project: Project): Boolean { @@ -191,6 +191,10 @@ class DefaultCommonIdeaService : CommonIdeaService { } } + override fun refreshProjectSettings(project: Project) { + HybrisProjectSettingsComponent.getInstance(project).registerCloudExtensions() + } + private fun prepareSslRemoteConnectionSettings(connectionSettings: HybrisRemoteConnectionSettings) { connectionSettings.isSsl = StringUtils.startsWith(connectionSettings.generatedURL, HybrisConstants.HTTPS_PROTOCOL) cleanUpRemoteConnectionSettingsHostIp(connectionSettings) diff --git a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java index c09b18ad4..cc5ffed11 100644 --- a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java +++ b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java @@ -56,6 +56,12 @@ private HybrisIcons() { public static final Icon HYBRIS_REMOTE = getIcon("/icons/hybrisRemoteIcon.svg"); public static final Icon MONITORING = getIcon("/icons/monitoring.svg"); + public static final Icon EXTENSION_CLOUD = getIcon("/icons/extension-cloud.svg"); + public static final Icon EXTENSION_PLATFORM = getIcon("/icons/hybrisIcon.svg"); + public static final Icon EXTENSION_CUSTOM = getIcon("/icons/extension-custom.svg"); + public static final Icon EXTENSION_EXT = getIcon("/icons/hybrisIcon.svg"); + public static final Icon EXTENSION_OOTB = getIcon("/icons/hybrisIcon.svg"); + public static final Icon WAIT = getIcon("/icons/waitIcon.svg"); public static final Icon END = getIcon("/icons/endIcon.svg"); public static final Icon NOTIFY = getIcon("/icons/notifyIcon.svg"); diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java index 3a08140a0..74b0d8347 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultGradleConfigurator.java @@ -22,8 +22,8 @@ import com.intellij.idea.plugin.hybris.project.descriptors.GradleModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor; -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettings; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; +import com.intellij.idea.plugin.hybris.settings.ModuleSettings; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataImportListener; import com.intellij.openapi.module.Module; @@ -81,8 +81,8 @@ private void updateModuleSettings( } final var modifiableModuleModel = ModuleManager.getInstance(project).getModifiableModel(); - final HybrisProjectSettings.ModuleSettings moduleSettings = HybrisProjectSettingsComponent.getInstance(project) - .getModuleSettings(gradleModule); + final ModuleSettings moduleSettings = HybrisProjectSettingsComponent.getInstance(project) + .getModuleSettings(gradleModule); moduleSettings.setDescriptorType(HybrisModuleDescriptorType.GRADLE.name()); ApplicationManager.getApplication().runWriteAction(modifiableModuleModel::commit); diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java index 2f683a5d7..a34b69377 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultMavenConfigurator.java @@ -233,7 +233,7 @@ private static ModifiableModuleModel getModifiableModuleModel( final var settingsComponent = HybrisProjectSettingsComponent.getInstance(project); mavenModules.stream() - .filter(it -> it instanceof ModuleEx) + .filter(ModuleEx.class::isInstance) .map(ModuleEx.class::cast) .map(settingsComponent::getModuleSettings) .forEach(descriptor -> descriptor.setDescriptorType(HybrisModuleDescriptorType.MAVEN.name())); diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultModuleSettingsConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultModuleSettingsConfigurator.java index b06ee8805..c006d765f 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultModuleSettingsConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultModuleSettingsConfigurator.java @@ -21,7 +21,7 @@ import com.intellij.idea.plugin.hybris.project.configurators.ModuleSettingsConfigurator; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType; -import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettings.ModuleSettings; +import com.intellij.idea.plugin.hybris.settings.ModuleSettings; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; import com.intellij.openapi.module.Module; import org.jetbrains.annotations.NotNull; @@ -42,8 +42,8 @@ public void configure(@NotNull final HybrisModuleDescriptor moduleDescriptor, @N || descriptorType == HybrisModuleDescriptorType.EXT; final boolean readOnly = hasReadOnlySettings && isReadOnlyType; - final ModuleSettings moduleSettings = HybrisProjectSettingsComponent.getInstance(javaModule.getProject()) - .getModuleSettings(javaModule); + final var moduleSettings = HybrisProjectSettingsComponent.getInstance(javaModule.getProject()) + .getModuleSettings(javaModule); moduleSettings.setDescriptorType(descriptorType.name()); moduleSettings.setReadonly(readOnly); } diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java index 06496f574..d4de1977f 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/DefaultHybrisProjectDescriptor.java @@ -320,10 +320,8 @@ public void setProject(@Nullable final Project project) { if (hybrisProjectSettings == null) { return; } - if (hybrisProjectSettings.getState() != null) { - if (hybrisProjectSettings.getState().isHybrisProject()) { - setHybrisProject(project); - } + if (hybrisProjectSettings.isHybrisProject()) { + setHybrisProject(project); } } diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptor.java index 920614676..d8529c56a 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptor.java @@ -18,6 +18,7 @@ package com.intellij.idea.plugin.hybris.project.descriptors; +import com.intellij.idea.plugin.hybris.settings.ExtensionDescriptor; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent; import com.intellij.openapi.module.Module; import org.jetbrains.annotations.NotNull; @@ -100,4 +101,13 @@ static HybrisModuleDescriptorType getDescriptorType(@NotNull final Module module void setImportStatus(IMPORT_STATUS importStatus); IMPORT_STATUS getImportStatus(); + + @NotNull default ExtensionDescriptor getExtensionDescriptor() { + return new ExtensionDescriptor( + getName(), + getDescriptorType(), + false, false, false, false, + null, null + ); + } } diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java index e950d9085..42c5ca601 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/HybrisModuleDescriptorType.java @@ -22,5 +22,5 @@ * @author Eugene.Kudelevsky */ public enum HybrisModuleDescriptorType { - CONFIG, CUSTOM, EXT, NONE, OOTB, PLATFORM, ECLIPSE, MAVEN, GRADLE + CONFIG, CUSTOM, EXT, NONE, OOTB, PLATFORM, ECLIPSE, MAVEN, GRADLE, CCV2 } diff --git a/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java b/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java index 7f65c7a46..7f11f9f10 100644 --- a/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java +++ b/src/com/intellij/idea/plugin/hybris/project/descriptors/RegularHybrisModuleDescriptor.java @@ -22,9 +22,12 @@ import com.intellij.idea.plugin.hybris.common.HybrisConstants; import com.intellij.idea.plugin.hybris.common.LibraryDescriptorType; import com.intellij.idea.plugin.hybris.common.services.CommonIdeaService; +import com.intellij.idea.plugin.hybris.common.utils.CollectionUtils; import com.intellij.idea.plugin.hybris.project.exceptions.HybrisConfigurationException; import com.intellij.idea.plugin.hybris.project.settings.jaxb.extensioninfo.ExtensionInfo; +import com.intellij.idea.plugin.hybris.project.settings.jaxb.extensioninfo.MetaType; import com.intellij.idea.plugin.hybris.project.settings.jaxb.extensioninfo.RequiresExtensionType; +import com.intellij.idea.plugin.hybris.settings.ExtensionDescriptor; import com.intellij.openapi.diagnostic.Logger; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.NotNull; @@ -36,16 +39,21 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.BACKOFFICE_MODULE_DIRECTORY; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_BACKOFFICE_MODULE; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_CLASSPATHGEN; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_DEPRECATED; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_EXT_GEN; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_HAC_MODULE; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.EXTENSION_META_KEY_MODULE_GEN; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.HAC_WEB_INF_CLASSES; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.HMC_MODULE_DIRECTORY; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.HYBRIS_PLATFORM_CODE_SERVER_JAR_SUFFIX; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.WEB_INF_CLASSES_DIRECTORY; -import static com.intellij.idea.plugin.hybris.common.utils.CollectionUtils.emptyListIfNull; import static com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType.CUSTOM; import static org.apache.commons.collections4.CollectionUtils.isEmpty; @@ -56,12 +64,11 @@ */ public abstract class RegularHybrisModuleDescriptor extends AbstractHybrisModuleDescriptor { - private static final Logger LOG = Logger.getInstance(RegularHybrisModuleDescriptor.class); - @NotNull protected final ExtensionInfo extensionInfo; + private final Map metas; - public RegularHybrisModuleDescriptor( + protected RegularHybrisModuleDescriptor( @NotNull final File moduleRootDirectory, @NotNull final HybrisProjectDescriptor rootProjectDescriptor, @NotNull final ExtensionInfo extensionInfo @@ -69,6 +76,8 @@ public RegularHybrisModuleDescriptor( super(moduleRootDirectory, rootProjectDescriptor, extensionInfo.getExtension().getName()); this.extensionInfo = extensionInfo; + this.metas = CollectionUtils.emptyListIfNull(extensionInfo.getExtension().getMeta()).stream() + .collect(Collectors.toMap(MetaType::getKey, MetaType::getValue)); } @Nullable @@ -97,7 +106,7 @@ public Set getRequiredExtensionNames() { return getDefaultRequiredExtensionNames(); } - final Set requiredExtensionNames = new HashSet(requiresExtensions.size()); + final Set requiredExtensionNames = new HashSet<>(requiresExtensions.size()); requiredExtensionNames.addAll(requiresExtensions.stream() .map(RequiresExtensionType::getName) @@ -129,11 +138,11 @@ public boolean hasBackofficeModule() { } protected boolean isMetaKeySetToTrue(@NotNull final String metaKeyName) { - Validate.notEmpty(metaKeyName); + final var value = metas.get(metaKeyName); - return emptyListIfNull(this.extensionInfo.getExtension().getMeta()).stream().anyMatch( - meta -> metaKeyName.equalsIgnoreCase(meta.getKey()) && Boolean.TRUE.toString().equals(meta.getValue()) - ); + if (value == null) return false; + + return Boolean.TRUE.toString().equals(value); } protected boolean doesBackofficeDirectoryExist() { @@ -311,6 +320,19 @@ public boolean isPreselected() { return isInLocalExtensions(); } + @Override + public @NotNull ExtensionDescriptor getExtensionDescriptor() { + return new ExtensionDescriptor( + getName(), + getDescriptorType(), + isMetaKeySetToTrue(EXTENSION_META_KEY_BACKOFFICE_MODULE), + isMetaKeySetToTrue(EXTENSION_META_KEY_HAC_MODULE), + isMetaKeySetToTrue(EXTENSION_META_KEY_DEPRECATED), + isMetaKeySetToTrue(EXTENSION_META_KEY_EXT_GEN), + metas.get(EXTENSION_META_KEY_CLASSPATHGEN), + metas.get(EXTENSION_META_KEY_MODULE_GEN) + ); + } protected Set getDefaultRequiredExtensionNames() { return Collections.unmodifiableSet(Sets.newHashSet(HybrisConstants.EXTENSION_NAME_PLATFORM)); diff --git a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java index f0fb03337..a478c1f01 100644 --- a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java +++ b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java @@ -41,15 +41,12 @@ import com.intellij.idea.plugin.hybris.project.configurators.SpringConfigurator; import com.intellij.idea.plugin.hybris.project.configurators.VersionControlSystemConfigurator; import com.intellij.idea.plugin.hybris.project.descriptors.ConfigHybrisModuleDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.CustomHybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.EclipseModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.GradleModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.HybrisProjectDescriptor; import com.intellij.idea.plugin.hybris.project.descriptors.MavenModuleDescriptor; -import com.intellij.idea.plugin.hybris.project.descriptors.OotbHybrisModuleDescriptor; import com.intellij.idea.plugin.hybris.project.utils.ModuleGroupUtils; -import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings; import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent; import com.intellij.idea.plugin.hybris.settings.HybrisDeveloperSpecificProjectSettingsListener; import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettings; @@ -98,12 +95,10 @@ import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.function.Predicate; import java.util.stream.Collectors; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.DICTIONARY_NAME; @@ -428,9 +423,9 @@ private void saveCustomDirectoryLocation(final Project project) { } private void saveImportedSettings(final Project project) { - final HybrisProjectSettings hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project) - .getState(); - final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); + final var hybrisSettingsComponent = HybrisProjectSettingsComponent.getInstance(project); + final var hybrisProjectSettings = hybrisSettingsComponent.getState(); + final var appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); hybrisProjectSettings.setImportOotbModulesInReadOnlyMode(hybrisProjectDescriptor.isImportOotbModulesInReadOnlyMode()); final File extDir = hybrisProjectDescriptor.getExternalExtensionsDirectory(); if (extDir != null && extDir.isDirectory()) { @@ -478,14 +473,17 @@ private void saveImportedSettings(final Project project) { hybrisProjectSettings.setModulesOnBlackList(createModulesOnBlackList()); hybrisProjectSettings.setHybrisVersion(hybrisProjectDescriptor.getHybrisVersion()); hybrisProjectSettings.setJavadocUrl(hybrisProjectDescriptor.getJavadocUrl()); - final Set completeSetOfHybrisModules = new HashSet<>(); - hybrisProjectDescriptor.getFoundModules().stream() + final var completeSetOfHybrisModules = hybrisProjectDescriptor.getFoundModules().stream() .filter(e -> !(e instanceof MavenModuleDescriptor) && !(e instanceof EclipseModuleDescriptor) && !(e instanceof GradleModuleDescriptor) + && !(e instanceof ConfigHybrisModuleDescriptor) ) - .forEach(e -> completeSetOfHybrisModules.add(e.getName())); - hybrisProjectSettings.setCompleteSetOfAvailableExtensionsInHybris(completeSetOfHybrisModules); + .collect(Collectors.toSet()); + hybrisSettingsComponent.setAvailableExtensions(completeSetOfHybrisModules); + hybrisProjectSettings.setCompleteSetOfAvailableExtensionsInHybris(completeSetOfHybrisModules.stream() + .map(HybrisModuleDescriptor::getName) + .collect(Collectors.toSet())); hybrisProjectSettings.setExcludeTestSources(hybrisProjectDescriptor.isExcludeTestSources()); CommonIdeaService.getInstance().fixRemoteConnectionSettings(project); diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java index 93fb7ac3c..333dcbb3c 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/HybrisWorkspaceRootStep.java @@ -611,11 +611,11 @@ public void refresh(final HybrisProjectSettings settings) throws ConfigurationEx hybrisProjectDescriptor.setExternalExtensionsDirectory(toFile(settings.getExternalExtensionsDirectory(), true)); hybrisProjectDescriptor.setExternalConfigDirectory(toFile(settings.getExternalConfigDirectory(), true)); hybrisProjectDescriptor.setExternalDbDriversDirectory(toFile(settings.getExternalDbDriversDirectory(), true)); - hybrisProjectDescriptor.setCreateBackwardCyclicDependenciesForAddOns(settings.isCreateBackwardCyclicDependenciesForAddOns()); - hybrisProjectDescriptor.setImportOotbModulesInReadOnlyMode(settings.isImportOotbModulesInReadOnlyMode()); - hybrisProjectDescriptor.setFollowSymlink(settings.isFollowSymlink()); - hybrisProjectDescriptor.setExcludeTestSources(settings.isExcludeTestSources()); - hybrisProjectDescriptor.setScanThroughExternalModule(settings.isScanThroughExternalModule()); + hybrisProjectDescriptor.setCreateBackwardCyclicDependenciesForAddOns(settings.getCreateBackwardCyclicDependenciesForAddOns()); + hybrisProjectDescriptor.setImportOotbModulesInReadOnlyMode(settings.getImportOotbModulesInReadOnlyMode()); + hybrisProjectDescriptor.setFollowSymlink(settings.getFollowSymlink()); + hybrisProjectDescriptor.setExcludeTestSources(settings.getExcludeTestSources()); + hybrisProjectDescriptor.setScanThroughExternalModule(settings.getScanThroughExternalModule()); final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState(); hybrisProjectDescriptor.setWithMavenSources(appSettings.isWithMavenSources()); diff --git a/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java b/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java index 90c0d150b..96642d003 100644 --- a/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java +++ b/src/com/intellij/idea/plugin/hybris/runConfigurations/HybrisJUnitExtension.java @@ -79,8 +79,7 @@ public boolean isApplicableFor(@NotNull final RunConfigurationBase configuration return false; } final Project project = configuration.getProject(); - final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState(); - return settings.isHybrisProject(); + return HybrisProjectSettingsComponent.getInstance(project).isHybrisProject(); } } diff --git a/src/com/intellij/idea/plugin/hybris/settings/ExtensionDescriptor.kt b/src/com/intellij/idea/plugin/hybris/settings/ExtensionDescriptor.kt new file mode 100644 index 000000000..0376aa510 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/settings/ExtensionDescriptor.kt @@ -0,0 +1,32 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.settings + +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType + +data class ExtensionDescriptor( + var name: String = "", + var type: HybrisModuleDescriptorType? = null, + var backofficeModule: Boolean = false, + var hacModule: Boolean = false, + var deprecated: Boolean = false, + var extGenTemplateExtension: Boolean = false, + var classPathGen: String? = null, + var moduleGenName: String? = null, +) \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectRemoteInstancesSettingsConfigurableProvider.kt b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectRemoteInstancesSettingsConfigurableProvider.kt index fbc5701bc..8b47fbbad 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectRemoteInstancesSettingsConfigurableProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectRemoteInstancesSettingsConfigurableProvider.kt @@ -27,7 +27,7 @@ import javax.swing.JComponent class HybrisProjectRemoteInstancesSettingsConfigurableProvider(val project: Project) : ConfigurableProvider() { - override fun canCreateConfigurable() = HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + override fun canCreateConfigurable() = HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() override fun createConfigurable() = HybrisProjectRemoteInstancesSettingsConfigurable(project) class HybrisProjectRemoteInstancesSettingsConfigurable(project: Project) : Configurable { diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.java deleted file mode 100644 index 198bba560..000000000 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.intellij.idea.plugin.hybris.settings; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -/** - * Created 6:51 PM 28 June 2015. - * - * @author Alexander Bartash - */ -public class HybrisProjectSettings { - - protected boolean hybrisProject; - protected String customDirectory; - protected String hybrisDirectory; - protected String configDirectory; - protected String importedByVersion; - protected String hybrisVersion; - protected String javadocUrl; - protected String sourceCodeFile; - protected String externalExtensionsDirectory; - protected String externalConfigDirectory; - protected String externalDbDriversDirectory; - protected String ideModulesFilesDirectory; - protected boolean importOotbModulesInReadOnlyMode; - protected boolean followSymlink; - protected boolean scanThroughExternalModule; - protected boolean createBackwardCyclicDependenciesForAddOns = false; - protected boolean excludeTestSources; - protected Set completeSetOfAvailableExtensionsInHybris = new HashSet<>(); - protected Set unusedExtensions = new HashSet<>(); - protected Set modulesOnBlackList = new HashSet<>(); - protected Map moduleSettings = new HashMap<>(); - - public boolean isHybrisProject() { - return hybrisProject; - } - - public void setHybrisProject(final boolean hybrisProject) { - this.hybrisProject = hybrisProject; - } - - public String getCustomDirectory() { - return customDirectory; - } - - public void setCustomDirectory(final String customDirectory) { - this.customDirectory = customDirectory; - } - - public String getConfigDirectory() { - return configDirectory; - } - - public void setConfigDirectory(final String configDirectory) { - this.configDirectory = configDirectory; - } - - public String getHybrisDirectory() { - return hybrisDirectory; - } - - public void setHybrisDirectory(final String hybrisDirectory) { - this.hybrisDirectory = hybrisDirectory; - } - - public String getImportedByVersion() { - return importedByVersion; - } - - public void setImportedByVersion(final String importedByVersion) { - this.importedByVersion = importedByVersion; - } - - public String getHybrisVersion() { - return hybrisVersion; - } - - public void setHybrisVersion(final String hybrisVersion) { - this.hybrisVersion = hybrisVersion; - } - - public String getJavadocUrl() { - return javadocUrl; - } - - public void setJavadocUrl(final String javadocUrl) { - this.javadocUrl = javadocUrl; - } - - public String getSourceCodeFile() { - return sourceCodeFile; - } - - public void setSourceCodeFile(final String sourceCodeFile) { - this.sourceCodeFile = sourceCodeFile; - } - - public String getExternalExtensionsDirectory() { - return externalExtensionsDirectory; - } - - public void setExternalExtensionsDirectory(final String externalExtensionsDirectory) { - this.externalExtensionsDirectory = externalExtensionsDirectory; - } - - public String getExternalConfigDirectory() { - return externalConfigDirectory; - } - - public void setExternalConfigDirectory(final String externalConfigDirectory) { - this.externalConfigDirectory = externalConfigDirectory; - } - - public String getExternalDbDriversDirectory() { - return externalDbDriversDirectory; - } - - public void setExternalDbDriversDirectory(final String externalDbDriversDirectory) { - this.externalDbDriversDirectory = externalDbDriversDirectory; - } - - public String getIdeModulesFilesDirectory() { - return ideModulesFilesDirectory; - } - - public void setIdeModulesFilesDirectory(final String ideModulesFilesDirectory) { - this.ideModulesFilesDirectory = ideModulesFilesDirectory; - } - - public boolean isImportOotbModulesInReadOnlyMode() { - return importOotbModulesInReadOnlyMode; - } - - public void setImportOotbModulesInReadOnlyMode(final boolean importOotbModulesInReadOnlyMode) { - this.importOotbModulesInReadOnlyMode = importOotbModulesInReadOnlyMode; - } - - public boolean isFollowSymlink() { - return followSymlink; - } - - public void setFollowSymlink(final boolean followSymlink) { - this.followSymlink = followSymlink; - } - - public boolean isScanThroughExternalModule() { - return scanThroughExternalModule; - } - - public void setScanThroughExternalModule(final boolean scanThroughExternalModule) { - this.scanThroughExternalModule = scanThroughExternalModule; - } - - public boolean isExcludeTestSources() { - return excludeTestSources; - } - - public void setExcludeTestSources(final boolean excludeTestSources) { - this.excludeTestSources = excludeTestSources; - } - - public Set getCompleteSetOfAvailableExtensionsInHybris() { - return completeSetOfAvailableExtensionsInHybris; - } - - public void setCompleteSetOfAvailableExtensionsInHybris(final Set completeSetOfAvailableExtensionsInHybris) { - this.completeSetOfAvailableExtensionsInHybris = completeSetOfAvailableExtensionsInHybris; - } - - public boolean isCreateBackwardCyclicDependenciesForAddOns() { - return createBackwardCyclicDependenciesForAddOns; - } - - public void setCreateBackwardCyclicDependenciesForAddOns(final boolean createBackwardCyclicDependenciesForAddOns) { - this.createBackwardCyclicDependenciesForAddOns = createBackwardCyclicDependenciesForAddOns; - } - - public Set getUnusedExtensions() { - return unusedExtensions; - } - - public void setUnusedExtensions(final Set unusedExtensions) { - this.unusedExtensions = unusedExtensions; - } - - public void setModulesOnBlackList(final Set modulesOnBlackList) { - this.modulesOnBlackList = modulesOnBlackList; - } - - public Set getModulesOnBlackList() { - return modulesOnBlackList; - } - - public Map getModuleSettings() { - return moduleSettings; - } - - public void setModuleSettings(final Map moduleSettings) { - this.moduleSettings = moduleSettings; - } - - @Override - public int hashCode() { - return new HashCodeBuilder(17, 37) - .append(hybrisProject) - .append(customDirectory) - .append(hybrisDirectory) - .append(configDirectory) - .append(importedByVersion) - .append(hybrisVersion) - .append(javadocUrl) - .append(sourceCodeFile) - .append(externalExtensionsDirectory) - .append(externalConfigDirectory) - .append(externalDbDriversDirectory) - .append(ideModulesFilesDirectory) - .append(importOotbModulesInReadOnlyMode) - .append(followSymlink) - .append(excludeTestSources) - .append(scanThroughExternalModule) - .append(completeSetOfAvailableExtensionsInHybris) - .append(createBackwardCyclicDependenciesForAddOns) - .append(unusedExtensions) - .append(moduleSettings) - .toHashCode(); - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (null == o || getClass() != o.getClass()) { - return false; - } - - final HybrisProjectSettings other = (HybrisProjectSettings) o; - - return new EqualsBuilder() - .append(hybrisProject, other.hybrisProject) - .append(customDirectory, other.customDirectory) - .append(hybrisDirectory, other.hybrisDirectory) - .append(configDirectory, other.configDirectory) - .append(importedByVersion, other.importedByVersion) - .append(hybrisVersion, other.hybrisVersion) - .append(javadocUrl, other.javadocUrl) - .append(sourceCodeFile, other.sourceCodeFile) - .append(externalExtensionsDirectory, other.externalExtensionsDirectory) - .append(externalConfigDirectory, other.externalConfigDirectory) - .append(externalDbDriversDirectory, other.externalDbDriversDirectory) - .append(ideModulesFilesDirectory, other.ideModulesFilesDirectory) - .append(importOotbModulesInReadOnlyMode, other.importOotbModulesInReadOnlyMode) - .append(followSymlink, other.followSymlink) - .append(excludeTestSources, other.excludeTestSources) - .append(scanThroughExternalModule, other.scanThroughExternalModule) - .append(completeSetOfAvailableExtensionsInHybris, other.completeSetOfAvailableExtensionsInHybris) - .append(createBackwardCyclicDependenciesForAddOns, other.createBackwardCyclicDependenciesForAddOns) - .append(unusedExtensions, other.unusedExtensions) - .append(moduleSettings, other.moduleSettings) - .isEquals(); - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("HybrisProjectSettings{"); - sb.append("hybrisProject=").append(hybrisProject); - sb.append("customDirectoryPath=").append(customDirectory); - sb.append("hybrisDirectory=").append(hybrisDirectory); - sb.append("configDirectory=").append(configDirectory); - sb.append("importedByVersion=").append(importedByVersion); - sb.append("hybrisVersion=").append(hybrisVersion); - sb.append("javadocUrl=").append(javadocUrl); - sb.append("sourceCodeFile=").append(sourceCodeFile); - sb.append("externalExtensionsDirectory=").append(externalExtensionsDirectory); - sb.append("externalConfigDirectory=").append(externalConfigDirectory); - sb.append("externalDbDriversDirectory=").append(externalDbDriversDirectory); - sb.append("ideModulesFilesDirectory=").append(ideModulesFilesDirectory); - sb.append("importOotbModulesInReadOnlyMode=").append(importOotbModulesInReadOnlyMode); - sb.append("followSymlink=").append(followSymlink); - sb.append("excludeTestSources=").append(excludeTestSources); - sb.append("scanThroughExternalModule=").append(scanThroughExternalModule); - sb.append("completeSetOfAvailableExtensionsInHybris=").append(completeSetOfAvailableExtensionsInHybris); - sb.append("createBackwardCyclicDependenciesForAddOns=").append(createBackwardCyclicDependenciesForAddOns); - sb.append("unusedExtensions=").append(unusedExtensions); - sb.append("moduleSettings=").append(moduleSettings); - sb.append('}'); - return sb.toString(); - } - - public static class ModuleSettings { - boolean readonly; - String descriptorType; - - public boolean isReadonly() { - return readonly; - } - - public void setReadonly(final boolean readonly) { - this.readonly = readonly; - } - - public String getDescriptorType() { - return descriptorType; - } - - public void setDescriptorType(final String descriptorType) { - this.descriptorType = descriptorType; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof final ModuleSettings other)) { - return false; - } - - if (readonly != other.readonly) { - return false; - } - return Objects.equals(descriptorType, other.descriptorType); - } - - @Override - public int hashCode() { - int result = (readonly ? 1 : 0); - result = 31 * result + (descriptorType != null ? descriptorType.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return new StringBuilder("ModuleSettings{") - .append("readonly=").append(readonly) - .append(", descriptorType='").append(descriptorType).append('\'') - .append('}') - .toString(); - } - } -} diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.kt b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.kt new file mode 100644 index 000000000..9e6c8e987 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettings.kt @@ -0,0 +1,50 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.intellij.idea.plugin.hybris.settings + +import java.util.* + +data class HybrisProjectSettings( + var customDirectory: String? = null, + var hybrisDirectory: String? = null, + var configDirectory: String? = null, + var importedByVersion: String? = null, + var hybrisVersion: String? = null, + var javadocUrl: String? = null, + var sourceCodeFile: String? = null, + var externalExtensionsDirectory: String? = null, + var externalConfigDirectory: String? = null, + var externalDbDriversDirectory: String? = null, + var ideModulesFilesDirectory: String? = null, + var hybrisProject: Boolean = false, + var importOotbModulesInReadOnlyMode: Boolean = false, + var followSymlink: Boolean = false, + var scanThroughExternalModule: Boolean = false, + var excludeTestSources: Boolean = false, + var createBackwardCyclicDependenciesForAddOns: Boolean = false, + var completeSetOfAvailableExtensionsInHybris: Set = mutableSetOf(), + var unusedExtensions: Set = mutableSetOf(), + var modulesOnBlackList: Set = mutableSetOf(), + var availableExtensions: MutableMap = TreeMap { a, b -> + a.compareTo(b, true) + }, + var moduleSettings: MutableMap = TreeMap { a, b -> + a.compareTo(b, true) + } +) \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java deleted file mode 100644 index 41196ee2f..000000000 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of "hybris integration" plugin for Intellij IDEA. - * Copyright (C) 2014-2016 Alexander Bartash - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.intellij.idea.plugin.hybris.settings; - -import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.openapi.components.State; -import com.intellij.openapi.components.Storage; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.util.xmlb.XmlSerializerUtil; -import org.jetbrains.annotations.NotNull; - -import static com.intellij.idea.plugin.hybris.common.HybrisConstants.STORAGE_HYBRIS_PROJECT_SETTINGS; - -/** - * Created 6:43 PM 28 June 2015. - * - * @author Alexander Bartash - */ -@State(name = "HybrisProjectSettings", storages = {@Storage(STORAGE_HYBRIS_PROJECT_SETTINGS)}) -public class HybrisProjectSettingsComponent implements PersistentStateComponent { - - private final HybrisProjectSettings hybrisProjectSettings = new HybrisProjectSettings(); - - public static HybrisProjectSettingsComponent getInstance(@NotNull final Project project) { - return project.getService(HybrisProjectSettingsComponent.class); - } - - @NotNull - @Override - public HybrisProjectSettings getState() { - return this.hybrisProjectSettings; - } - - public HybrisProjectSettings.ModuleSettings getModuleSettings(final Module module) { - return getModuleSettings(module.getName()); - } - - public HybrisProjectSettings.ModuleSettings getModuleSettings(final String moduleName) { - return getState().getModuleSettings() - .computeIfAbsent(moduleName, s -> new HybrisProjectSettings.ModuleSettings()); - } - - @Override - public void loadState(final HybrisProjectSettings state) { - XmlSerializerUtil.copyBean(state, this.hybrisProjectSettings); - } -} diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.kt b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.kt new file mode 100644 index 000000000..3fabe666f --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsComponent.kt @@ -0,0 +1,73 @@ +/* + * This file is part of "hybris integration" plugin for Intellij IDEA. + * Copyright (C) 2014-2016 Alexander Bartash + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.intellij.idea.plugin.hybris.settings + +import com.intellij.idea.plugin.hybris.common.HybrisConstants +import com.intellij.idea.plugin.hybris.common.HybrisConstants.STORAGE_HYBRIS_PROJECT_SETTINGS +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptor +import com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType +import com.intellij.openapi.components.PersistentStateComponent +import com.intellij.openapi.components.State +import com.intellij.openapi.components.Storage +import com.intellij.openapi.module.Module +import com.intellij.openapi.project.Project +import com.intellij.util.xmlb.XmlSerializerUtil + +@State(name = "HybrisProjectSettings", storages = [Storage(STORAGE_HYBRIS_PROJECT_SETTINGS)]) +class HybrisProjectSettingsComponent : PersistentStateComponent { + private val hybrisProjectSettings = HybrisProjectSettings() + + override fun getState() = hybrisProjectSettings + override fun loadState(state: HybrisProjectSettings) = XmlSerializerUtil.copyBean(state, hybrisProjectSettings) + + fun isHybrisProject() = state.hybrisProject + + fun getModuleSettings(module: Module): ModuleSettings = getModuleSettings(module.name) + fun getAvailableExtensions(): Map { + if (state.availableExtensions.isEmpty()) { + synchronized(hybrisProjectSettings) { + state.availableExtensions.clear() + + val availableExtensions = state.completeSetOfAvailableExtensionsInHybris + .map { Pair(it, ExtensionDescriptor(name = it)) } + state.availableExtensions.putAll(availableExtensions) + registerCloudExtensions() + } + } + return state.availableExtensions + } + + fun setAvailableExtensions(descriptors: Set) { + state.availableExtensions.clear() + descriptors + .map { it.extensionDescriptor } + .forEach { state.availableExtensions[it.name] = it } + registerCloudExtensions() + } + + fun registerCloudExtensions() = HybrisConstants.CCV2_COMMERCE_CLOUD_EXTENSIONS + .forEach { state.availableExtensions[it] = ExtensionDescriptor(it, HybrisModuleDescriptorType.CCV2) } + + private fun getModuleSettings(moduleName: String) = state.moduleSettings + .computeIfAbsent(moduleName) { _ -> ModuleSettings() } + + companion object { + @JvmStatic + fun getInstance(project: Project): HybrisProjectSettingsComponent = project.getService(HybrisProjectSettingsComponent::class.java) + } +} diff --git a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsConfigurableProvider.kt b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsConfigurableProvider.kt index f0016f637..f9d6579cc 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsConfigurableProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/settings/HybrisProjectSettingsConfigurableProvider.kt @@ -28,7 +28,7 @@ import javax.swing.JComponent class HybrisProjectSettingsConfigurableProvider(val project: Project) : ConfigurableProvider() { - override fun canCreateConfigurable() = HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + override fun canCreateConfigurable() = HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() override fun createConfigurable() = HybrisProjectSettingsConfigurable(project) class HybrisProjectSettingsConfigurable(private val project: Project) : Configurable { diff --git a/src/com/intellij/idea/plugin/hybris/settings/ModuleSettings.kt b/src/com/intellij/idea/plugin/hybris/settings/ModuleSettings.kt new file mode 100644 index 000000000..7d61921d8 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/settings/ModuleSettings.kt @@ -0,0 +1,23 @@ +/* + * This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. + * Copyright (C) 2019 EPAM Systems + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.intellij.idea.plugin.hybris.settings + +data class ModuleSettings( + var isReadonly: Boolean = false, + var descriptorType: String? = null +) \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/settings/forms/HybrisProjectSettingsForm.java b/src/com/intellij/idea/plugin/hybris/settings/forms/HybrisProjectSettingsForm.java index cd263aa13..fc2e1dfa0 100644 --- a/src/com/intellij/idea/plugin/hybris/settings/forms/HybrisProjectSettingsForm.java +++ b/src/com/intellij/idea/plugin/hybris/settings/forms/HybrisProjectSettingsForm.java @@ -102,11 +102,11 @@ public HybrisProjectSettingsForm setData(final Project project) { developerSettingsComponent.getSolrRemoteConnectionSettings() ); - createBackwardCyclicDependenciesForAddons.setSelected(projectSettings.isCreateBackwardCyclicDependenciesForAddOns()); - followSymlink.setSelected(projectSettings.isFollowSymlink()); - scanThroughExternalModule.setSelected(projectSettings.isScanThroughExternalModule()); - excludeTestSources.setSelected(projectSettings.isExcludeTestSources()); - importOotbModulesInReadOnlyMode.setSelected(projectSettings.isImportOotbModulesInReadOnlyMode()); + createBackwardCyclicDependenciesForAddons.setSelected(projectSettings.getCreateBackwardCyclicDependenciesForAddOns()); + followSymlink.setSelected(projectSettings.getFollowSymlink()); + scanThroughExternalModule.setSelected(projectSettings.getScanThroughExternalModule()); + excludeTestSources.setSelected(projectSettings.getExcludeTestSources()); + importOotbModulesInReadOnlyMode.setSelected(projectSettings.getImportOotbModulesInReadOnlyMode()); hybrisVersion.setText(projectSettings.getHybrisVersion()); javadocUrl.setText(projectSettings.getJavadocUrl()); hybrisDirectory.setText(projectSettings.getHybrisDirectory()); @@ -142,10 +142,10 @@ public boolean isModified(final Project project) { return false; } - return createBackwardCyclicDependenciesForAddons.isSelected() != projectSettings.isCreateBackwardCyclicDependenciesForAddOns() - || importOotbModulesInReadOnlyMode.isSelected() != projectSettings.isImportOotbModulesInReadOnlyMode() - || scanThroughExternalModule.isSelected() != projectSettings.isScanThroughExternalModule() - || followSymlink.isSelected() != projectSettings.isFollowSymlink() + return createBackwardCyclicDependenciesForAddons.isSelected() != projectSettings.getCreateBackwardCyclicDependenciesForAddOns() + || importOotbModulesInReadOnlyMode.isSelected() != projectSettings.getImportOotbModulesInReadOnlyMode() + || scanThroughExternalModule.isSelected() != projectSettings.getScanThroughExternalModule() + || followSymlink.isSelected() != projectSettings.getFollowSymlink() || !StringUtil.equals(hybrisVersion.getText(), projectSettings.getHybrisVersion()) || !StringUtil.equals(javadocUrl.getText(), projectSettings.getJavadocUrl()) || !StringUtil.equals(hybrisDirectory.getText(), projectSettings.getHybrisDirectory()) diff --git a/src/com/intellij/idea/plugin/hybris/startup/HybrisProjectStructureStartupActivity.kt b/src/com/intellij/idea/plugin/hybris/startup/HybrisProjectStructureStartupActivity.kt index 4b6a4853c..e369d975c 100644 --- a/src/com/intellij/idea/plugin/hybris/startup/HybrisProjectStructureStartupActivity.kt +++ b/src/com/intellij/idea/plugin/hybris/startup/HybrisProjectStructureStartupActivity.kt @@ -55,13 +55,15 @@ class HybrisProjectStructureStartupActivity : ProjectActivity { val isHybrisProject = commonIdeaService.isHybrisProject(project) if (isHybrisProject) { + commonIdeaService.refreshProjectSettings(project) + if (commonIdeaService.isOutDatedHybrisProject(project)) { Notifications.create( NotificationType.INFORMATION, HybrisI18NBundleUtils.message("hybris.notification.project.open.outdated.title"), HybrisI18NBundleUtils.message( "hybris.notification.project.open.outdated.text", - HybrisProjectSettingsComponent.getInstance(project).state.importedByVersion + HybrisProjectSettingsComponent.getInstance(project).state.importedByVersion ?: "old" ) ) .important(true) diff --git a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestCommerceJsonSchemaFileProvider.kt b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestCommerceJsonSchemaFileProvider.kt index d08175de4..c135f1ef0 100644 --- a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestCommerceJsonSchemaFileProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestCommerceJsonSchemaFileProvider.kt @@ -12,7 +12,7 @@ class ManifestCommerceJsonSchemaFileProvider(val project: Project) : JsonSchemaF override fun isAvailable(file: VirtualFile) = HybrisConstants.CCV2_MANIFEST_NAME == file.name && HybrisConstants.CCV2_CORE_CUSTOMIZE_NAME == file.parent.name - && HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + && HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() override fun getName() = "SAP Commerce Cloud Manifest" override fun getSchemaFile() = JsonSchemaProviderFactory.getResourceFile(javaClass, "/schemas/manifest-commerce.schema.json") diff --git a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestDataHubJsonSchemaFileProvider.kt b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestDataHubJsonSchemaFileProvider.kt index 80e3e6885..03545c479 100644 --- a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestDataHubJsonSchemaFileProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestDataHubJsonSchemaFileProvider.kt @@ -11,7 +11,7 @@ import com.jetbrains.jsonSchema.extension.SchemaType class ManifestDataHubJsonSchemaFileProvider(val project: Project) : JsonSchemaFileProvider { override fun isAvailable(file: VirtualFile) = HybrisConstants.CCV2_MANIFEST_NAME == file.name && HybrisConstants.CCV2_DATAHUB_NAME == file.parent.name - && HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + && HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() override fun getName() = "DataHub Manifest" override fun getSchemaFile() = JsonSchemaProviderFactory.getResourceFile(javaClass, "/schemas/manifest-datahub.schema.json") diff --git a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestJavascriptStorefrontJsonSchemaFileProvider.kt b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestJavascriptStorefrontJsonSchemaFileProvider.kt index ff951ea73..57eb674dc 100644 --- a/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestJavascriptStorefrontJsonSchemaFileProvider.kt +++ b/src/com/intellij/idea/plugin/hybris/system/manifest/jsonSchema/providers/ManifestJavascriptStorefrontJsonSchemaFileProvider.kt @@ -11,7 +11,7 @@ import com.jetbrains.jsonSchema.extension.SchemaType class ManifestJavascriptStorefrontJsonSchemaFileProvider(val project: Project) : JsonSchemaFileProvider { override fun isAvailable(file: VirtualFile) = HybrisConstants.CCV2_MANIFEST_NAME == file.name && HybrisConstants.CCV2_JS_STOREFRONT_NAME == file.parent.name - && HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + && HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() override fun getName() = "Javascript Storefront Manifest" override fun getSchemaFile() = JsonSchemaProviderFactory.getResourceFile(javaClass, "/schemas/manifest-js-storefront.schema.json") diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowFactory.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowFactory.kt index 299778a28..68b26d288 100644 --- a/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowFactory.kt +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/HybrisToolWindowFactory.kt @@ -39,7 +39,7 @@ class HybrisToolWindowFactory : ToolWindowFactory, DumbAware { } override fun shouldBeAvailable(project: Project): Boolean { - return HybrisProjectSettingsComponent.getInstance(project).state.isHybrisProject + return HybrisProjectSettingsComponent.getInstance(project).isHybrisProject() } companion object { diff --git a/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java b/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java index fed827a03..804e68fa5 100644 --- a/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java +++ b/src/com/intellij/idea/plugin/hybris/view/HybrisProjectView.java @@ -65,6 +65,7 @@ public class HybrisProjectView implements TreeStructureProvider, DumbAware { protected final Project project; + protected final HybrisProjectSettingsComponent hybrisProjectSettingsComponent; protected final HybrisProjectSettings hybrisProjectSettings; protected final HybrisApplicationSettings hybrisApplicationSettings; private final String[] commerceGroupName; @@ -74,7 +75,8 @@ public HybrisProjectView(@NotNull final Project project) { Validate.notNull(project); this.project = project; - this.hybrisProjectSettings = HybrisProjectSettingsComponent.getInstance(project).getState(); + this.hybrisProjectSettingsComponent = HybrisProjectSettingsComponent.getInstance(project); + this.hybrisProjectSettings = hybrisProjectSettingsComponent.getState(); this.hybrisApplicationSettings = HybrisApplicationSettingsComponent.getInstance().getState(); this.commerceGroupName = toIdeaGroup(hybrisApplicationSettings.getGroupHybris()); this.platformGroupName = toIdeaGroup(hybrisApplicationSettings.getGroupPlatform()); @@ -362,7 +364,7 @@ private boolean isSrcOrClassesDirectory(@NotNull final VirtualFile file) { } protected boolean isNotHybrisProject() { - return null != this.hybrisProjectSettings && !this.hybrisProjectSettings.isHybrisProject(); + return null != this.hybrisProjectSettings && !this.hybrisProjectSettingsComponent.isHybrisProject(); } protected boolean isJunk(@NotNull final VirtualFile virtualFile, @NotNull final List junkFileNames) {