mbien commented on code in PR #6772:
URL: https://github.com/apache/netbeans/pull/6772#discussion_r1416611072
##########
ide/projectui/src/org/netbeans/modules/project/ui/groups/GroupsMenu.java:
##########
@@ -137,36 +129,20 @@ private static void manageGroups() {
final JButton select = new JButton();
Mnemonics.setLocalizedText(select, GroupsMenu_manage_select_group());
select.setDefaultCapable(true);
- panel.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals("selection")) {
- select.setEnabled(panel.isExactlyOneGroupSelected());
- }
+ panel.addPropertyChangeListener((PropertyChangeEvent evt) -> {
+ if (evt.getPropertyName().equals("selection")) {
+ select.setEnabled(panel.isExactlyOneGroupSelected());
}
});
- select.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- RP.post(new Runnable() {
- @Override
- public void run() {
- Group.setActiveGroup(panel.getSelectedGroups()[0],
false);
- }
- });
- }
+ select.addActionListener((ActionEvent e) -> {
+ RP.post(() -> Group.setActiveGroup(panel.getSelectedGroups()[0],
false));
});
final JButton newGroup = new JButton();
newGroup.setDefaultCapable(false);
Mnemonics.setLocalizedText(newGroup, GroupsMenu_manage_new_group());
- newGroup.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- newGroup();
- }
- });
+ // invokeLater ensures that the parent is disposed before the new
dialog opens
+ // so that it can set a parent which doesn't disappear - fixes race
condition
+ newGroup.addActionListener(e ->
SwingUtilities.invokeLater(GroupsMenu::newGroup));
Review Comment:
^ third commit changes this so that the new-group dialog opens manage-groups
again
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists