Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replaced helm png by svg, use resized, not scaled icon (#874) #920

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.util.IconUtil;
import com.redhat.devtools.intellij.common.tree.LabelAndIconDescriptor;
import org.jboss.tools.intellij.openshift.ui.SwingUtils;
import java.util.function.Supplier;
import javax.swing.Icon;
import org.jboss.tools.intellij.openshift.ui.helm.ChartIcons;
import org.jboss.tools.intellij.openshift.utils.odo.Binding;
import org.jboss.tools.intellij.openshift.utils.odo.Component;
Expand All @@ -23,9 +25,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.Icon;
import java.util.function.Supplier;

public class DescriptorFactory {

private static final Supplier<Icon> CLUSTER_ICON = () -> IconLoader.findIcon("/images/cluster.svg", ApplicationsTreeStructure.class);
Expand Down Expand Up @@ -161,7 +160,7 @@ public class DescriptorFactory {
releaseNode,
releaseNode::getName,
() -> "Helm Release",
() -> SwingUtils.scaleIcon(ICON_WIDTH, ChartIcons.getIcon(releaseNode.getRelease())),
() -> IconUtil.resizeSquared(ChartIcons.getIcon(releaseNode.getRelease()), ICON_WIDTH),
parentDescriptor);
} else if (element instanceof HelmRepositoriesNode) {
HelmRepositoriesNode helmRepositoriesNode = (HelmRepositoriesNode) element;
Expand All @@ -170,7 +169,7 @@ public class DescriptorFactory {
helmRepositoriesNode,
helmRepositoriesNode::getName,
() -> "Repositories",
() -> SwingUtils.scaleIcon(ICON_WIDTH, ChartIcons.getHelmIcon()),
() -> IconUtil.resizeSquared(ChartIcons.getHelmIcon(), ICON_WIDTH),
parentDescriptor);
} else if (element instanceof HelmRepositoryNode) {
HelmRepositoryNode helmRepositoryNode = (HelmRepositoryNode) element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
public class ChartIcons {

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

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

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

private enum IconExpression {
Expand Down
Binary file removed src/main/resources/images/helm/helm.png
Binary file not shown.
131 changes: 68 additions & 63 deletions src/main/resources/images/helm/helm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading