Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 90bf911

Browse files
authored
fix: replaced helm png by svg, use resized, not scaled icon (#874) (#920)
Signed-off-by: Andre Dietisheim <[email protected]>
1 parent a71743b commit 90bf911

File tree

4 files changed

+77
-71
lines changed

4 files changed

+77
-71
lines changed

src/main/java/org/jboss/tools/intellij/openshift/tree/application/DescriptorFactory.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
import com.intellij.ide.util.treeView.NodeDescriptor;
1414
import com.intellij.openapi.project.Project;
1515
import com.intellij.openapi.util.IconLoader;
16+
import com.intellij.util.IconUtil;
1617
import com.redhat.devtools.intellij.common.tree.LabelAndIconDescriptor;
17-
import org.jboss.tools.intellij.openshift.ui.SwingUtils;
18+
import java.util.function.Supplier;
19+
import javax.swing.Icon;
1820
import org.jboss.tools.intellij.openshift.ui.helm.ChartIcons;
1921
import org.jboss.tools.intellij.openshift.utils.odo.Binding;
2022
import org.jboss.tools.intellij.openshift.utils.odo.Component;
@@ -23,9 +25,6 @@
2325
import org.jetbrains.annotations.NotNull;
2426
import org.jetbrains.annotations.Nullable;
2527

26-
import javax.swing.Icon;
27-
import java.util.function.Supplier;
28-
2928
public class DescriptorFactory {
3029

3130
private static final Supplier<Icon> CLUSTER_ICON = () -> IconLoader.findIcon("/images/cluster.svg", ApplicationsTreeStructure.class);
@@ -161,7 +160,7 @@ public class DescriptorFactory {
161160
releaseNode,
162161
releaseNode::getName,
163162
() -> "Helm Release",
164-
() -> SwingUtils.scaleIcon(ICON_WIDTH, ChartIcons.getIcon(releaseNode.getRelease())),
163+
() -> IconUtil.resizeSquared(ChartIcons.getIcon(releaseNode.getRelease()), ICON_WIDTH),
165164
parentDescriptor);
166165
} else if (element instanceof HelmRepositoriesNode) {
167166
HelmRepositoriesNode helmRepositoriesNode = (HelmRepositoriesNode) element;
@@ -170,7 +169,7 @@ public class DescriptorFactory {
170169
helmRepositoriesNode,
171170
helmRepositoriesNode::getName,
172171
() -> "Repositories",
173-
() -> SwingUtils.scaleIcon(ICON_WIDTH, ChartIcons.getHelmIcon()),
172+
() -> IconUtil.resizeSquared(ChartIcons.getHelmIcon(), ICON_WIDTH),
174173
parentDescriptor);
175174
} else if (element instanceof HelmRepositoryNode) {
176175
HelmRepositoryNode helmRepositoryNode = (HelmRepositoryNode) element;

src/main/java/org/jboss/tools/intellij/openshift/ui/helm/ChartIcons.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
public class ChartIcons {
2323

2424
private static final Path BASE_PATH = Paths.get("images", "helm");
25-
private static final String HELM_ICON = "helm.png";
25+
private static final String HELM_ICON = "helm.svg";
2626

2727
public static Icon getHelmIcon() {
28+
// IC-2023.3: IconManager.getInstance().getIcon(BASE_PATH.resolve(HELM_ICON_SVG).toString(), ChartIcons.class.getClassLoader())
2829
return IconManager.getInstance().getIcon(BASE_PATH.resolve(HELM_ICON).toString(), ChartIcons.class);
2930
}
3031

@@ -41,8 +42,9 @@ private static Icon getIcon(String name) {
4142
.filter((IconExpression available) -> available.isMatching(name))
4243
.findFirst();
4344
return found
45+
// IC-2023.3: IconManager.getInstance().getIcon(BASE_PATH.resolve(HELM_ICON_SVG).toString(), ChartIcons.class.getClassLoader())
4446
.map(iconExpression -> IconManager.getInstance().getIcon(iconExpression.filename, ChartIcons.class))
45-
.orElseGet(ChartIcons::getHelmIcon);
47+
.orElseGet(ChartIcons::getHelmIcon);
4648
}
4749

4850
private enum IconExpression {
-2.14 KB
Binary file not shown.
+68-63
Loading

0 commit comments

Comments
 (0)