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

Add generators to the quick fix / assists for the class #281

Closed
vogella opened this issue Sep 27, 2022 · 10 comments
Closed

Add generators to the quick fix / assists for the class #281

vogella opened this issue Sep 27, 2022 · 10 comments
Assignees
Labels
enhancement New feature or request fix verified The implemented fix has been verified with an I-build
Milestone

Comments

@vogella
Copy link
Contributor

vogella commented Sep 27, 2022

The assists pop-up on a Java class still contains only a few entries. What not adding the generate entries also the quick fixes?

image

image

@vogella
Copy link
Contributor Author

vogella commented Sep 27, 2022

cc @jjohnstn

@jjohnstn
Copy link
Contributor

Not sure about all of them. I think there's a precedent for Generate Getters and Setters because the Quick Fix for a field that doesn't already have a getter/setter offers to create one so it makes sense to offer this for the class. Of the remaining ones in your list, I could see Override/Implement Methods and possibly hashCode() and equals(), but I don't think the others are important enough and we don't want a cluttered list.

@noopur2507 What do you think?

@vogella
Copy link
Contributor Author

vogella commented Sep 29, 2022

I think the most important (for me) would be:

Getter / Setter (per field is not super easy to use)
hashCode()
Equals()
toString()

The Override / implement Method wizard is rarely used by me, but adding it would most likely also helpful to others.

Thanks @jjohnstn for considering this. IntelliJ has a popup and shortcut for these generations, would be nice to have this as quick fix in Eclipse.

@jjohnstn jjohnstn changed the title Add generators to the quick fix / assits for the class Add generators to the quick fix / assists for the class Oct 6, 2022
@jjohnstn
Copy link
Contributor

jjohnstn commented Oct 6, 2022

I have added: #285 to handle getters/setters

jjohnstn added a commit that referenced this issue Oct 6, 2022
- Propose getter/setter quick assist for types/records if they don't already exist
- create a proposal that will start the AddGetterSetterAction
- #281
@vogella
Copy link
Contributor Author

vogella commented Oct 7, 2022

Thanks @jjohnstn what about the hashCode/ equals and toString generators?

@jjohnstn
Copy link
Contributor

jjohnstn commented Oct 7, 2022

Still to come. Otherwise, I would have closed the issue.

jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Oct 11, 2022
- propose hashcode/equals methods for type if they don't already
  exist and the type has at least one non-static field
- fix AssistQuickFixTest
- eclipse-jdt#281
jjohnstn added a commit that referenced this issue Oct 12, 2022
- propose hashcode/equals methods for type if they don't already
  exist and the type has at least one non-static field
- fix AssistQuickFixTest
- #281
jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue Oct 13, 2022
- create new ToStringTypeProposal class that uses the
  GenerateToStringAction
- add quick assist to AdvancedQuickAssistProcessor
- fix messages for hashcode/equals assist to add () for methods
- add new IProposalRelevance constants
- eclipse-jdt#281
jjohnstn added a commit that referenced this issue Oct 13, 2022
- create new ToStringTypeProposal class that uses the
  GenerateToStringAction
- add quick assist to AdvancedQuickAssistProcessor
- fix messages for hashcode/equals assist to add () for methods
- add new IProposalRelevance constants
- #281
@jjohnstn
Copy link
Contributor

@vogella I think this can be closed now unless you have any issues. I will leave the implement/override methods to be accessible via the Source menu.

@vogella
Copy link
Contributor Author

vogella commented Oct 18, 2022

Thanks Jeff, looks great

@vogella vogella closed this as completed Oct 18, 2022
@jjohnstn jjohnstn added the enhancement New feature or request label Nov 4, 2022
@jjohnstn jjohnstn self-assigned this Nov 4, 2022
@jjohnstn jjohnstn added this to the 4.26 M3 milestone Nov 4, 2022
@jjohnstn jjohnstn added the fix verified The implemented fix has been verified with an I-build label Nov 8, 2022
@jjohnstn
Copy link
Contributor

jjohnstn commented Nov 8, 2022

Verified for 4.26 M3 using I20221108 build.

@ktatavarthi
Copy link
Member

@jjohnstn Can you please add N&N entries for these new Quick assists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix verified The implemented fix has been verified with an I-build
Projects
None yet
Development

No branches or pull requests

3 participants