From 27c9281945a5e149af2886182472fcb8bb35a1d5 Mon Sep 17 00:00:00 2001
From: Mykhailo Lytvyn <>
Date: Fri, 24 Mar 2023 13:40:52 +0100
Subject: [PATCH] Added node type specific icons for Business Process code
completion
---
resources/META-INF/plugin-release-info.xml | 3 +-
.../util/xml/BpNavigableElementConverter.kt | 45 ++++++++++++++++++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/resources/META-INF/plugin-release-info.xml b/resources/META-INF/plugin-release-info.xml
index 4dac63b48..2c6d80605 100644
--- a/resources/META-INF/plugin-release-info.xml
+++ b/resources/META-INF/plugin-release-info.xml
@@ -118,12 +118,13 @@
Feature: Added Context Parameters node (#283)
+ Feature: Added node type specific icons for Business Process code completion (#296)
Feature: Added navigation to generated Item and Enum classes from the items.xml
(#284)
Feature: Added navigation to generated Enum Values fields from the items.xml
(#285)
Feature: Improved PSI cache usage (#258)
Feature: Improved performance of the Global Meta Model and TS LineMarker (#257)
Feature: IDEA modules by default will be stored in the /.idea/idea-modules
(#259)
- Feature: Added collapse/expand all actions for TS and BS views (#262)
+ Feature: Added "collapse all"/"expand all" actions for TS and BS views (#262)
Feature: Added sld.enabled
modifier support for Impex type (#290)
Feature: Added Line Marker Provider settings and unified API usage (#294)
Feature: Added navigation to Bean siblings in the beans.xml
(#295)
diff --git a/src/com/intellij/idea/plugin/hybris/system/businessProcess/util/xml/BpNavigableElementConverter.kt b/src/com/intellij/idea/plugin/hybris/system/businessProcess/util/xml/BpNavigableElementConverter.kt
index d31161696..a5b72ced5 100644
--- a/src/com/intellij/idea/plugin/hybris/system/businessProcess/util/xml/BpNavigableElementConverter.kt
+++ b/src/com/intellij/idea/plugin/hybris/system/businessProcess/util/xml/BpNavigableElementConverter.kt
@@ -18,8 +18,11 @@
package com.intellij.idea.plugin.hybris.system.businessProcess.util.xml
+import com.intellij.codeInsight.lookup.LookupElement
+import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.idea.plugin.hybris.common.HybrisConstants
-import com.intellij.idea.plugin.hybris.system.businessProcess.model.NavigableElement
+import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons
+import com.intellij.idea.plugin.hybris.system.businessProcess.model.*
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.xml.XmlTag
@@ -52,6 +55,46 @@ class BpNavigableElementConverter : ResolvingConverter() {
override fun getPsiElement(dom: NavigableElement?) = dom?.getId()?.xmlAttributeValue
+ override fun createLookupElement(dom: NavigableElement?): LookupElement? {
+ val id = dom?.getId()?.stringValue ?: return null
+
+ return when (dom) {
+ is Process -> LookupElementBuilder.create(id)
+ .withTypeText("Process", true)
+ .withIcon(HybrisIcons.BUSINESS_PROCESS)
+
+ is ScriptAction -> LookupElementBuilder.create(id)
+ .withTypeText("Script Action", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_SCRIPT)
+
+ is Action -> LookupElementBuilder.create(id)
+ .withTypeText("Action", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_ACTION)
+
+ is Split -> LookupElementBuilder.create(id)
+ .withTypeText("Split", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_SPLIT)
+
+ is Wait -> LookupElementBuilder.create(id)
+ .withTypeText("Wait", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_WAIT)
+
+ is Join -> LookupElementBuilder.create(id)
+ .withTypeText("Join", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_JOIN)
+
+ is End -> LookupElementBuilder.create(id)
+ .withTypeText("End", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_END)
+
+ is Notify -> LookupElementBuilder.create(id)
+ .withTypeText("Notify", true)
+ .withIcon(HybrisIcons.BP_DIAGRAM_NOTIFY)
+
+ else -> null
+ }
+ }
+
companion object {
private val filter: (PsiElement) -> Boolean = { el ->
el is XmlTag && HybrisConstants.BP_NAVIGABLE_ELEMENTS.contains(el.name)