|
5 | 5 |
|
6 | 6 | package com.microsoft.azure.toolkit.intellij.keyvault.code.spring; |
7 | 7 |
|
| 8 | +import com.intellij.icons.AllIcons; |
8 | 9 | import com.intellij.openapi.module.ModuleUtil; |
9 | 10 | import com.intellij.openapi.util.TextRange; |
10 | 11 | import com.intellij.psi.PsiElement; |
11 | 12 | import com.intellij.psi.PsiReferenceBase; |
12 | 13 | import com.intellij.psi.SyntheticElement; |
13 | 14 | import com.intellij.psi.impl.FakePsiElement; |
14 | 15 | import com.microsoft.azure.toolkit.ide.common.component.AzureResourceIconProvider; |
| 16 | +import com.microsoft.azure.toolkit.ide.common.icon.AzureIcons; |
15 | 17 | import com.microsoft.azure.toolkit.intellij.common.IntelliJAzureIcons; |
16 | 18 | import com.microsoft.azure.toolkit.intellij.connector.Connection; |
17 | 19 | import com.microsoft.azure.toolkit.intellij.connector.Resource; |
|
24 | 26 | import com.microsoft.azure.toolkit.lib.keyvault.KeyVault; |
25 | 27 | import com.microsoft.azure.toolkit.lib.keyvault.secret.Secret; |
26 | 28 | import lombok.Getter; |
| 29 | +import org.apache.commons.lang3.StringUtils; |
27 | 30 |
|
28 | 31 | import javax.annotation.Nonnull; |
29 | 32 | import javax.annotation.Nullable; |
@@ -104,7 +107,11 @@ public String getName() { |
104 | 107 | @Override |
105 | 108 | @Nonnull |
106 | 109 | public Icon getIcon(final boolean open) { |
107 | | - return IntelliJAzureIcons.getIcon(AzureResourceIconProvider.getResourceBaseIconPath(this.secret)); |
| 110 | + final String iconPath = Optional.ofNullable(this.secret) |
| 111 | + .map(AzureResourceIconProvider::getResourceBaseIconPath) |
| 112 | + .orElse(AzureIcons.Common.AZURE.getIconPath()); |
| 113 | + return Optional.ofNullable(iconPath).filter(StringUtils::isNoneBlank) |
| 114 | + .map(IntelliJAzureIcons::getIcon).orElse(AllIcons.Providers.Azure); |
108 | 115 | } |
109 | 116 |
|
110 | 117 | @Override |
|
0 commit comments