Browse Source

Select an alias when deleting one.

Change-Id: Ida668dcbb396e10c523559a095d829d8ca93ecaa
Fixes-Issue: CLIENT-517
Reviewed-on: http://gerrit.dmdirc.com/3631
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
changes/31/3631/2
Greg Holmes 10 years ago
parent
commit
ed6e3820f1

+ 9
- 0
src/com/dmdirc/addons/ui_swing/dialogs/aliases/AliasManagerLinker.java View File

@@ -122,7 +122,16 @@ public class AliasManagerLinker {
122 122
 
123 123
             @Override
124 124
             public void aliasRemoved(final Alias alias) {
125
+                final int index = commandModel.indexOf(alias);
125 126
                 commandModel.remove(alias);
127
+                if (index >= commandModel.getSize()) {
128
+                    model.setSelectedAlias(Optional.fromNullable(
129
+                            commandModel.getElementAt(commandModel.getSize() - 1)));
130
+                } else if (index == -1 && !commandModel.isEmpty()) {
131
+                    model.setSelectedAlias(Optional.fromNullable(commandModel.get(0)));
132
+                } else {
133
+                    model.setSelectedAlias(Optional.fromNullable(commandModel.get(index)));
134
+                }
126 135
             }
127 136
 
128 137
             @Override

Loading…
Cancel
Save