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

Improve string-based Icon deprecation #555

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Conversation

rock3r
Copy link
Collaborator

@rock3r rock3r commented Aug 22, 2024

Adding the PathIconKey import and param names to the ReplaceWith makes the auto-upgrade seamless. It would result in red code otherwise.

Upgrade Icon in SwingComparisonTabPanel to new style.

@rock3r rock3r added the cleanup Improve the project/tooling and/or get rid of tech debt label Aug 22, 2024
@rock3r rock3r requested a review from hamen August 22, 2024 08:25
@rock3r rock3r self-assigned this Aug 22, 2024
@rock3r rock3r enabled auto-merge (squash) August 22, 2024 08:25

object IdeSampleIconKeys {
val gitHub = IntelliJIconKey("icons/github.svg", "icons/github.svg", IdeSampleIconKeys::class.java)
val gitHub = PathIconKey("icons/github.svg", IdeSampleIconKeys::class.java)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have NewUI mappings for these, so a simple PathIconKey is enough

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Yesterday, I replaced another icon on one of my branches and I created like the gitHub one you are improving. Gotta improve mine as well 🙏🏻

@@ -42,7 +42,11 @@ import java.io.InputStream

@Deprecated(
"Use the IconKey-based API instead",
ReplaceWith("Icon(PathIconKey(resource, iconClass), contentDescription, colorFilter, modifier, hints)"),
ReplaceWith(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Param names are necessary for the resulting code to compile, especially with the vararg versions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 It saves a bit of time. I was manually adding the names and then running the ReplaceWith.

Adding the PathIconKey import and param names to the ReplaceWith makes
the auto-upgrade seamless. It would result in red code otherwise.

Upgrade Icon in SwingComparisonTabPanel to new style.
@rock3r rock3r force-pushed the improve-icon-deprecation branch from 236c494 to c862348 Compare August 22, 2024 08:31

object IdeSampleIconKeys {
val gitHub = IntelliJIconKey("icons/github.svg", "icons/github.svg", IdeSampleIconKeys::class.java)
val gitHub = PathIconKey("icons/github.svg", IdeSampleIconKeys::class.java)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Yesterday, I replaced another icon on one of my branches and I created like the gitHub one you are improving. Gotta improve mine as well 🙏🏻

@@ -42,7 +42,11 @@ import java.io.InputStream

@Deprecated(
"Use the IconKey-based API instead",
ReplaceWith("Icon(PathIconKey(resource, iconClass), contentDescription, colorFilter, modifier, hints)"),
ReplaceWith(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 It saves a bit of time. I was manually adding the names and then running the ReplaceWith.

@rock3r rock3r merged commit 0a43abe into main Aug 22, 2024
3 checks passed
@rock3r rock3r deleted the improve-icon-deprecation branch August 22, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Improve the project/tooling and/or get rid of tech debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants