diff --git a/resources/META-INF/optional-lang-dependencies.xml b/resources/META-INF/optional-lang-dependencies.xml index 92f66ab5b..55d8d578f 100644 --- a/resources/META-INF/optional-lang-dependencies.xml +++ b/resources/META-INF/optional-lang-dependencies.xml @@ -87,6 +87,11 @@ + + + + + @@ -296,6 +301,7 @@ + diff --git a/resources/META-INF/plugin-internal.xml b/resources/META-INF/plugin-internal.xml index 5bde91621..fc3295edb 100644 --- a/resources/META-INF/plugin-internal.xml +++ b/resources/META-INF/plugin-internal.xml @@ -21,6 +21,11 @@ + + + + + @@ -83,11 +88,11 @@ class="com.intellij.idea.plugin.hybris.actions.HybrisToolsActionGroup"> - - - - - + + + diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml index d7b4d525b..1e730a1b9 100644 --- a/resources/META-INF/plugin-release-info.xml +++ b/resources/META-INF/plugin-release-info.xml @@ -150,23 +150,22 @@
  • Feature: Added extensioninfo.xml DOM model and custom Icon (#147)
  • Feature: Added process.xml DOM model and custom Icon (#148)
  • Feature: Decreases cognitive complexity for Code Completion and custom Icons (#152)
  • -
  • Feature: Added code completion and navigation for Cockpitng elements -
      -
    • context -> type (#165)
    • -
    • context -> parent (#174)
    • -
    • context -> component (#169)
    • -
    • actions -> action-id (#172)
    • -
    • widgets -> widgetDefinitionId (#173)
    • -
    • list-view -> qualifier (#175)
    • -
    • explorer-tree -> type-node -> code (#176)
    • -
    • editorArea -> attribute -> qualifier (#177)
    • -
    • editorArea -> attribute -> editor (#182)
    • -
    • advanced-search -> field -> name (#178)
    • -
    • simple-search -> field -> name (#179)
    • -
    • flow -> property-list -> property -> qualifier (#180)
    • -
    • flow -> initialize -> type (#181)
    • -
    • type and other spring-bean, improved performance (#185)
    • -
    +
  • Feature: Added Cockpitng files (widgets, config, definition) support, Model, completion and navigation + (#165, + #174, + #169, + #172, + #173, + #175, + #176, + #177, + #182, + #178, + #179, + #180, + #181, + #185, + #186)
  • Bug Fix: FlexibleSearch code completion should not be case-sensitive for attributes (#167)
  • Bug Fix: [y] Tool Window Logo too dark for New UI (#95)
  • diff --git a/resources/icons/cockpitng_widget.svg b/resources/icons/cockpitng_widget.svg new file mode 100644 index 000000000..1496f776b --- /dev/null +++ b/resources/icons/cockpitng_widget.svg @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/resources/icons/cockpitng_widget_dark.svg b/resources/icons/cockpitng_widget_dark.svg new file mode 100644 index 000000000..624412e88 --- /dev/null +++ b/resources/icons/cockpitng_widget_dark.svg @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt index 27ef0bfbc..50fcbc8ff 100644 --- a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt +++ b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt @@ -230,6 +230,7 @@ object HybrisConstants { const val COCKPIT_NG_NAMESPACE_KEY = "COCKPIT_NG_NAMESPACE" const val COCKPIT_NG_INITIALIZE_CONTEXT_TYPE = "ctx.TYPE_CODE" + const val COCKPIT_NG_WIDGET_ID_STUB = "STUB_" private const val SRC_DIRECTORY = "src" private const val SCALA_SRC_DIRECTORY = "scalasrc" 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 884e5bc7d..dee18deac 100644 --- a/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java +++ b/src/com/intellij/idea/plugin/hybris/common/utils/HybrisIcons.java @@ -44,6 +44,7 @@ private HybrisIcons() { public static final Icon EXTENSION_INFO = getIcon("/icons/extensionInfo.svg"); public static final Icon COCKPIT_NG_CONFIG = getIcon("/icons/cockpitng_config.svg"); public static final Icon COCKPIT_NG_WIDGETS = getIcon("/icons/cockpitng_widgets.svg"); + public static final Icon COCKPIT_NG_WIDGET = getIcon("/icons/cockpitng_widget.svg"); public static final Icon COCKPIT_NG_WIDGET_DEFINITION = getIcon("/icons/cockpitng_widget_definition.svg"); public static final Icon COCKPIT_NG_ACTION_DEFINITION = getIcon("/icons/cockpitng_action_definition.svg"); public static final Icon COCKPIT_NG_EDITOR_DEFINITION = getIcon("/icons/cockpitng_editor_definition.svg"); diff --git a/src/com/intellij/idea/plugin/hybris/startup/PreLoadSystemsStartupActivity.kt b/src/com/intellij/idea/plugin/hybris/startup/PreLoadSystemsStartupActivity.kt new file mode 100644 index 000000000..ca97787ca --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/startup/PreLoadSystemsStartupActivity.kt @@ -0,0 +1,36 @@ +/* + * 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.startup + +import com.intellij.idea.plugin.hybris.system.bean.meta.BSMetaModelAccess +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.idea.plugin.hybris.system.type.meta.TSMetaModelAccess +import com.intellij.openapi.project.DumbService +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity + +class PreLoadSystemsStartupActivity : StartupActivity { + + override fun runActivity(project: Project) { + DumbService.getInstance(project).runReadActionInSmartMode { + TSMetaModelAccess.getInstance(project).getMetaModel() + BSMetaModelAccess.getInstance(project).getMetaModel() + CngMetaModelAccess.getInstance(project).getMetaModel() + } + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/bean/meta/impl/BSMetaModelAccessImpl.kt b/src/com/intellij/idea/plugin/hybris/system/bean/meta/impl/BSMetaModelAccessImpl.kt index d96076140..3743a5d46 100644 --- a/src/com/intellij/idea/plugin/hybris/system/bean/meta/impl/BSMetaModelAccessImpl.kt +++ b/src/com/intellij/idea/plugin/hybris/system/bean/meta/impl/BSMetaModelAccessImpl.kt @@ -63,14 +63,13 @@ class BSMetaModelAccessImpl(private val myProject: Project) : BSMetaModelAccess ) override fun getMetaModel(): BSGlobalMetaModel { - return DumbService.getInstance(myProject).tryRunReadActionInSmartMode( + return DumbService.getInstance(myProject).runReadActionInSmartMode( Computable { if (myGlobalMetaModel.hasUpToDateValue() || lock.isWriteLocked || writeLock.isHeldByCurrentThread) { return@Computable readMetaModelWithLock() } return@Computable writeMetaModelWithLock() - }, - "Computing Bean System" + } ) ?: throw ProcessCanceledException() } diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngConfigDomFileDescription.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngConfigDomFileDescription.kt index 1c269eb9f..d01a46b84 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngConfigDomFileDescription.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngConfigDomFileDescription.kt @@ -27,7 +27,7 @@ import com.intellij.psi.xml.XmlFile import com.intellij.util.xml.DomFileDescription import javax.swing.Icon -class CngConfigDomFileDescription : DomFileDescription(Config::class.java, CngPatterns.ROOT) { +class CngConfigDomFileDescription : DomFileDescription(Config::class.java, CngPatterns.CONFIG_ROOT) { override fun getFileIcon(flags: Int): Icon = HybrisIcons.COCKPIT_NG_CONFIG @@ -38,69 +38,69 @@ class CngConfigDomFileDescription : DomFileDescription(Config::class.jav super.initializeFileDescription() registerNamespacePolicy( HybrisConstants.COCKPIT_NG_NAMESPACE_KEY, - NAMESPACE_COCKPITNG_CONFIG, - NAMESPACE_COCKPITNG_CONFIG_HYBRIS, - NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA, - NAMESPACE_COCKPITNG_COMPONENT_DYNAMIC_FORMS, - NAMESPACE_COCKPITNG_COMPONENT_SUMMARY_VIEW, - NAMESPACE_COCKPITNG_COMPONENT_LIST_VIEW, - NAMESPACE_COCKPITNG_COMPONENT_GRID_VIEW, - NAMESPACE_COCKPITNG_COMPONENT_COMPARE_VIEW, - NAMESPACE_COCKPITNG_COMPONENT_VALUE_CHOOSER, - NAMESPACE_COCKPITNG_COMPONENT_QUICK_LIST, - NAMESPACE_COCKPITNG_COMPONENT_TREE_COLLECTION, - NAMESPACE_COCKPITNG_CONFIG_ADVANCED_SEARCH, - NAMESPACE_COCKPITNG_CONFIG_SIMPLE_SEARCH, - NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG, - NAMESPACE_COCKPITNG_CONFIG_PERSPECTIVE_CHOOSER, - NAMESPACE_COCKPITNG_CONFIG_REFINE_BY, - NAMESPACE_COCKPITNG_CONFIG_AVAILABLE_LOCALES, - NAMESPACE_COCKPITNG_CONFIG_DASHBOARD, - NAMESPACE_COCKPITNG_CONFIG_SIMPLE_LIST, - NAMESPACE_COCKPITNG_CONFIG_FULLT_EXT_SEARCH, - NAMESPACE_COCKPITNG_CONFIG_GRID_VIEW, - NAMESPACE_COCKPITNG_CONFIG_COMMON, - NAMESPACE_COCKPITNG_CONFIG_NOTIFICATIONS, - NAMESPACE_COCKPITNG_CONFIG_DRAG_AND_DROP, - NAMESPACE_COCKPITNG_CONFIG_EXPLORER_TREE, - NAMESPACE_COCKPITNG_CONFIG_EXTENDED_SPLIT_LAYOUT, - NAMESPACE_COCKPITNG_CONFIG_COLLECTION_BROWSER, - NAMESPACE_COCKPITNG_CONFIG_LINKS, - NAMESPACE_COCKPITNG_SPRING, - NAMESPACE_COCKPITNG_TEST, + NAMESPACE_COCKPIT_NG_CONFIG, + NAMESPACE_COCKPIT_NG_CONFIG_HYBRIS, + NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA, + NAMESPACE_COCKPIT_NG_COMPONENT_DYNAMIC_FORMS, + NAMESPACE_COCKPIT_NG_COMPONENT_SUMMARY_VIEW, + NAMESPACE_COCKPIT_NG_COMPONENT_LIST_VIEW, + NAMESPACE_COCKPIT_NG_COMPONENT_GRID_VIEW, + NAMESPACE_COCKPIT_NG_COMPONENT_COMPARE_VIEW, + NAMESPACE_COCKPIT_NG_COMPONENT_VALUE_CHOOSER, + NAMESPACE_COCKPIT_NG_COMPONENT_QUICK_LIST, + NAMESPACE_COCKPIT_NG_COMPONENT_TREE_COLLECTION, + NAMESPACE_COCKPIT_NG_CONFIG_ADVANCED_SEARCH, + NAMESPACE_COCKPIT_NG_CONFIG_SIMPLE_SEARCH, + NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG, + NAMESPACE_COCKPIT_NG_CONFIG_PERSPECTIVE_CHOOSER, + NAMESPACE_COCKPIT_NG_CONFIG_REFINE_BY, + NAMESPACE_COCKPIT_NG_CONFIG_AVAILABLE_LOCALES, + NAMESPACE_COCKPIT_NG_CONFIG_DASHBOARD, + NAMESPACE_COCKPIT_NG_CONFIG_SIMPLE_LIST, + NAMESPACE_COCKPIT_NG_CONFIG_FULLT_EXT_SEARCH, + NAMESPACE_COCKPIT_NG_CONFIG_GRID_VIEW, + NAMESPACE_COCKPIT_NG_CONFIG_COMMON, + NAMESPACE_COCKPIT_NG_CONFIG_NOTIFICATIONS, + NAMESPACE_COCKPIT_NG_CONFIG_DRAG_AND_DROP, + NAMESPACE_COCKPIT_NG_CONFIG_EXPLORER_TREE, + NAMESPACE_COCKPIT_NG_CONFIG_EXTENDED_SPLIT_LAYOUT, + NAMESPACE_COCKPIT_NG_CONFIG_COLLECTION_BROWSER, + NAMESPACE_COCKPIT_NG_CONFIG_LINKS, + NAMESPACE_COCKPIT_NG_SPRING, + NAMESPACE_COCKPIT_NG_TEST, ) } companion object { - const val NAMESPACE_COCKPITNG_CONFIG = "http://www.hybris.com/cockpit/config" - const val NAMESPACE_COCKPITNG_CONFIG_HYBRIS = "http://www.hybris.com/cockpit/config/hybris" - const val NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA = "http://www.hybris.com/cockpitng/component/editorArea" - const val NAMESPACE_COCKPITNG_COMPONENT_DYNAMIC_FORMS = "http://www.hybris.com/cockpitng/component/dynamicForms" - const val NAMESPACE_COCKPITNG_COMPONENT_SUMMARY_VIEW = "http://www.hybris.com/cockpitng/component/summaryview" - const val NAMESPACE_COCKPITNG_COMPONENT_LIST_VIEW = "http://www.hybris.com/cockpitng/component/listView" - const val NAMESPACE_COCKPITNG_COMPONENT_GRID_VIEW = "http://www.hybris.com/cockpitng/component/gridView" - const val NAMESPACE_COCKPITNG_COMPONENT_COMPARE_VIEW = "http://www.hybris.com/cockpitng/component/compareview" - const val NAMESPACE_COCKPITNG_COMPONENT_VALUE_CHOOSER = "http://www.hybris.com/cockpitng/component/valuechooser" - const val NAMESPACE_COCKPITNG_COMPONENT_QUICK_LIST = "http://www.hybris.com/cockpitng/component/quick-list" - const val NAMESPACE_COCKPITNG_COMPONENT_TREE_COLLECTION = "http://www.hybris.com/cockpitng/component/treeCollection" - const val NAMESPACE_COCKPITNG_CONFIG_ADVANCED_SEARCH = "http://www.hybris.com/cockpitng/config/advancedsearch" - const val NAMESPACE_COCKPITNG_CONFIG_SIMPLE_SEARCH = "http://www.hybris.com/cockpitng/config/simplesearch" - const val NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG = "http://www.hybris.com/cockpitng/config/wizard-config" - const val NAMESPACE_COCKPITNG_CONFIG_PERSPECTIVE_CHOOSER = "http://www.hybris.com/cockpitng/config/perspectiveChooser" - const val NAMESPACE_COCKPITNG_CONFIG_REFINE_BY = "http://www.hybris.com/cockpitng/config/refineBy" - const val NAMESPACE_COCKPITNG_CONFIG_AVAILABLE_LOCALES = "http://www.hybris.com/cockpitng/config/availableLocales" - const val NAMESPACE_COCKPITNG_CONFIG_DASHBOARD = "http://www.hybris.com/cockpitng/config/dashboard" - const val NAMESPACE_COCKPITNG_CONFIG_SIMPLE_LIST = "http://www.hybris.com/cockpitng/config/simplelist" - const val NAMESPACE_COCKPITNG_CONFIG_FULLT_EXT_SEARCH = "http://www.hybris.com/cockpitng/config/fulltextsearch" - const val NAMESPACE_COCKPITNG_CONFIG_GRID_VIEW = "http://www.hybris.com/cockpitng/config/gridView" - const val NAMESPACE_COCKPITNG_CONFIG_COMMON = "http://www.hybris.com/cockpitng/config/common" - const val NAMESPACE_COCKPITNG_CONFIG_NOTIFICATIONS = "http://www.hybris.com/cockpitng/config/notifications" - const val NAMESPACE_COCKPITNG_CONFIG_DRAG_AND_DROP = "http://www.hybris.com/cockpitng/component/dragAndDrop" - const val NAMESPACE_COCKPITNG_CONFIG_EXPLORER_TREE = "http://www.hybris.com/cockpitng/config/explorertree" - const val NAMESPACE_COCKPITNG_CONFIG_EXTENDED_SPLIT_LAYOUT = "http://www.hybris.com/cockpitng/config/extendedsplitlayout" - const val NAMESPACE_COCKPITNG_CONFIG_COLLECTION_BROWSER = "http://www.hybris.com/cockpitng/config/collectionbrowser" - const val NAMESPACE_COCKPITNG_CONFIG_LINKS = "http://www.hybris.com/cockpitng/config/links" - const val NAMESPACE_COCKPITNG_SPRING = "http://www.hybris.com/cockpitng/spring" - const val NAMESPACE_COCKPITNG_TEST = "http://www.hybris.com/cockpit/test" + const val NAMESPACE_COCKPIT_NG_CONFIG = "http://www.hybris.com/cockpit/config" + const val NAMESPACE_COCKPIT_NG_CONFIG_HYBRIS = "http://www.hybris.com/cockpit/config/hybris" + const val NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA = "http://www.hybris.com/cockpitng/component/editorArea" + const val NAMESPACE_COCKPIT_NG_COMPONENT_DYNAMIC_FORMS = "http://www.hybris.com/cockpitng/component/dynamicForms" + const val NAMESPACE_COCKPIT_NG_COMPONENT_SUMMARY_VIEW = "http://www.hybris.com/cockpitng/component/summaryview" + const val NAMESPACE_COCKPIT_NG_COMPONENT_LIST_VIEW = "http://www.hybris.com/cockpitng/component/listView" + const val NAMESPACE_COCKPIT_NG_COMPONENT_GRID_VIEW = "http://www.hybris.com/cockpitng/component/gridView" + const val NAMESPACE_COCKPIT_NG_COMPONENT_COMPARE_VIEW = "http://www.hybris.com/cockpitng/component/compareview" + const val NAMESPACE_COCKPIT_NG_COMPONENT_VALUE_CHOOSER = "http://www.hybris.com/cockpitng/component/valuechooser" + const val NAMESPACE_COCKPIT_NG_COMPONENT_QUICK_LIST = "http://www.hybris.com/cockpitng/component/quick-list" + const val NAMESPACE_COCKPIT_NG_COMPONENT_TREE_COLLECTION = "http://www.hybris.com/cockpitng/component/treeCollection" + const val NAMESPACE_COCKPIT_NG_CONFIG_ADVANCED_SEARCH = "http://www.hybris.com/cockpitng/config/advancedsearch" + const val NAMESPACE_COCKPIT_NG_CONFIG_SIMPLE_SEARCH = "http://www.hybris.com/cockpitng/config/simplesearch" + const val NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG = "http://www.hybris.com/cockpitng/config/wizard-config" + const val NAMESPACE_COCKPIT_NG_CONFIG_PERSPECTIVE_CHOOSER = "http://www.hybris.com/cockpitng/config/perspectiveChooser" + const val NAMESPACE_COCKPIT_NG_CONFIG_REFINE_BY = "http://www.hybris.com/cockpitng/config/refineBy" + const val NAMESPACE_COCKPIT_NG_CONFIG_AVAILABLE_LOCALES = "http://www.hybris.com/cockpitng/config/availableLocales" + const val NAMESPACE_COCKPIT_NG_CONFIG_DASHBOARD = "http://www.hybris.com/cockpitng/config/dashboard" + const val NAMESPACE_COCKPIT_NG_CONFIG_SIMPLE_LIST = "http://www.hybris.com/cockpitng/config/simplelist" + const val NAMESPACE_COCKPIT_NG_CONFIG_FULLT_EXT_SEARCH = "http://www.hybris.com/cockpitng/config/fulltextsearch" + const val NAMESPACE_COCKPIT_NG_CONFIG_GRID_VIEW = "http://www.hybris.com/cockpitng/config/gridView" + const val NAMESPACE_COCKPIT_NG_CONFIG_COMMON = "http://www.hybris.com/cockpitng/config/common" + const val NAMESPACE_COCKPIT_NG_CONFIG_NOTIFICATIONS = "http://www.hybris.com/cockpitng/config/notifications" + const val NAMESPACE_COCKPIT_NG_CONFIG_DRAG_AND_DROP = "http://www.hybris.com/cockpitng/component/dragAndDrop" + const val NAMESPACE_COCKPIT_NG_CONFIG_EXPLORER_TREE = "http://www.hybris.com/cockpitng/config/explorertree" + const val NAMESPACE_COCKPIT_NG_CONFIG_EXTENDED_SPLIT_LAYOUT = "http://www.hybris.com/cockpitng/config/extendedsplitlayout" + const val NAMESPACE_COCKPIT_NG_CONFIG_COLLECTION_BROWSER = "http://www.hybris.com/cockpitng/config/collectionbrowser" + const val NAMESPACE_COCKPIT_NG_CONFIG_LINKS = "http://www.hybris.com/cockpitng/config/links" + const val NAMESPACE_COCKPIT_NG_SPRING = "http://www.hybris.com/cockpitng/spring" + const val NAMESPACE_COCKPIT_NG_TEST = "http://www.hybris.com/cockpit/test" } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngWidgetsDomFileDescription.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngWidgetsDomFileDescription.kt index 63a424a9f..f42ebd330 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngWidgetsDomFileDescription.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/CngWidgetsDomFileDescription.kt @@ -21,12 +21,13 @@ package com.intellij.idea.plugin.hybris.system.cockpitng import com.intellij.idea.plugin.hybris.common.HybrisConstants import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widgets +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.CngPatterns import com.intellij.openapi.module.Module import com.intellij.psi.xml.XmlFile import com.intellij.util.xml.DomFileDescription import javax.swing.Icon -class CngWidgetsDomFileDescription : DomFileDescription(Widgets::class.java, "widgets") { +class CngWidgetsDomFileDescription : DomFileDescription(Widgets::class.java, CngPatterns.WIDGETS_ROOT) { override fun getFileIcon(flags: Int): Icon = HybrisIcons.COCKPIT_NG_WIDGETS diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/CngCompletionContributor.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/CngCompletionContributor.kt index c43ac6d3d..43df40a80 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/CngCompletionContributor.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/CngCompletionContributor.kt @@ -20,13 +20,9 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion import com.intellij.codeInsight.completion.CompletionContributor import com.intellij.codeInsight.completion.CompletionType import com.intellij.idea.plugin.hybris.codeInsight.completion.provider.ItemTypeCodeCompletionProvider -import com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.provider.CngEditorDefinitionCodeCompletionProvider -import com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.provider.CngFlowItemAttributeCodeCompletionProvider -import com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.provider.CngItemAttributeCodeCompletionProvider -import com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.provider.CngFlowItemTypeCodeCompletionProvider +import com.intellij.idea.plugin.hybris.system.cockpitng.codeInsight.completion.provider.* import com.intellij.idea.plugin.hybris.system.cockpitng.psi.CngPatterns import com.intellij.patterns.PlatformPatterns -import com.intellij.patterns.XmlPatterns class CngCompletionContributor : CompletionContributor() { @@ -56,5 +52,30 @@ class CngCompletionContributor : CompletionContributor() { PlatformPatterns.psiElement().inside(CngPatterns.EDITOR_DEFINITION), CngEditorDefinitionCodeCompletionProvider.instance ) + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement().inside(CngPatterns.ACTION_DEFINITION), + CngActionDefinitionCompletionProvider.instance + ) + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement().inside(CngPatterns.WIDGET_DEFINITION), + CngWidgetDefinitionCompletionProvider.instance + ) + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement().inside(CngPatterns.WIDGET_CONNECTION_WIDGET_ID), + CngWidgetConnectionWidgetIdCompletionProvider.instance + ) + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement().inside(CngPatterns.WIDGET_ID), + CngWidgetIdCompletionProvider.instance + ) + extend( + CompletionType.BASIC, + PlatformPatterns.psiElement().inside(CngPatterns.WIDGET_SETTING), + CngWidgetSettingCompletionProvider.instance + ) } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngActionDefinitionCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngActionDefinitionCompletionProvider.kt new file mode 100644 index 000000000..c110460c0 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngActionDefinitionCompletionProvider.kt @@ -0,0 +1,56 @@ +/* + * 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.system.cockpitng.codeInsight.completion.provider + +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.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.openapi.application.ApplicationManager +import com.intellij.util.ProcessingContext + +open class CngActionDefinitionCompletionProvider : CompletionProvider() { + + public override fun addCompletions( + parameters: CompletionParameters, + context: ProcessingContext, + result: CompletionResultSet + ) { + val project = parameters.editor.project ?: return + + val resultCaseInsensitive = result.caseInsensitive() + + with(CngMetaModelAccess.getInstance(project).getMetaModel()) { + actionDefinitions + .values + .map { + LookupElementBuilder.create(it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_ACTION_DEFINITION) + } + .forEach { resultCaseInsensitive.addElement(it) } + } + } + + companion object { + val instance: CompletionProvider = + ApplicationManager.getApplication().getService(CngActionDefinitionCompletionProvider::class.java) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetConnectionWidgetIdCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetConnectionWidgetIdCompletionProvider.kt new file mode 100644 index 000000000..d3e7ac37d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetConnectionWidgetIdCompletionProvider.kt @@ -0,0 +1,75 @@ +/* + * 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.system.cockpitng.codeInsight.completion.provider + +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.HybrisConstants +import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.openapi.application.ApplicationManager +import com.intellij.util.ProcessingContext + +open class CngWidgetConnectionWidgetIdCompletionProvider : CompletionProvider() { + + public override fun addCompletions( + parameters: CompletionParameters, + context: ProcessingContext, + result: CompletionResultSet + ) { + val project = parameters.editor.project ?: return + + val resultCaseInsensitive = result.caseInsensitive() + + with(CngMetaModelAccess.getInstance(project).getMetaModel()) { + widgets + .values + .map { + LookupElementBuilder.create(it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_WIDGET) + } + .forEach { resultCaseInsensitive.addElement(it) } + + editorDefinitions + .values + .map { + LookupElementBuilder.create(HybrisConstants.COCKPIT_NG_WIDGET_ID_STUB + it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_EDITOR_DEFINITION) + } + .forEach { resultCaseInsensitive.addElement(it) } + + widgetDefinitions + .values + .map { + LookupElementBuilder.create(HybrisConstants.COCKPIT_NG_WIDGET_ID_STUB + it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_WIDGET_DEFINITION) + } + .forEach { resultCaseInsensitive.addElement(it) } + } + } + + companion object { + val instance: CompletionProvider = + ApplicationManager.getApplication().getService(CngWidgetConnectionWidgetIdCompletionProvider::class.java) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetDefinitionCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetDefinitionCompletionProvider.kt new file mode 100644 index 000000000..dc5867a8a --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetDefinitionCompletionProvider.kt @@ -0,0 +1,56 @@ +/* + * 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.system.cockpitng.codeInsight.completion.provider + +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.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.openapi.application.ApplicationManager +import com.intellij.util.ProcessingContext + +open class CngWidgetDefinitionCompletionProvider : CompletionProvider() { + + public override fun addCompletions( + parameters: CompletionParameters, + context: ProcessingContext, + result: CompletionResultSet + ) { + val project = parameters.editor.project ?: return + + val resultCaseInsensitive = result.caseInsensitive() + + with(CngMetaModelAccess.getInstance(project).getMetaModel()) { + widgetDefinitions + .values + .map { + LookupElementBuilder.create(it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_WIDGET_DEFINITION) + } + .forEach { resultCaseInsensitive.addElement(it) } + } + } + + companion object { + val instance: CompletionProvider = + ApplicationManager.getApplication().getService(CngWidgetDefinitionCompletionProvider::class.java) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetIdCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetIdCompletionProvider.kt new file mode 100644 index 000000000..0f9f2e024 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetIdCompletionProvider.kt @@ -0,0 +1,56 @@ +/* + * 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.system.cockpitng.codeInsight.completion.provider + +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.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.openapi.application.ApplicationManager +import com.intellij.util.ProcessingContext + +open class CngWidgetIdCompletionProvider : CompletionProvider() { + + public override fun addCompletions( + parameters: CompletionParameters, + context: ProcessingContext, + result: CompletionResultSet + ) { + val project = parameters.editor.project ?: return + + val resultCaseInsensitive = result.caseInsensitive() + + with(CngMetaModelAccess.getInstance(project).getMetaModel()) { + widgets + .values + .map { + LookupElementBuilder.create(it.id) + .withTailText(it.name?.let { name -> " $name" }, true) + .withIcon(HybrisIcons.COCKPIT_NG_WIDGET) + } + .forEach { resultCaseInsensitive.addElement(it) } + } + } + + companion object { + val instance: CompletionProvider = + ApplicationManager.getApplication().getService(CngWidgetIdCompletionProvider::class.java) + } +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetSettingCompletionProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetSettingCompletionProvider.kt new file mode 100644 index 000000000..b07a3015e --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/codeInsight/completion/provider/CngWidgetSettingCompletionProvider.kt @@ -0,0 +1,76 @@ +/* + * 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.system.cockpitng.codeInsight.completion.provider + +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.system.cockpitng.meta.CngMetaModelAccess +import com.intellij.openapi.application.ApplicationManager +import com.intellij.psi.util.parentsOfType +import com.intellij.psi.xml.XmlTag +import com.intellij.util.ProcessingContext + +open class CngWidgetSettingCompletionProvider : CompletionProvider() { + + public override fun addCompletions( + parameters: CompletionParameters, + context: ProcessingContext, + result: CompletionResultSet + ) { + val project = parameters.editor.project ?: return + + val widgetDefinitionId = parameters.position.parentsOfType() + .firstOrNull { it.localName == "widget" } + ?.getAttributeValue("widgetDefinitionId") + ?: return + + val resultCaseInsensitive = result.caseInsensitive() + + commonSettings + .map { + LookupElementBuilder.create(it) + .withTypeText("java.lang.String", true) + } + .forEach { resultCaseInsensitive.addElement(it) } + + CngMetaModelAccess.getInstance(project).getMetaModel() + .widgetDefinitions[widgetDefinitionId] + ?.settings + ?.values + ?.map { + LookupElementBuilder.create(it.id) + .withTypeText(it.defaultValue?.let { defaultValue -> " $defaultValue" }, true) + .withTypeText(it.type) + } + ?.forEach { resultCaseInsensitive.addElement(it) } + } + + companion object { + val instance: CompletionProvider = + ApplicationManager.getApplication().getService(CngWidgetSettingCompletionProvider::class.java) + val commonSettings = setOf( + "widgetStyleClass".lowercase(), + "widgetStyleAttribute".lowercase(), + "_width", + "_height" + ) + } + +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngChangeListener.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngChangeListener.kt index 09c99dec3..325cdd809 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngChangeListener.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngChangeListener.kt @@ -18,8 +18,6 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.meta -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngGlobalMetaModel - interface CngChangeListener { fun cngSystemChanged(globalMetaModel: CngGlobalMetaModel) = Unit diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngGlobalMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngGlobalMetaModel.kt similarity index 70% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngGlobalMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngGlobalMetaModel.kt index daa69cb0a..91aee52ed 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngGlobalMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngGlobalMetaModel.kt @@ -15,8 +15,12 @@ * 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.system.cockpitng.meta.model +package com.intellij.idea.plugin.hybris.system.cockpitng.meta +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngMetaActionDefinition +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngMetaEditorDefinition +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngMetaWidget +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngMetaWidgetDefinition import com.intellij.idea.plugin.hybris.system.type.meta.impl.CaseInsensitive.CaseInsensitiveConcurrentHashMap /** @@ -25,8 +29,9 @@ import com.intellij.idea.plugin.hybris.system.type.meta.impl.CaseInsensitive.Cas class CngGlobalMetaModel { val components = mutableSetOf(); - val actionDefinitions = CaseInsensitiveConcurrentHashMap(); - val widgetDefinitions = CaseInsensitiveConcurrentHashMap(); - val editorDefinitions = CaseInsensitiveConcurrentHashMap(); + val actionDefinitions = CaseInsensitiveConcurrentHashMap(); + val widgetDefinitions = CaseInsensitiveConcurrentHashMap(); + val editorDefinitions = CaseInsensitiveConcurrentHashMap(); + val widgets = CaseInsensitiveConcurrentHashMap(); } diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelAccess.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelAccess.kt index 828cf5f3f..9cce34cec 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelAccess.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelAccess.kt @@ -17,7 +17,6 @@ */ package com.intellij.idea.plugin.hybris.system.cockpitng.meta -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngGlobalMetaModel import com.intellij.openapi.project.Project interface CngMetaModelAccess { diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelMerger.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelMerger.kt index e0913d6e3..3de0077d7 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelMerger.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelMerger.kt @@ -27,9 +27,10 @@ interface CngMetaModelMerger { } fun merge( - configs: Collection, - actions: Collection, - widgets: Collection, - editors: Collection + configs: Collection, + actions: Collection, + widgetDefinitions: Collection, + editors: Collection, + widgets: Collection ): CngGlobalMetaModel } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelProcessor.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelProcessor.kt index badd4eb70..9a79738e1 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelProcessor.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/CngMetaModelProcessor.kt @@ -17,10 +17,7 @@ */ package com.intellij.idea.plugin.hybris.system.cockpitng.meta -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngActionDefinitionMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngConfigMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngEditorDefinitionMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngWidgetDefinitionMetaModel +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile @@ -30,8 +27,9 @@ interface CngMetaModelProcessor { fun getInstance(project: Project): CngMetaModelProcessor = project.getService(CngMetaModelProcessor::class.java) } - fun processConfig(psiFile: PsiFile): CngConfigMetaModel? - fun processActionDefinition(psiFile: PsiFile): CngActionDefinitionMetaModel? - fun processWidgetDefinition(psiFile: PsiFile): CngWidgetDefinitionMetaModel? - fun processEditorDefinition(psiFile: PsiFile): CngEditorDefinitionMetaModel? + fun processConfig(psiFile: PsiFile): CngConfigMeta? + fun processActionDefinition(psiFile: PsiFile): CngMetaActionDefinition? + fun processWidgetDefinition(psiFile: PsiFile): CngMetaWidgetDefinition? + fun processEditorDefinition(psiFile: PsiFile): CngMetaEditorDefinition? + fun processWidgets(psiFile: PsiFile): CngMetaWidgets? } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelAccessImpl.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelAccessImpl.kt index 56b6b4285..da77ee066 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelAccessImpl.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelAccessImpl.kt @@ -23,6 +23,7 @@ import com.intellij.idea.plugin.hybris.system.cockpitng.model.config.Config import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.ActionDefinition import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.EditorDefinition import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetDefinition +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widgets import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.openapi.project.DumbService @@ -60,33 +61,37 @@ class CngMetaModelAccessImpl(private val myProject: Project) : CngMetaModelAcces private val myGlobalMetaModel = CachedValuesManager.getManager(myProject).createCachedValue( { val processor = CngMetaModelProcessor.getInstance(myProject) - val (configs, configDependencies) = collectLocalMetaModels(SINGLE_CONFIG_MODEL_CACHE_KEY, Config::class.java, + val (configs, configDependencies) = collectLocalMetaModels(SINGLE_CONFIG_CACHE_KEY, Config::class.java, { file -> processor.processConfig(file) }, { _ -> true } ) - val (actions, actionDependencies) = collectLocalMetaModels(SINGLE_ACTION_DEFINITION_MODEL_CACHE_KEY, ActionDefinition::class.java, + val (actions, actionDependencies) = collectLocalMetaModels(SINGLE_ACTION_DEFINITION_CACHE_KEY, ActionDefinition::class.java, { file -> processor.processActionDefinition(file) }, { dom -> dom.rootElement.id.exists() } ) - val (widgets, widgetDependencies) = collectLocalMetaModels(SINGLE_WIDGET_DEFINITION_MODEL_CACHE_KEY, WidgetDefinition::class.java, + val (widgetDefinitions, widgetDependencies) = collectLocalMetaModels(SINGLE_WIDGET_DEFINITION_CACHE_KEY, WidgetDefinition::class.java, { file -> processor.processWidgetDefinition(file) }, { dom -> dom.rootElement.id.exists() } ) - val (editors, editorDependencies) = collectLocalMetaModels(SINGLE_EDITOR_DEFINITION_MODEL_CACHE_KEY, EditorDefinition::class.java, + val (editors, editorDependencies) = collectLocalMetaModels(SINGLE_EDITOR_DEFINITION_CACHE_KEY, EditorDefinition::class.java, { file -> processor.processEditorDefinition(file) }, { dom -> dom.rootElement.id.exists() } ) + val (widgets, widgetsDependencies) = collectLocalMetaModels(SINGLE_WIDGETS_MODEL_CACHE_KEY, Widgets::class.java, + { file -> processor.processWidgets(file) }, + { _ -> true } + ) val globalMetaModel = CngMetaModelMerger.getInstance(myProject).merge( - configs, actions, widgets, editors + configs, actions, widgetDefinitions, editors, widgets ) - val dependencies = configDependencies + actionDependencies + widgetDependencies + editorDependencies + val dependencies = configDependencies + actionDependencies + widgetDependencies + editorDependencies + widgetsDependencies CachedValueProvider.Result.create(globalMetaModel, dependencies.ifEmpty { ModificationTracker.EVER_CHANGED }) }, false ) - private fun > collectLocalMetaModels( + private fun > collectLocalMetaModels( key: Key>, clazz: Class, resultProcessor: (input: PsiFile) -> T?, @@ -104,14 +109,13 @@ class CngMetaModelAccessImpl(private val myProject: Project) : CngMetaModelAcces } override fun getMetaModel(): CngGlobalMetaModel { - return DumbService.getInstance(myProject).tryRunReadActionInSmartMode( + return DumbService.getInstance(myProject).runReadActionInSmartMode( Computable { if (myGlobalMetaModel.hasUpToDateValue() || lock.isWriteLocked || writeLock.isHeldByCurrentThread) { return@Computable readMetaModelWithLock() } return@Computable writeMetaModelWithLock() - }, - "Computing Cockpitng System" + } ) ?: throw ProcessCanceledException() // if (DumbService.isDumb(myProject)) throw ProcessCanceledException() } @@ -142,7 +146,7 @@ class CngMetaModelAccessImpl(private val myProject: Project) : CngMetaModelAcces } } - private fun > retrieveSingleMetaModelPerFile( + private fun > retrieveSingleMetaModelPerFile( psiFile: PsiFile, key: Key>, resultProcessor: (input: PsiFile) -> T? @@ -155,7 +159,7 @@ class CngMetaModelAccessImpl(private val myProject: Project) : CngMetaModelAcces } } - private fun > createSingleMetaModelCachedValue( + private fun > createSingleMetaModelCachedValue( project: Project, psiFile: PsiFile, resultProcessor: (input: PsiFile) -> T? @@ -172,13 +176,15 @@ class CngMetaModelAccessImpl(private val myProject: Project) : CngMetaModelAcces companion object { val topic = Topic("HYBRIS_COCKPITNG_SYSTEM_LISTENER", CngChangeListener::class.java) - private val SINGLE_CONFIG_MODEL_CACHE_KEY = Key.create>("SINGLE_CNG_CONFIG_MODEL_CACHE") - private val SINGLE_ACTION_DEFINITION_MODEL_CACHE_KEY = - Key.create>("SINGLE_ACTION_DEFINITION_MODEL_CACHE") - private val SINGLE_WIDGET_DEFINITION_MODEL_CACHE_KEY = - Key.create>("SINGLE_WIDGET_DEFINITION_MODEL_CACHE") - private val SINGLE_EDITOR_DEFINITION_MODEL_CACHE_KEY = - Key.create>("SINGLE_EDITOR_DEFINITION_MODEL_CACHE") + private val SINGLE_CONFIG_CACHE_KEY = Key.create>("SINGLE_CNG_CONFIG_CACHE") + private val SINGLE_ACTION_DEFINITION_CACHE_KEY = + Key.create>("SINGLE_ACTION_DEFINITION_CACHE") + private val SINGLE_WIDGET_DEFINITION_CACHE_KEY = + Key.create>("SINGLE_WIDGET_DEFINITION_CACHE") + private val SINGLE_EDITOR_DEFINITION_CACHE_KEY = + Key.create>("SINGLE_EDITOR_DEFINITION_CACHE") + private val SINGLE_WIDGETS_MODEL_CACHE_KEY = + Key.create>("SINGLE_WIDGETS_CACHE") private val lock = ReentrantReadWriteLock() private val readLock = lock.readLock() private val writeLock = lock.writeLock() diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelMergerImpl.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelMergerImpl.kt index 63112b083..9a8f0f328 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelMergerImpl.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelMergerImpl.kt @@ -17,43 +17,65 @@ */ package com.intellij.idea.plugin.hybris.system.cockpitng.meta.impl -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.* +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngGlobalMetaModel +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelMerger import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.* import com.intellij.openapi.project.Project class CngMetaModelMergerImpl(val myProject: Project) : CngMetaModelMerger { override fun merge( - configs: Collection, - actions: Collection, - widgets: Collection, - editors: Collection + configs: Collection, + actions: Collection, + widgetDefinitions: Collection, + editors: Collection, + widgets: Collection ) = with(CngGlobalMetaModel()) { configs .forEach { merge(this, it) } actions .forEach { merge(this, it) } - widgets + widgetDefinitions .forEach { merge(this, it) } editors .forEach { merge(this, it) } + widgets + .forEach { merge(this, it) } this } - private fun merge(globalMetaModel: CngGlobalMetaModel, localMetaModel: CngConfigMetaModel) { - globalMetaModel.components.addAll(localMetaModel.getAllComponents()) + private fun merge(globalMetaModel: CngGlobalMetaModel, localMeta: CngConfigMeta) { + globalMetaModel.components.addAll(localMeta.getAllComponents()) + } + + private fun merge(globalMetaModel: CngGlobalMetaModel, localMeta: CngMetaActionDefinition) { + globalMetaModel.actionDefinitions[localMeta.id] = localMeta } - private fun merge(globalMetaModel: CngGlobalMetaModel, localMetaModel: CngActionDefinitionMetaModel) { - globalMetaModel.actionDefinitions[localMetaModel.id] = localMetaModel + private fun merge(globalMetaModel: CngGlobalMetaModel, localMeta: CngMetaWidgetDefinition) { + globalMetaModel.widgetDefinitions[localMeta.id] = localMeta } - private fun merge(globalMetaModel: CngGlobalMetaModel, localMetaModel: CngWidgetDefinitionMetaModel) { - globalMetaModel.widgetDefinitions[localMetaModel.id] = localMetaModel + private fun merge(globalMetaModel: CngGlobalMetaModel, localMeta: CngMetaEditorDefinition) { + globalMetaModel.editorDefinitions[localMeta.id] = localMeta } - private fun merge(globalMetaModel: CngGlobalMetaModel, localMetaModel: CngEditorDefinitionMetaModel) { - globalMetaModel.editorDefinitions[localMetaModel.id] = localMetaModel + private fun merge(globalMetaModel: CngGlobalMetaModel, localMeta: CngMetaWidgets) { + // It is possible to extend existing widget with new widgets, those have to be processed first + localMeta.widgetExtensions + .flatMap { it.widgets } + .forEach { mergeWidget(it, globalMetaModel) } + + localMeta.widgets + .forEach { mergeWidget(it, globalMetaModel) } + } + + private fun mergeWidget(widget: CngMetaWidget, globalMetaModel: CngGlobalMetaModel) { + globalMetaModel.widgets[widget.id] = widget + + widget.widgets.forEach { subWidget -> + mergeWidget(subWidget, globalMetaModel) + } } } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelProcessorImpl.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelProcessorImpl.kt index 85877ff8e..d72a0b9d6 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelProcessorImpl.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/impl/CngMetaModelProcessorImpl.kt @@ -17,15 +17,11 @@ */ package com.intellij.idea.plugin.hybris.system.cockpitng.meta.impl -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngActionDefinitionMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngConfigMetaModel import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelProcessor -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngEditorDefinitionMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.CngWidgetDefinitionMetaModel -import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.ActionDefinition +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.model.* import com.intellij.idea.plugin.hybris.system.cockpitng.model.config.Config -import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.EditorDefinition -import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetDefinition +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.* +import com.intellij.idea.plugin.hybris.system.type.meta.impl.CaseInsensitive.CaseInsensitiveConcurrentHashMap import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import com.intellij.psi.xml.XmlFile @@ -34,32 +30,60 @@ import com.intellij.util.xml.DomManager class CngMetaModelProcessorImpl(myProject: Project) : CngMetaModelProcessor { private val myDomManager: DomManager = DomManager.getDomManager(myProject) - override fun processConfig(psiFile: PsiFile): CngConfigMetaModel? { + override fun processConfig(psiFile: PsiFile): CngConfigMeta? { psiFile.virtualFile ?: return null val dom = myDomManager.getFileElement(psiFile as XmlFile, Config::class.java)?.rootElement ?: return null - return CngConfigMetaModel(psiFile, dom) + return CngConfigMeta(psiFile, dom) } - override fun processActionDefinition(psiFile: PsiFile): CngActionDefinitionMetaModel? { + override fun processActionDefinition(psiFile: PsiFile): CngMetaActionDefinition? { psiFile.virtualFile ?: return null val dom = myDomManager.getFileElement(psiFile as XmlFile, ActionDefinition::class.java)?.rootElement ?: return null - return CngActionDefinitionMetaModel(psiFile, dom) + return CngMetaActionDefinition(psiFile, dom) } - override fun processWidgetDefinition(psiFile: PsiFile): CngWidgetDefinitionMetaModel? { + override fun processWidgetDefinition(psiFile: PsiFile): CngMetaWidgetDefinition? { psiFile.virtualFile ?: return null val dom = myDomManager.getFileElement(psiFile as XmlFile, WidgetDefinition::class.java)?.rootElement ?: return null - return CngWidgetDefinitionMetaModel(psiFile, dom) + val settings = CaseInsensitiveConcurrentHashMap() + dom.settings.settings + .map { CngMetaWidgetSetting(psiFile, it) } + .forEach { settings[it.id] = it } + + return CngMetaWidgetDefinition(psiFile, dom, settings) } - override fun processEditorDefinition(psiFile: PsiFile): CngEditorDefinitionMetaModel? { + override fun processEditorDefinition(psiFile: PsiFile): CngMetaEditorDefinition? { psiFile.virtualFile ?: return null val dom = myDomManager.getFileElement(psiFile as XmlFile, EditorDefinition::class.java)?.rootElement ?: return null - return CngEditorDefinitionMetaModel(psiFile, dom) + return CngMetaEditorDefinition(psiFile, dom) + } + + override fun processWidgets(psiFile: PsiFile): CngMetaWidgets? { + psiFile.virtualFile ?: return null + val dom = myDomManager.getFileElement(psiFile as XmlFile, Widgets::class.java)?.rootElement ?: return null + + return CngMetaWidgets( + psiFile, + dom, + processWidgets(psiFile, dom.widgets), + dom.widgetExtensions + .map { CngMetaWidgetExtension(psiFile, it, processWidgets(psiFile, it.widgets)) } + ) } + private fun processWidgets( + psiFile: PsiFile, + widgets: List + ): List = widgets + .map { + val subWidgets = if (it.widgets.isNotEmpty()) processWidgets(psiFile, it.widgets) + else emptyList() + CngMetaWidget(psiFile, it, subWidgets) + } + } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMeta.kt similarity index 89% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMeta.kt index a20de1b5e..1416b824a 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngConfigMeta.kt @@ -21,10 +21,10 @@ import com.intellij.idea.plugin.hybris.system.cockpitng.model.config.Config import com.intellij.psi.PsiFile import io.ktor.util.* -class CngConfigMetaModel( - myPsiFile: PsiFile, +class CngConfigMeta( + private val myPsiFile: PsiFile, myDom: Config -) : CngMetaModel(myPsiFile, myDom) { +) : CngMeta(myPsiFile, myDom) { private val myComponents = dom.contexts .mapNotNull { it.component.stringValue } @@ -32,4 +32,6 @@ class CngConfigMetaModel( fun getAllComponents() = myComponents.unmodifiable(); + override fun toString() = myPsiFile.name + } diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMeta.kt similarity index 96% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMeta.kt index 92c090213..f8a6fac66 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMeta.kt @@ -22,7 +22,7 @@ import com.intellij.util.xml.DomAnchor import com.intellij.util.xml.DomElement import com.intellij.util.xml.DomService -open class CngMetaModel( +open class CngMeta( val psiFile: PsiFile, val dom: DOM, val domAnchor: DomAnchor = DomService.getInstance().createAnchor(dom), diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngActionDefinitionMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaActionDefinition.kt similarity index 91% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngActionDefinitionMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaActionDefinition.kt index 7c00ade8a..567e68420 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngActionDefinitionMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaActionDefinition.kt @@ -20,12 +20,14 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.meta.model import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.ActionDefinition import com.intellij.psi.PsiFile -class CngActionDefinitionMetaModel( +class CngMetaActionDefinition( myPsiFile: PsiFile, myDom: ActionDefinition, -) : CngMetaModel(myPsiFile, myDom) { +) : CngMeta(myPsiFile, myDom) { val id: String = dom.id.stringValue!! val name: String? = dom.name.stringValue val description: String? = dom.description.stringValue + + override fun toString() = id } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngEditorDefinitionMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaEditorDefinition.kt similarity index 91% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngEditorDefinitionMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaEditorDefinition.kt index 04b0a6ccb..8242cfbf7 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngEditorDefinitionMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaEditorDefinition.kt @@ -20,12 +20,14 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.meta.model import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.EditorDefinition import com.intellij.psi.PsiFile -class CngEditorDefinitionMetaModel( +class CngMetaEditorDefinition( myPsiFile: PsiFile, myDom: EditorDefinition, -) : CngMetaModel(myPsiFile, myDom) { +) : CngMeta(myPsiFile, myDom) { val id: String = dom.id.stringValue!! val name: String? = dom.name.stringValue val description: String? = dom.description.stringValue + + override fun toString() = id } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidget.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidget.kt new file mode 100644 index 000000000..087b76f6b --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidget.kt @@ -0,0 +1,39 @@ +/* + * 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.system.cockpitng.meta.model + +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widget +import com.intellij.psi.PsiFile + +class CngMetaWidget( + myPsiFile: PsiFile, + myDom: Widget, + val widgets: Collection = emptyList(), +) : CngMeta(myPsiFile, myDom) { + + val id: String = dom.id.stringValue!! + val name: String? = dom.title.stringValue + val slotId: String? = dom.slotId.stringValue + val widgetDefinitionId: String? = dom.widgetDefinitionId.stringValue + val access: String? = dom.access.stringValue + val lastFocusedChildIndex: String? = dom.lastFocusedChildIndex.stringValue + val lastFocusedTemplateInstanceId: String? = dom.lastFocusedTemplateInstanceId.stringValue + val template = dom.template.value ?: false + + override fun toString() = id +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngWidgetDefinitionMetaModel.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetDefinition.kt similarity index 87% rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngWidgetDefinitionMetaModel.kt rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetDefinition.kt index a7346ab73..e08775923 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngWidgetDefinitionMetaModel.kt +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetDefinition.kt @@ -20,12 +20,15 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.meta.model import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetDefinition import com.intellij.psi.PsiFile -class CngWidgetDefinitionMetaModel( +class CngMetaWidgetDefinition( myPsiFile: PsiFile, myDom: WidgetDefinition, -) : CngMetaModel(myPsiFile, myDom) { + val settings: Map, +) : CngMeta(myPsiFile, myDom) { val id: String = dom.id.stringValue!! val name: String? = dom.name.stringValue val description: String? = dom.description.stringValue + + override fun toString() = id } \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetExtension.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetExtension.kt new file mode 100644 index 000000000..4977fd9b5 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetExtension.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.system.cockpitng.meta.model + +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetExtension +import com.intellij.psi.PsiFile + +class CngMetaWidgetExtension( + myPsiFile: PsiFile, + myDom: WidgetExtension, + val widgets: Collection = emptyList(), +) : CngMeta(myPsiFile, myDom) { + + val id: String = dom.widgetId.stringValue!! + + override fun toString() = id +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetSetting.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetSetting.kt new file mode 100644 index 000000000..b10fc7249 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgetSetting.kt @@ -0,0 +1,33 @@ +/* + * 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.system.cockpitng.meta.model + +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Setting +import com.intellij.psi.PsiFile + +class CngMetaWidgetSetting( + myPsiFile: PsiFile, + myDom: Setting, +) : CngMeta(myPsiFile, myDom) { + + val id: String = dom.key.stringValue!! + val type: String? = dom.type.stringValue + val defaultValue: String? = dom.defaultValue.stringValue + + override fun toString() = id +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgets.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgets.kt new file mode 100644 index 000000000..e6befe4a7 --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/meta/model/CngMetaWidgets.kt @@ -0,0 +1,31 @@ +/* + * 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.system.cockpitng.meta.model + +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widgets +import com.intellij.psi.PsiFile + +class CngMetaWidgets( + private val myPsiFile: PsiFile, + myDom: Widgets, + val widgets: Collection = emptyList(), + val widgetExtensions: Collection = emptyList(), +) : CngMeta(myPsiFile, myDom) { + + override fun toString() = myPsiFile.name +} \ No newline at end of file diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/hybris/Action.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/hybris/Action.java index 3f175ab36..e2cd8b04b 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/hybris/Action.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/hybris/Action.java @@ -22,9 +22,6 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.model.config.hybris; import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.idea.plugin.hybris.system.cockpitng.model.config.ConfigGenericAttributeValue; -import com.intellij.idea.plugin.hybris.system.cockpitng.util.xml.CngActionDefinitionIdConverter; -import com.intellij.util.xml.Convert; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.GenericAttributeValue; import com.intellij.util.xml.Namespace; @@ -54,8 +51,7 @@ public interface Action extends DomElement, Positioned { */ @NotNull @com.intellij.util.xml.Attribute("action-id") - @Convert(CngActionDefinitionIdConverter.class) - ConfigGenericAttributeValue getActionId(); + GenericAttributeValue getActionId(); /** diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Setting.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Setting.java index 9c845a924..e3c0cff21 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Setting.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Setting.java @@ -21,24 +21,25 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.model.core; -/** - * null:SettingType enumeration. - */ -public enum Setting implements com.intellij.util.xml.NamedEnum { - BOOLEAN("Boolean"), - DOUBLE("Double"), - INTEGER("Integer"), - STRING("String"); - - private final String value; - - Setting(final String value) { - this.value = value; - } - - @Override - public String getValue() { - return value; - } +import com.intellij.util.xml.DomElement; +import com.intellij.util.xml.GenericAttributeValue; +import com.intellij.util.xml.Required; +import org.jetbrains.annotations.NotNull; + +public interface Setting extends DomElement { + + @NotNull + @com.intellij.util.xml.Attribute("key") + @Required + GenericAttributeValue getKey(); + + @NotNull + @com.intellij.util.xml.Attribute("default-value") + GenericAttributeValue getDefaultValue(); + + @NotNull + @com.intellij.util.xml.Attribute("type") + GenericAttributeValue getType(); + } diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/SettingType.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/SettingType.java new file mode 100644 index 000000000..73963182d --- /dev/null +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/SettingType.java @@ -0,0 +1,44 @@ +/* + * 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 . + */ + +// Generated on Wed Jan 18 00:34:54 CET 2023 +// DTD/Schema : null + +package com.intellij.idea.plugin.hybris.system.cockpitng.model.core; + +/** + * null:SettingType enumeration. + */ +public enum SettingType implements com.intellij.util.xml.NamedEnum { + BOOLEAN("Boolean"), + DOUBLE("Double"), + INTEGER("Integer"), + STRING("String"); + + private final String value; + + SettingType(final String value) { + this.value = value; + } + + @Override + public String getValue() { + return value; + } + +} diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Settings.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Settings.java index 4dfd9e8fa..97f8b11bb 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Settings.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Settings.java @@ -22,7 +22,6 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.model.core; import com.intellij.util.xml.DomElement; -import com.intellij.util.xml.GenericDomValue; import com.intellij.util.xml.Required; import com.intellij.util.xml.SubTagList; import org.jetbrains.annotations.NotNull; @@ -40,7 +39,7 @@ public interface Settings extends DomElement { @NotNull @SubTagList("setting") @Required - java.util.List> getSettings(); + java.util.List getSettings(); /** * Adds new child to the list of setting children. @@ -48,7 +47,7 @@ public interface Settings extends DomElement { * @return created child */ @SubTagList("setting") - GenericDomValue addSetting(); + Setting addSetting(); } diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Socket.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Socket.java index 69a4e7336..9cac5985d 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Socket.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Socket.java @@ -24,11 +24,15 @@ import com.intellij.util.xml.DomElement; import com.intellij.util.xml.GenericAttributeValue; import com.intellij.util.xml.Required; +import com.intellij.util.xml.Stubbed; +import com.intellij.util.xml.StubbedOccurrence; import org.jetbrains.annotations.NotNull; /** * null:Socket interface. */ +@Stubbed +@StubbedOccurrence public interface Socket extends DomElement { /** diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Widget.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Widget.java index 5ce95c753..fbaf03778 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Widget.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/Widget.java @@ -21,11 +21,11 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.model.core; -import com.intellij.idea.plugin.hybris.system.cockpitng.util.xml.CngWidgetDefinitionIdConverter; -import com.intellij.util.xml.Convert; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.GenericAttributeValue; import com.intellij.util.xml.Required; +import com.intellij.util.xml.Stubbed; +import com.intellij.util.xml.StubbedOccurrence; import com.intellij.util.xml.SubTag; import com.intellij.util.xml.SubTagList; import org.jetbrains.annotations.NotNull; @@ -37,6 +37,8 @@ * Representation of widget instance. Widgets may be nested. * */ +@Stubbed +@StubbedOccurrence public interface Widget extends DomElement { /** @@ -66,7 +68,6 @@ public interface Widget extends DomElement { @NotNull @com.intellij.util.xml.Attribute("widgetDefinitionId") @Required - @Convert(CngWidgetDefinitionIdConverter.class) GenericAttributeValue getWidgetDefinitionId(); diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/WidgetSetting.java b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/WidgetSetting.java index 58060fe92..cd4745b4a 100644 --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/WidgetSetting.java +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/core/WidgetSetting.java @@ -35,22 +35,6 @@ */ public interface WidgetSetting extends DomElement { - /** - * Returns the value of the simple content. - * - * @return the value of the simple content. - */ - @NotNull - @Required - String getValue1(); - - /** - * Sets the value of the simple content. - * - * @param value1 the new value to set - */ - void setValue1(@NotNull String value1); - /** * Returns the value of the key child. @@ -66,7 +50,6 @@ public interface WidgetSetting extends DomElement { @Required GenericAttributeValue getKey(); - /** * Returns the value of the value child. *
    @@ -78,7 +61,7 @@ public interface WidgetSetting extends DomElement {
          */
         @NotNull
         @com.intellij.util.xml.Attribute("value")
    -    GenericAttributeValue getValue2();
    +    GenericAttributeValue getValue();
     
     
         /**
    @@ -92,7 +75,7 @@ public interface WidgetSetting extends DomElement {
          */
         @NotNull
         @com.intellij.util.xml.Attribute("type")
    -    GenericAttributeValue getType();
    +    GenericAttributeValue getType();
     
     
     }
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/CngPatterns.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/CngPatterns.kt
    index 64e41a4ca..129b2602a 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/CngPatterns.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/CngPatterns.kt
    @@ -23,32 +23,64 @@ import com.intellij.idea.plugin.hybris.common.utils.PsiXmlUtils
     import com.intellij.idea.plugin.hybris.system.cockpitng.CngConfigDomFileDescription
     import com.intellij.patterns.PlatformPatterns
     import com.intellij.patterns.StandardPatterns
    +import com.intellij.patterns.XmlAttributeValuePattern
     import com.intellij.patterns.XmlPatterns
     
     object CngPatterns {
    -    const val ROOT = "config"
    -    private const val CONTEXT = "context"
    -
    -    private val cngFile = PlatformPatterns.psiFile()
    +    const val CONFIG_ROOT = "config"
    +    const val WIDGETS_ROOT = "widgets"
    +    private const val CONFIG_CONTEXT = "context"
    +    private val cngConfigFile = PlatformPatterns.psiFile()
             .withName(StandardPatterns.string().endsWith(HybrisConstants.COCKPIT_NG_CONFIG_XML))
    +    private val cngWidgetsFile = PlatformPatterns.psiFile()
    +        .withName(StandardPatterns.string().endsWith(HybrisConstants.COCKPIT_NG_WIDGETS_XML))
    +
    +    val WIDGET_SETTING = widgetPattern("key", "setting")
    +
    +    val WIDGET_ID = XmlPatterns.or(
    +        widgetPattern("widgetId", "widget-extension"),
    +        widgetPattern("widgetId", "move"),
    +        widgetPattern("widgetId", "remove"),
    +        widgetPattern("targetWidgetId", "move")
    +    )
    +
    +    val WIDGET_CONNECTION_WIDGET_ID = XmlPatterns.or (
    +        widgetPattern("sourceWidgetId", "widget-connection"),
    +        widgetPattern("targetWidgetId", "widget-connection"),
    +        widgetPattern("sourceWidgetId", "widget-connection-remove"),
    +        widgetPattern("targetWidgetId", "widget-connection-remove"),
    +    )
    +
    +    val WIDGET_DEFINITION: XmlAttributeValuePattern = attributeValue(
    +        "widgetDefinitionId",
    +        "widget"
    +    )
    +        .inside(PsiXmlUtils.insideTagPattern(WIDGETS_ROOT))
    +
    +    val ACTION_DEFINITION = attributeValue(
    +        "action-id",
    +        "action"
    +    )
    +        .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +        .inFile(cngConfigFile)
     
         val EDITOR_DEFINITION = XmlPatterns.or(
             attributeValue(
                 "editor",
                 "field",
                 "advanced-search",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_ADVANCED_SEARCH
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_ADVANCED_SEARCH
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
             attributeValue(
                 "editor",
                 "attribute",
                 "editorArea",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile)
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile)
         )
     
         val ITEM_ATTRIBUTE = XmlPatterns.or(
    @@ -56,87 +88,87 @@ object CngPatterns {
                 "qualifier",
                 "column",
                 "list-view",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_LIST_VIEW
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_LIST_VIEW
             )
                 .inside(
    -                XmlPatterns.xmlTag().withLocalName(CONTEXT)
    +                XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT)
                         .andNot(XmlPatterns.xmlAttributeValue().withValue(StandardPatterns.string().oneOfIgnoreCase("."))),
                 )
    -            .inFile(cngFile),
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "qualifier",
                 "attribute",
                 "editorArea",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "name",
                 "field",
                 "advanced-search",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_ADVANCED_SEARCH
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_ADVANCED_SEARCH
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "name",
                 "field",
                 "simple-search",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_SIMPLE_SEARCH
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_SIMPLE_SEARCH
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile)
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile)
         )
     
         val FLOW_STEP_CONTENT_PROPERTY_QUALIFIER = attributeValue(
             "qualifier",
             "property",
             "property-list",
    -        CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG
    +        CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG
         )
    -        .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -        .inFile(cngFile)
    +        .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +        .inFile(cngConfigFile)
     
         val FLOW_INITIALIZE_TYPE = attributeValue(
             "type",
             "initialize",
             "prepare",
    -        CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG
    +        CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG
         )
    -        .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -        .inFile(cngFile)
    +        .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +        .inFile(cngConfigFile)
     
         val ITEM_TYPE = XmlPatterns.or(
    -        PsiXmlUtils.tagAttributeValuePattern(ROOT, CONTEXT, "type")
    +        PsiXmlUtils.tagAttributeValuePattern(CONFIG_ROOT, CONFIG_CONTEXT, "type")
                 .andNot(XmlPatterns.xmlAttributeValue().withValue(StandardPatterns.string().contains(".")))
    -            .inFile(cngFile),
    +            .inFile(cngConfigFile),
     
    -        PsiXmlUtils.tagAttributeValuePattern(ROOT, CONTEXT, "parent")
    +        PsiXmlUtils.tagAttributeValuePattern(CONFIG_ROOT, CONFIG_CONTEXT, "parent")
                 .andNot(XmlPatterns.xmlAttributeValue().withValue(StandardPatterns.string().oneOfIgnoreCase("auto", ".")))
    -            .inFile(cngFile),
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "type",
                 "property",
                 "content",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG
             )
                 .andNot(XmlPatterns.xmlAttributeValue().withValue(StandardPatterns.string().contains(".")))
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "code",
                 "type-node",
                 "explorer-tree",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_EXPLORER_TREE
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_EXPLORER_TREE
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile)
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile)
         )
     
         val SPRING_BEAN = XmlPatterns.or(
    @@ -144,82 +176,82 @@ object CngPatterns {
                 "spring-bean",
                 "mold",
                 "collection-browser",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_COLLECTION_BROWSER
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_COLLECTION_BROWSER
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "column",
                 "list-view",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_LIST_VIEW
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_LIST_VIEW
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "customPanel",
                 "editorArea",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "customSection",
                 "editorArea",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "customTab",
                 "editorArea",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_EDITOR_AREA
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_EDITOR_AREA
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "renderer",
                 "flow",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_CONFIG_WIZARD_CONFIG
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_CONFIG_WIZARD_CONFIG
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "renderer",
                 "compare-view",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_COMPARE_VIEW
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_COMPARE_VIEW
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "custom-attribute",
                 "summary-view",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_SUMMARY_VIEW
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_SUMMARY_VIEW
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile),
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile),
     
             attributeValue(
                 "spring-bean",
                 "additionalRenderer",
                 "grid-view",
    -            CngConfigDomFileDescription.NAMESPACE_COCKPITNG_COMPONENT_GRID_VIEW
    +            CngConfigDomFileDescription.NAMESPACE_COCKPIT_NG_COMPONENT_GRID_VIEW
             )
    -            .inside(XmlPatterns.xmlTag().withLocalName(CONTEXT))
    -            .inFile(cngFile)
    +            .inside(XmlPatterns.xmlTag().withLocalName(CONFIG_CONTEXT))
    +            .inFile(cngConfigFile)
         )
     
         private fun attributeValue(
    @@ -242,4 +274,39 @@ object CngPatterns {
                     )
             )
     
    +    private fun attributeValue(
    +        attribute: String,
    +        tag: String,
    +        wrappingTag: String,
    +    ) = XmlPatterns.xmlAttributeValue()
    +        .withParent(
    +            XmlPatterns.xmlAttribute()
    +                .withLocalName(attribute)
    +                .withParent(
    +                    XmlPatterns.xmlTag()
    +                        .withLocalName(tag)
    +                        .inside(
    +                            XmlPatterns.xmlTag()
    +                                .withLocalName(wrappingTag)
    +                        )
    +                )
    +        )
    +
    +    private fun attributeValue(
    +        attribute: String,
    +        tag: String,
    +    ) = XmlPatterns.xmlAttributeValue()
    +        .withParent(
    +            XmlPatterns.xmlAttribute()
    +                .withLocalName(attribute)
    +                .withParent(
    +                    XmlPatterns.xmlTag()
    +                        .withLocalName(tag)
    +                )
    +        )
    +
    +    private fun widgetPattern(attribute: String, tag: String) = attributeValue(attribute, tag)
    +        .inside(PsiXmlUtils.insideTagPattern(WIDGETS_ROOT))
    +        .inFile(cngWidgetsFile)
    +
     }
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/contributor/CngReferenceContributor.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/contributor/CngReferenceContributor.kt
    index bc4efa49d..1f2040877 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/contributor/CngReferenceContributor.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/contributor/CngReferenceContributor.kt
    @@ -19,7 +19,6 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.psi.contributor
     
     import com.intellij.idea.plugin.hybris.system.cockpitng.psi.CngPatterns
     import com.intellij.idea.plugin.hybris.system.cockpitng.psi.provider.*
    -import com.intellij.patterns.XmlPatterns
     import com.intellij.psi.PsiReferenceContributor
     import com.intellij.psi.PsiReferenceRegistrar
     
    @@ -46,5 +45,25 @@ class CngReferenceContributor : PsiReferenceContributor() {
                 CngPatterns.ITEM_ATTRIBUTE,
                 CngTSItemAttributeReferenceProvider.instance
             )
    +        registrar.registerReferenceProvider(
    +            CngPatterns.ACTION_DEFINITION,
    +            CngActionDefinitionReferenceProvider.instance
    +        )
    +        registrar.registerReferenceProvider(
    +            CngPatterns.WIDGET_ID,
    +            CngWidgetReferenceProvider.instance
    +        )
    +        registrar.registerReferenceProvider(
    +            CngPatterns.WIDGET_CONNECTION_WIDGET_ID,
    +            CngWidgetConnectionWidgetIdReferenceProvider.instance
    +        )
    +        registrar.registerReferenceProvider(
    +            CngPatterns.WIDGET_DEFINITION,
    +            CngWidgetDefinitionReferenceProvider.instance
    +        )
    +        registrar.registerReferenceProvider(
    +            CngPatterns.WIDGET_SETTING,
    +            CngWidgetSettingReferenceProvider.instance
    +        )
         }
     }
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngActionDefinitionReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngActionDefinitionReferenceProvider.kt
    new file mode 100644
    index 000000000..54a0c82bb
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngActionDefinitionReferenceProvider.kt
    @@ -0,0 +1,36 @@
    +/*
    + * 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.system.cockpitng.psi.provider
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngActionDefinitionReference
    +import com.intellij.openapi.application.ApplicationManager
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiReferenceProvider
    +import com.intellij.util.ProcessingContext
    +
    +class CngActionDefinitionReferenceProvider : PsiReferenceProvider() {
    +
    +    override fun getReferencesByElement(
    +        element: PsiElement, context: ProcessingContext
    +    ) = arrayOf(CngActionDefinitionReference(element))
    +
    +    companion object {
    +        val instance: PsiReferenceProvider = ApplicationManager.getApplication().getService(CngActionDefinitionReferenceProvider::class.java)
    +        private val regex = "(\\{)(.*?)(})|([,)\"])".toRegex()
    +    }
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetConnectionWidgetIdReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetConnectionWidgetIdReferenceProvider.kt
    new file mode 100644
    index 000000000..151b06e10
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetConnectionWidgetIdReferenceProvider.kt
    @@ -0,0 +1,40 @@
    +/*
    + * 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.system.cockpitng.psi.provider
    +
    +import com.intellij.idea.plugin.hybris.common.HybrisConstants
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngWidgetReference
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngWidgetStubReference
    +import com.intellij.openapi.application.ApplicationManager
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiReferenceProvider
    +import com.intellij.psi.xml.XmlAttributeValue
    +import com.intellij.util.ProcessingContext
    +
    +class CngWidgetConnectionWidgetIdReferenceProvider : PsiReferenceProvider() {
    +
    +    override fun getReferencesByElement(element: PsiElement, context: ProcessingContext) =
    +        if (element is XmlAttributeValue)
    +            if (element.value.startsWith(HybrisConstants.COCKPIT_NG_WIDGET_ID_STUB, true)) arrayOf(CngWidgetStubReference(element))
    +            else arrayOf(CngWidgetReference(element))
    +        else emptyArray()
    +
    +    companion object {
    +        val instance: PsiReferenceProvider = ApplicationManager.getApplication().getService(CngWidgetConnectionWidgetIdReferenceProvider::class.java)
    +    }
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetDefinitionReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetDefinitionReferenceProvider.kt
    new file mode 100644
    index 000000000..4a4f67864
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetDefinitionReferenceProvider.kt
    @@ -0,0 +1,35 @@
    +/*
    + * 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.system.cockpitng.psi.provider
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngWidgetDefinitionReference
    +import com.intellij.openapi.application.ApplicationManager
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiReferenceProvider
    +import com.intellij.util.ProcessingContext
    +
    +class CngWidgetDefinitionReferenceProvider : PsiReferenceProvider() {
    +
    +    override fun getReferencesByElement(
    +        element: PsiElement, context: ProcessingContext
    +    ) = arrayOf(CngWidgetDefinitionReference(element))
    +
    +    companion object {
    +        val instance: PsiReferenceProvider = ApplicationManager.getApplication().getService(CngWidgetDefinitionReferenceProvider::class.java)
    +    }
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetReferenceProvider.kt
    new file mode 100644
    index 000000000..b761547f8
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetReferenceProvider.kt
    @@ -0,0 +1,35 @@
    +/*
    + * 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.system.cockpitng.psi.provider
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngWidgetReference
    +import com.intellij.openapi.application.ApplicationManager
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiReferenceProvider
    +import com.intellij.util.ProcessingContext
    +
    +class CngWidgetReferenceProvider : PsiReferenceProvider() {
    +
    +    override fun getReferencesByElement(
    +        element: PsiElement, context: ProcessingContext
    +    ) = arrayOf(CngWidgetReference(element))
    +
    +    companion object {
    +        val instance: PsiReferenceProvider = ApplicationManager.getApplication().getService(CngWidgetReferenceProvider::class.java)
    +    }
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetSettingReferenceProvider.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetSettingReferenceProvider.kt
    new file mode 100644
    index 000000000..83b8fb8ff
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/provider/CngWidgetSettingReferenceProvider.kt
    @@ -0,0 +1,35 @@
    +/*
    + * 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.system.cockpitng.psi.provider
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.CngWidgetSettingReference
    +import com.intellij.openapi.application.ApplicationManager
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiReferenceProvider
    +import com.intellij.util.ProcessingContext
    +
    +class CngWidgetSettingReferenceProvider : PsiReferenceProvider() {
    +
    +    override fun getReferencesByElement(
    +        element: PsiElement, context: ProcessingContext
    +    ) = arrayOf(CngWidgetSettingReference(element))
    +
    +    companion object {
    +        val instance: PsiReferenceProvider = ApplicationManager.getApplication().getService(CngWidgetSettingReferenceProvider::class.java)
    +    }
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngActionDefinitionReference.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngActionDefinitionReference.kt
    new file mode 100644
    index 000000000..4dfe34140
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngActionDefinitionReference.kt
    @@ -0,0 +1,36 @@
    +/*
    + * 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.system.cockpitng.psi.reference
    +
    +import com.intellij.codeInsight.highlighting.HighlightedReference
    +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.ActionDefinitionResolveResult
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiPolyVariantReference
    +import com.intellij.psi.PsiReferenceBase
    +
    +class CngActionDefinitionReference(element: PsiElement) : PsiReferenceBase.Poly(element),
    +    PsiPolyVariantReference, HighlightedReference {
    +
    +    override fun multiResolve(incompleteCode: Boolean) = CngMetaModelAccess.getInstance(element.project).getMetaModel()
    +        .actionDefinitions[value]
    +        ?.retrieveDom()
    +        ?.let { arrayOf(ActionDefinitionResolveResult(it)) }
    +        ?: emptyArray()
    +}
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngEditorDefinitionReference.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngEditorDefinitionReference.kt
    index 818d91376..f3c392680 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngEditorDefinitionReference.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngEditorDefinitionReference.kt
    @@ -20,21 +20,18 @@ package com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference
     
     import com.intellij.codeInsight.highlighting.HighlightedReference
     import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.EditorDefinitionResolveResult
     import com.intellij.openapi.util.TextRange
     import com.intellij.psi.PsiElement
    -import com.intellij.psi.PsiElementResolveResult
     import com.intellij.psi.PsiPolyVariantReference
     import com.intellij.psi.PsiReferenceBase
     
    -open class CngEditorDefinitionReference(element: PsiElement, textRange: TextRange) : PsiReferenceBase.Poly(element, textRange, false),
    +class CngEditorDefinitionReference(element: PsiElement, textRange: TextRange) : PsiReferenceBase.Poly(element, textRange, false),
         PsiPolyVariantReference, HighlightedReference {
     
         override fun multiResolve(incompleteCode: Boolean) = CngMetaModelAccess.getInstance(element.project).getMetaModel()
             .editorDefinitions[value]
             ?.retrieveDom()
    -        ?.id
    -        ?.xmlAttributeValue
    -        ?.navigationElement
    -        ?.let { arrayOf(PsiElementResolveResult(it)) }
    +        ?.let { arrayOf(EditorDefinitionResolveResult(it)) }
             ?: emptyArray()
     }
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngActionDefinitionIdConverter.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetDefinitionReference.kt
    similarity index 51%
    rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngActionDefinitionIdConverter.kt
    rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetDefinitionReference.kt
    index c096ec313..a2de1fbaa 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngActionDefinitionIdConverter.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetDefinitionReference.kt
    @@ -16,30 +16,27 @@
      * along with this program. If not, see .
      */
     
    -package com.intellij.idea.plugin.hybris.system.cockpitng.util.xml
    +package com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference
     
    +import com.intellij.codeInsight.highlighting.HighlightedReference
     import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    -import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.ActionDefinition
    -import com.intellij.util.xml.ConvertContext
    -import com.intellij.util.xml.ResolvingConverter
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.WidgetDefinitionResolveResult
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiPolyVariantReference
    +import com.intellij.psi.PsiReferenceBase
    +import com.intellij.psi.ResolveResult
     
    -class CngActionDefinitionIdConverter : ResolvingConverter() {
    +class CngWidgetDefinitionReference(element: PsiElement) : PsiReferenceBase.Poly(element), PsiPolyVariantReference,
    +    HighlightedReference {
     
    -    override fun toString(t: ActionDefinition?, context: ConvertContext?) = t?.id?.stringValue
    +    override fun multiResolve(incompleteCode: Boolean): Array {
    +        val lookingForName = value
     
    -    override fun fromString(s: String?, context: ConvertContext): ActionDefinition? {
    -        if (s == null) return null
    -
    -        return CngMetaModelAccess.getInstance(context.project).getMetaModel()
    -            .actionDefinitions[s]
    +        return CngMetaModelAccess.getInstance(element.project).getMetaModel()
    +            .widgetDefinitions[lookingForName]
                 ?.retrieveDom()
    +            ?.let { arrayOf(WidgetDefinitionResolveResult(it)) }
    +            ?: emptyArray()
         }
     
    -    override fun getVariants(context: ConvertContext): Collection {
    -        return CngMetaModelAccess.getInstance(context.project).getMetaModel()
    -            .actionDefinitions
    -            .values
    -            .mapNotNull { it.retrieveDom() }
    -    }
    -
    -}
    \ No newline at end of file
    +}
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetReference.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetReference.kt
    new file mode 100644
    index 000000000..89a87911f
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetReference.kt
    @@ -0,0 +1,47 @@
    +/*
    + * 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.system.cockpitng.psi.reference
    +
    +import com.intellij.codeInsight.highlighting.HighlightedReference
    +import com.intellij.idea.plugin.hybris.impex.psi.references.result.EnumResolveResult
    +import com.intellij.idea.plugin.hybris.impex.psi.references.result.ItemResolveResult
    +import com.intellij.idea.plugin.hybris.impex.psi.references.result.RelationResolveResult
    +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.WidgetResolveResult
    +import com.intellij.idea.plugin.hybris.system.type.meta.model.TSGlobalMetaEnum
    +import com.intellij.idea.plugin.hybris.system.type.meta.model.TSGlobalMetaItem
    +import com.intellij.idea.plugin.hybris.system.type.meta.model.TSGlobalMetaRelation
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiPolyVariantReference
    +import com.intellij.psi.PsiReferenceBase
    +import com.intellij.psi.ResolveResult
    +
    +class CngWidgetReference(element: PsiElement) : PsiReferenceBase.Poly(element), PsiPolyVariantReference, HighlightedReference {
    +
    +    override fun multiResolve(incompleteCode: Boolean): Array {
    +        val lookingForName = value
    +
    +        return CngMetaModelAccess.getInstance(element.project).getMetaModel()
    +            .widgets[lookingForName]
    +            ?.retrieveDom()
    +            ?.let { arrayOf(WidgetResolveResult(it)) }
    +            ?: emptyArray()
    +    }
    +
    +}
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetSettingReference.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetSettingReference.kt
    new file mode 100644
    index 000000000..da9ead4a3
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetSettingReference.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.system.cockpitng.psi.reference
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.WidgetSettingResolveResult
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiPolyVariantReference
    +import com.intellij.psi.PsiReferenceBase
    +import com.intellij.psi.ResolveResult
    +import com.intellij.psi.util.parentsOfType
    +import com.intellij.psi.xml.XmlTag
    +
    +/**
    + * See https://help.sap.com/docs/SAP_COMMERCE/5c9ea0c629214e42b727bf08800d8dfa/76d2195f994a47f593a2732ef99c91d3.html?locale=en-US&q=socket
    + */
    +class CngWidgetSettingReference(element: PsiElement) : PsiReferenceBase.Poly(element, true), PsiPolyVariantReference {
    +
    +    override fun multiResolve(incompleteCode: Boolean): Array {
    +        val lookingForName = value
    +        val widgetDefinitionId = element.parentsOfType()
    +            .firstOrNull { it.localName == "widget" }
    +            ?.getAttributeValue("widgetDefinitionId")
    +            ?: return emptyArray()
    +
    +        return CngMetaModelAccess.getInstance(element.project).getMetaModel()
    +            .widgetDefinitions[widgetDefinitionId]
    +            ?.settings?.get(lookingForName)
    +            ?.retrieveDom()
    +            ?.let { arrayOf(WidgetSettingResolveResult(it)) }
    +            ?: emptyArray()
    +    }
    +
    +}
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetStubReference.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetStubReference.kt
    new file mode 100644
    index 000000000..66cbcf310
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/CngWidgetStubReference.kt
    @@ -0,0 +1,51 @@
    +/*
    + * 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.system.cockpitng.psi.reference
    +
    +import com.intellij.codeInsight.highlighting.HighlightedReference
    +import com.intellij.idea.plugin.hybris.common.HybrisConstants
    +import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.ActionDefinitionResolveResult
    +import com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result.EditorDefinitionResolveResult
    +import com.intellij.openapi.util.TextRange
    +import com.intellij.psi.PsiElement
    +import com.intellij.psi.PsiPolyVariantReference
    +import com.intellij.psi.PsiReferenceBase
    +import com.intellij.psi.ResolveResult
    +
    +class CngWidgetStubReference(element: PsiElement) : PsiReferenceBase.Poly(element), PsiPolyVariantReference, HighlightedReference {
    +
    +    override fun calculateDefaultRangeInElement() = TextRange.from(stubLength + 1, element.textLength - stubLength - HybrisConstants.QUOTE_LENGTH)
    +
    +    override fun multiResolve(incompleteCode: Boolean): Array {
    +        val metaModel = CngMetaModelAccess.getInstance(element.project).getMetaModel()
    +        return metaModel
    +            .editorDefinitions[value]
    +            ?.retrieveDom()
    +            ?.let { arrayOf(EditorDefinitionResolveResult(it)) }
    +            ?: metaModel.actionDefinitions[value]
    +                ?.retrieveDom()
    +                ?.let { arrayOf(ActionDefinitionResolveResult(it)) }
    +            ?: emptyArray()
    +    }
    +
    +    companion object {
    +        private const val stubLength = HybrisConstants.COCKPIT_NG_WIDGET_ID_STUB.length
    +    }
    +}
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/ActionDefinitionResolveResult.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/ActionDefinitionResolveResult.kt
    new file mode 100644
    index 000000000..424e3528e
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/ActionDefinitionResolveResult.kt
    @@ -0,0 +1,27 @@
    +/*
    + * 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.system.cockpitng.psi.reference.result
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.ActionDefinition
    +import com.intellij.psi.ResolveResult
    +
    +class ActionDefinitionResolveResult(private val myDom: ActionDefinition) : ResolveResult {
    +    override fun getElement() = myDom.id.xmlAttributeValue
    +    override fun isValidResult() = element != null
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/EditorDefinitionResolveResult.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/EditorDefinitionResolveResult.kt
    new file mode 100644
    index 000000000..185d8c7ab
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/EditorDefinitionResolveResult.kt
    @@ -0,0 +1,28 @@
    +/*
    + * 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.system.cockpitng.psi.reference.result
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.EditorDefinition
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widget
    +import com.intellij.psi.ResolveResult
    +
    +class EditorDefinitionResolveResult(private val myDom: EditorDefinition) : ResolveResult {
    +    override fun getElement() = myDom.id.xmlAttributeValue
    +    override fun isValidResult() = element != null
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetDefinitionResolveResult.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetDefinitionResolveResult.kt
    new file mode 100644
    index 000000000..e22fe47ee
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetDefinitionResolveResult.kt
    @@ -0,0 +1,27 @@
    +/*
    + * 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.system.cockpitng.psi.reference.result
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetDefinition
    +import com.intellij.psi.ResolveResult
    +
    +class WidgetDefinitionResolveResult(private val myDom: WidgetDefinition) : ResolveResult {
    +    override fun getElement() = myDom.id.xmlAttributeValue
    +    override fun isValidResult() = element != null
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/ConfigGenericAttributeValue.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetResolveResult.kt
    similarity index 68%
    rename from src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/ConfigGenericAttributeValue.kt
    rename to src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetResolveResult.kt
    index 0d274282a..5b011cceb 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/model/config/ConfigGenericAttributeValue.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetResolveResult.kt
    @@ -16,11 +16,12 @@
      * along with this program. If not, see .
      */
     
    -package com.intellij.idea.plugin.hybris.system.cockpitng.model.config
    +package com.intellij.idea.plugin.hybris.system.cockpitng.psi.reference.result
     
    -import com.intellij.idea.plugin.hybris.common.HybrisConstants
    -import com.intellij.util.xml.GenericAttributeValue
    -import com.intellij.util.xml.Namespace
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Widget
    +import com.intellij.psi.ResolveResult
     
    -@Namespace(HybrisConstants.COCKPIT_NG_NAMESPACE_KEY)
    -interface ConfigGenericAttributeValue : GenericAttributeValue
    \ No newline at end of file
    +class WidgetResolveResult(private val myDom: Widget) : ResolveResult {
    +    override fun getElement() = myDom.id.xmlAttributeValue
    +    override fun isValidResult() = element != null
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetSettingResolveResult.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetSettingResolveResult.kt
    new file mode 100644
    index 000000000..48f5908b4
    --- /dev/null
    +++ b/src/com/intellij/idea/plugin/hybris/system/cockpitng/psi/reference/result/WidgetSettingResolveResult.kt
    @@ -0,0 +1,27 @@
    +/*
    + * 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.system.cockpitng.psi.reference.result
    +
    +import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.Setting
    +import com.intellij.psi.ResolveResult
    +
    +class WidgetSettingResolveResult(private val myDom: Setting) : ResolveResult {
    +    override fun getElement() = myDom.key.xmlAttributeValue
    +    override fun isValidResult() = element != null
    +}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngWidgetDefinitionIdConverter.kt b/src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngWidgetDefinitionIdConverter.kt
    deleted file mode 100644
    index af1e38023..000000000
    --- a/src/com/intellij/idea/plugin/hybris/system/cockpitng/util/xml/CngWidgetDefinitionIdConverter.kt
    +++ /dev/null
    @@ -1,45 +0,0 @@
    -/*
    - * 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.system.cockpitng.util.xml
    -
    -import com.intellij.idea.plugin.hybris.system.cockpitng.meta.CngMetaModelAccess
    -import com.intellij.idea.plugin.hybris.system.cockpitng.model.core.WidgetDefinition
    -import com.intellij.util.xml.ConvertContext
    -import com.intellij.util.xml.ResolvingConverter
    -
    -class CngWidgetDefinitionIdConverter : ResolvingConverter() {
    -
    -    override fun toString(t: WidgetDefinition?, context: ConvertContext?) = t?.id?.stringValue
    -
    -    override fun fromString(s: String?, context: ConvertContext): WidgetDefinition? {
    -        if (s == null) return null
    -
    -        return CngMetaModelAccess.getInstance(context.project).getMetaModel()
    -            .widgetDefinitions[s]
    -            ?.retrieveDom()
    -    }
    -
    -    override fun getVariants(context: ConvertContext): Collection {
    -        return CngMetaModelAccess.getInstance(context.project).getMetaModel()
    -            .widgetDefinitions
    -            .values
    -            .mapNotNull { it.retrieveDom() }
    -    }
    -
    -}
    \ No newline at end of file
    diff --git a/src/com/intellij/idea/plugin/hybris/system/type/meta/impl/TSMetaModelAccessImpl.kt b/src/com/intellij/idea/plugin/hybris/system/type/meta/impl/TSMetaModelAccessImpl.kt
    index 566ff8253..9e3527be6 100644
    --- a/src/com/intellij/idea/plugin/hybris/system/type/meta/impl/TSMetaModelAccessImpl.kt
    +++ b/src/com/intellij/idea/plugin/hybris/system/type/meta/impl/TSMetaModelAccessImpl.kt
    @@ -75,14 +75,13 @@ class TSMetaModelAccessImpl(private val myProject: Project) : TSMetaModelAccess
         )
     
         override fun getMetaModel(): TSGlobalMetaModel {
    -        return DumbService.getInstance(myProject).tryRunReadActionInSmartMode(
    +        return DumbService.getInstance(myProject).runReadActionInSmartMode(
                 Computable {
                     if (myGlobalMetaModel.hasUpToDateValue() || lock.isWriteLocked || writeLock.isHeldByCurrentThread) {
                         return@Computable readMetaModelWithLock()
                     }
                     return@Computable writeMetaModelWithLock()
    -            },
    -            "Computing Type System"
    +            }
             ) ?: throw ProcessCanceledException()
         }
     
    diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/components/BSTreePanel.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/components/BSTreePanel.kt
    index 1a0531320..5daef8655 100644
    --- a/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/components/BSTreePanel.kt
    +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/components/BSTreePanel.kt
    @@ -57,16 +57,11 @@ class BSTreePanel(
             secondComponent = myDefaultPanel
     
             myTree.addTreeSelectionListener(myTreeSelectionListener)
    -
    -        myProject.messageBus.connect(this).subscribe(BSMetaModelAccessImpl.topic, object : BSChangeListener {
    -            override fun beanSystemChanged(globalMetaModel: BSGlobalMetaModel) {
    -                secondComponent = myDefaultPanel;
    -                myTree.update(BSViewSettings.ChangeType.FULL)
    -            }
    -        })
         }
     
         fun update(changeType: BSViewSettings.ChangeType) {
    +        secondComponent = myDefaultPanel;
    +
             myTree.update(changeType)
         }
     
    diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/view/BSView.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/view/BSView.kt
    index 20a431aa1..164ef3303 100644
    --- a/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/view/BSView.kt
    +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/system/bean/view/BSView.kt
    @@ -21,8 +21,10 @@ package com.intellij.idea.plugin.hybris.toolwindow.system.bean.view
     import com.intellij.icons.AllIcons
     import com.intellij.ide.IdeBundle
     import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils.message
    +import com.intellij.idea.plugin.hybris.system.bean.meta.BSChangeListener
    +import com.intellij.idea.plugin.hybris.system.bean.meta.BSGlobalMetaModel
    +import com.intellij.idea.plugin.hybris.system.bean.meta.impl.BSMetaModelAccessImpl
     import com.intellij.idea.plugin.hybris.toolwindow.system.bean.components.BSTreePanel
    -import com.intellij.idea.plugin.hybris.toolwindow.system.type.view.TSViewSettings
     import com.intellij.openapi.Disposable
     import com.intellij.openapi.actionSystem.ActionManager
     import com.intellij.openapi.actionSystem.DefaultActionGroup
    @@ -53,14 +55,8 @@ class BSView(val myProject: Project) : SimpleToolWindowPanel(false, true), Dispo
                 setContent(panel)
             }
     
    -        DumbService.getInstance(myProject).runWhenSmart {
    -            setContent(myTreePane);
    -
    -            Disposer.register(this, myTreePane)
    -            myTreePane.update(BSViewSettings.ChangeType.FULL)
    -
    -            installSettingsListener()
    -        }
    +        Disposer.register(this, myTreePane)
    +        installSettingsListener()
         }
     
         private fun installToolbar() {
    @@ -78,6 +74,15 @@ class BSView(val myProject: Project) : SimpleToolWindowPanel(false, true), Dispo
                     myTreePane.update(changeType)
                 }
             })
    +        myProject.messageBus.connect(this).subscribe(BSMetaModelAccessImpl.topic, object : BSChangeListener {
    +            override fun beanSystemChanged(globalMetaModel: BSGlobalMetaModel) {
    +                myTreePane.update(BSViewSettings.ChangeType.FULL)
    +
    +                if (content != myTreePane) {
    +                    setContent(myTreePane)
    +                }
    +            }
    +        })
         }
     
         private fun initBeansViewActionGroup(): DefaultActionGroup = with(
    diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/components/TSTreePanel.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/components/TSTreePanel.kt
    index e0a953707..e5dc8cd33 100644
    --- a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/components/TSTreePanel.kt
    +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/components/TSTreePanel.kt
    @@ -52,16 +52,11 @@ class TSTreePanel(
             secondComponent = myDefaultPanel
     
             myTree.addTreeSelectionListener(myTreeSelectionListener)
    -
    -        myProject.messageBus.connect(this).subscribe(TSMetaModelAccessImpl.topic, object : TSChangeListener {
    -            override fun typeSystemChanged(globalMetaModel: TSGlobalMetaModel) {
    -                secondComponent = myDefaultPanel;
    -                myTree.update(TSViewSettings.ChangeType.FULL)
    -            }
    -        })
         }
     
         fun update(changeType: TSViewSettings.ChangeType) {
    +        secondComponent = myDefaultPanel;
    +
             myTree.update(changeType)
         }
     
    diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/tree/TSTreeModel.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/tree/TSTreeModel.kt
    index 58facbc98..1ca73c87e 100644
    --- a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/tree/TSTreeModel.kt
    +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/tree/TSTreeModel.kt
    @@ -52,9 +52,13 @@ class TSTreeModel(private val root: TSNode)
             treeNodesChanged(null, null, null)
         }
     
    -    class Node(private val node : TSNode?) : DefaultMutableTreeNode(node) {
    +    class Node(private val node: TSNode?) : DefaultMutableTreeNode(node) {
     
             override fun toString() = node.toString()
    +
    +        companion object {
    +            private const val serialVersionUID: Long = -4729552031003080261L
    +        }
         }
     
         override fun getInvoker() = myInvoker
    diff --git a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/view/TSView.kt b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/view/TSView.kt
    index c6601c140..11c9ab2a1 100644
    --- a/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/view/TSView.kt
    +++ b/src/com/intellij/idea/plugin/hybris/toolwindow/system/type/view/TSView.kt
    @@ -21,6 +21,9 @@ package com.intellij.idea.plugin.hybris.toolwindow.system.type.view
     import com.intellij.icons.AllIcons
     import com.intellij.ide.IdeBundle
     import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils.message
    +import com.intellij.idea.plugin.hybris.system.type.meta.TSChangeListener
    +import com.intellij.idea.plugin.hybris.system.type.meta.TSGlobalMetaModel
    +import com.intellij.idea.plugin.hybris.system.type.meta.impl.TSMetaModelAccessImpl
     import com.intellij.idea.plugin.hybris.toolwindow.system.type.components.TSTreePanel
     import com.intellij.openapi.Disposable
     import com.intellij.openapi.actionSystem.ActionManager
    @@ -52,14 +55,8 @@ class TSView(val myProject: Project) : SimpleToolWindowPanel(false, true), Dispo
                 setContent(panel)
             }
     
    -        DumbService.getInstance(myProject).runWhenSmart {
    -            setContent(myTreePane);
    -
    -            Disposer.register(this, myTreePane)
    -            myTreePane.update(TSViewSettings.ChangeType.FULL)
    -
    -            installSettingsListener()
    -        }
    +        Disposer.register(this, myTreePane)
    +        installSettingsListener()
         }
     
         private fun installToolbar() {
    @@ -77,6 +74,15 @@ class TSView(val myProject: Project) : SimpleToolWindowPanel(false, true), Dispo
                     myTreePane.update(changeType)
                 }
             })
    +        myProject.messageBus.connect(this).subscribe(TSMetaModelAccessImpl.topic, object : TSChangeListener {
    +            override fun typeSystemChanged(globalMetaModel: TSGlobalMetaModel) {
    +                myTreePane.update(TSViewSettings.ChangeType.FULL)
    +
    +                if (content != myTreePane) {
    +                    setContent(myTreePane)
    +                }
    +            }
    +        })
         }
     
         private fun initItemsViewActionGroup(): DefaultActionGroup = with(