Skip to content

Commit

Permalink
#688 | New UI Tool Window Icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mlytvyn authored Sep 4, 2023
1 parent fdb3cf5 commit 0812154
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

### Other
- Added VCS issue navigation for IntelliJ [#665](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/665)
- New UI Tool Window Icons ([sdk docs](https://plugins.jetbrains.com/docs/intellij/work-with-icons-and-images.html#new-ui-tool-window-icons)) [#688](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/688)

## [2023.2.7]

Expand Down
2 changes: 1 addition & 1 deletion resources/META-INF/plugin-internal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
key="hybris.settings.project.remote_instances.title"
provider="com.intellij.idea.plugin.hybris.settings.HybrisProjectRemoteInstancesSettingsConfigurableProvider"/>

<toolWindow id="SAP Commerce" icon="/icons/toolWindowHybrisIcon.svg" anchor="bottom"
<toolWindow id="SAP Commerce" icon="/icons/toolWindow.svg" anchor="bottom"
factoryClass="com.intellij.idea.plugin.hybris.toolwindow.HybrisToolWindowFactory"/>

<applicationService serviceImplementation="com.intellij.idea.plugin.hybris.project.configurators.impl.DummySpringConfigurator"/>
Expand Down
File renamed without changes
10 changes: 10 additions & 0 deletions resources/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/icons/toolWindow@20x20_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@

package com.intellij.idea.plugin.hybris.system.extensioninfo.codeInsight.lookup

import com.intellij.codeInsight.completion.PrioritizedLookupElement
import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons
import com.intellij.idea.plugin.hybris.facet.ExtensionDescriptor
import com.intellij.idea.plugin.hybris.project.descriptors.ModuleDescriptorType

object EiSLookupElementFactory {

fun build(it: ExtensionDescriptor) = LookupElementBuilder.create(it.name)
.withTailText(tail(it), true)
.withTypeText(it.type.name, true)
fun build(ed: ExtensionDescriptor) = LookupElementBuilder.create(ed.name)
.withTailText(tail(ed), true)
.withTypeText(ed.type.name, true)
.withIcon(
when (it.type) {
when (ed.type) {
ModuleDescriptorType.CCV2 -> HybrisIcons.EXTENSION_CLOUD
ModuleDescriptorType.CUSTOM -> HybrisIcons.EXTENSION_CUSTOM
ModuleDescriptorType.EXT -> HybrisIcons.EXTENSION_EXT
Expand All @@ -38,6 +39,18 @@ object EiSLookupElementFactory {
else -> null
}
)
.let {
PrioritizedLookupElement.withPriority(
it,
when (ed.type) {
ModuleDescriptorType.CUSTOM -> 5.0
ModuleDescriptorType.CCV2 -> 4.0
ModuleDescriptorType.OOTB -> 3.0
ModuleDescriptorType.EXT -> 2.0
else -> 1.0
}
)
}

private fun tail(extensionDescriptor: ExtensionDescriptor): String? {
val tail = listOfNotNull(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ import com.intellij.openapi.project.Project
class TemplateExtensionNameCompletionProvider : ExtensionNameCompletionProvider() {

override fun getExtensionDescriptors(parameters: CompletionParameters, project: Project) = HybrisProjectSettingsComponent.getInstance(project)
.getAvailableExtensions()
.values
.filter { it.extGenTemplateExtension }
.toList()
.getAvailableExtensions()
.values
.filter { it.extGenTemplateExtension }
.toList()

companion object {
val instance: CompletionProvider<CompletionParameters> =
ApplicationManager.getApplication().getService(TemplateExtensionNameCompletionProvider::class.java)
val instance: CompletionProvider<CompletionParameters> = ApplicationManager.getApplication().getService(TemplateExtensionNameCompletionProvider::class.java)
}
}

0 comments on commit 0812154

Please sign in to comment.