Skip to content

Commit

Permalink
#297 | Added node type specific icons for Business Process code compl…
Browse files Browse the repository at this point in the history
…etion
  • Loading branch information
mlytvyn authored Mar 24, 2023
1 parent bb2a0b2 commit 0b05517
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion resources/META-INF/plugin-release-info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@
<li><i>Feature:</i> Added Context Parameters node (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/283" target="_blank" rel="nofollow">#283</a>)</li>
</ul>
</li>
<li><i>Feature:</i> Added node type specific icons for Business Process code completion (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/296" target="_blank" rel="nofollow">#296</a>)</li>
<li><i>Feature:</i> Added navigation to generated Item and Enum classes from the <code>items.xml</code> (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/284" target="_blank" rel="nofollow">#284</a>)</li>
<li><i>Feature:</i> Added navigation to generated Enum Values fields from the <code>items.xml</code> (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/285" target="_blank" rel="nofollow">#285</a>)</li>
<li><i>Feature:</i> Improved PSI cache usage (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/258" target="_blank" rel="nofollow">#258</a>)</li>
<li><i>Feature:</i> Improved performance of the Global Meta Model and TS LineMarker (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/257" target="_blank" rel="nofollow">#257</a>)</li>
<li><i>Feature:</i> IDEA modules by default will be stored in the <code>/.idea/idea-modules</code> (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/259" target="_blank" rel="nofollow">#259</a>)</li>
<li><i>Feature:</i> Added collapse/expand all actions for TS and BS views (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/262" target="_blank" rel="nofollow">#262</a>)</li>
<li><i>Feature:</i> Added "collapse all"/"expand all" actions for TS and BS views (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/262" target="_blank" rel="nofollow">#262</a>)</li>
<li><i>Feature:</i> Added <code>sld.enabled</code> modifier support for Impex type (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/290" target="_blank" rel="nofollow">#290</a>)</li>
<li><i>Feature:</i> Added Line Marker Provider settings and unified API usage (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/294" target="_blank" rel="nofollow">#294</a>)</li>
<li><i>Feature:</i> Added navigation to Bean siblings in the <code>beans.xml</code> (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/295" target="_blank" rel="nofollow">#295</a>)</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,6 +55,46 @@ class BpNavigableElementConverter : ResolvingConverter<NavigableElement>() {

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)
Expand Down

0 comments on commit 0b05517

Please sign in to comment.