-
Notifications
You must be signed in to change notification settings - Fork 3
Adding RUI annotation on JList.addListSelectionListener/removeListSelectionListener. #136
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,12 @@ | |
| <val name="intValues" val="{javax.swing.SwingConstants.LEFT, javax.swing.SwingConstants.CENTER, javax.swing.SwingConstants.RIGHT, javax.swing.SwingConstants.LEADING, javax.swing.SwingConstants.TRAILING}" /> | ||
| </annotation> | ||
| </item> | ||
| <item name="javax.swing.JList void addListSelectionListener(javax.swing.event.ListSelectionListener) 0"> | ||
| <annotation name="consulo.ui.annotation.RequiredUIAccess" /> | ||
| </item> | ||
| <item name="javax.swing.JList void removeListSelectionListener(javax.swing.event.ListSelectionListener) 0"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annotating removeListSelectionListener with RequiredUIAccess is reasonable — listener mutation on a Swing component should happen on the EDT, same as the add side. (The same parameter-index "0" observation from the add... comment above applies here too.) Scope thought, non-blocking: if the goal is to enforce EDT access for JList selection mutation more broadly, the selection-changing methods such as setSelectedIndex, setSelectionInterval and addSelectionInterval are natural follow-up candidates. Not needed for this PR. |
||
| <annotation name="consulo.ui.annotation.RequiredUIAccess" /> | ||
| </item> | ||
| <item name="javax.swing.JOptionPane JOptionPane(java.lang.Object, int) 1"> | ||
| <annotation name="org.intellij.lang.annotations.MagicConstant"> | ||
| <val name="intValues" val="{javax.swing.JOptionPane.INFORMATION_MESSAGE,javax.swing.JOptionPane.WARNING_MESSAGE,javax.swing.JOptionPane.ERROR_MESSAGE,javax.swing.JOptionPane.QUESTION_MESSAGE,javax.swing.JOptionPane.PLAIN_MESSAGE}" /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the existing precedent in this same file — AbstractButton "void addActionListener(...) 0" (line 6) already carries consulo.ui.annotation.RequiredUIAccess, and the new entries are inserted in the correct alphabetical position (after JLabel, before JOptionPane). 👍
One thing worth confirming: the trailing " 0" in the item name targets parameter 0 (the ListSelectionListener), not the method itself. RequiredUIAccess is a constraint on the callers thread, which is conceptually a property of the method invocation rather than of the argument. A method-level entry would be written without the trailing index, i.e. the item name would end at the closing paren with no " 0" suffix.
Since the established AbstractButton.addActionListener "... 0" entry uses the same parameter-indexed form and is presumably working as intended, this PR is consistent with repo convention — so I am flagging it only as a question: is the parameter-level placement deliberate, or should these (and the existing precedent) be method-level?