[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 @Override
public String getDescription(Visualizer visualizer, Mote mote) { public String getDescription(Visualizer visualizer, Mote mote) {
if (visualizer.getSelectedMotes().size() == 1) {
return "Delete " + mote; return "Delete " + mote;
} else {
return "Delete selected Motes";
}
} }
@Override @Override
public void doAction(Visualizer visualizer, Mote mote) { public void doAction(Visualizer visualizer, Mote mote) {
if (visualizer.getSelectedMotes().size() == 1) {
mote.getSimulation().removeMote(mote); mote.getSimulation().removeMote(mote);
} else {
for (Mote m: visualizer.getSelectedMotes()) {
mote.getSimulation().removeMote(m);
}
}
} }
}; };