[cooja] plugins/Visualizer: Enable multi-mote deletion in mote menu

This commit is contained in:
Enrico Joerns 2014-06-05 22:33:45 +02:00
parent 963d2686f3
commit 6594684342

View File

@ -1584,12 +1584,22 @@ public class Visualizer extends VisPlugin implements HasQuickHelp {
@Override
public String getDescription(Visualizer visualizer, Mote mote) {
return "Delete " + mote;
if (visualizer.getSelectedMotes().size() == 1) {
return "Delete " + mote;
} else {
return "Delete selected Motes";
}
}
@Override
public void doAction(Visualizer visualizer, Mote mote) {
mote.getSimulation().removeMote(mote);
if (visualizer.getSelectedMotes().size() == 1) {
mote.getSimulation().removeMote(mote);
} else {
for (Mote m: visualizer.getSelectedMotes()) {
mote.getSimulation().removeMote(m);
}
}
}
};