forked from dorkbox/SystemTray
Cleaned up removing menu entry, added exception throwing
This commit is contained in:
parent
19eb4df547
commit
180d66a7c1
@ -1181,22 +1181,26 @@ class SystemTray {
|
|||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void run() {
|
void run() {
|
||||||
synchronized (menuEntries) {
|
try {
|
||||||
for (Iterator<MenuEntry> iterator = menuEntries.iterator(); iterator.hasNext(); ) {
|
synchronized (menuEntries) {
|
||||||
final MenuEntry entry = iterator.next();
|
for (Iterator<MenuEntry> iterator = menuEntries.iterator(); iterator.hasNext(); ) {
|
||||||
if (entry.getText()
|
final MenuEntry entry = iterator.next();
|
||||||
.equals(label)) {
|
if (entry.getText()
|
||||||
iterator.remove();
|
.equals(label)) {
|
||||||
|
iterator.remove();
|
||||||
|
|
||||||
// this will also reset the menu
|
// this will also reset the menu
|
||||||
menuEntry.remove();
|
menuEntry.remove();
|
||||||
hasValue.set(true);
|
hasValue.set(true);
|
||||||
countDownLatch.countDown();
|
break;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error removing menu entry from list.", e);
|
||||||
|
} finally {
|
||||||
|
countDownLatch.countDown();
|
||||||
}
|
}
|
||||||
countDownLatch.countDown();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user