added delete mote menu action
This commit is contained in:
parent
5337ad2b60
commit
5ddbefaa4f
1 changed files with 16 additions and 1 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Visualizer2D.java,v 1.13 2008/02/12 15:31:22 fros4943 Exp $
|
||||
* $Id: Visualizer2D.java,v 1.14 2008/03/18 16:20:56 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -122,6 +122,18 @@ public abstract class Visualizer2D extends VisPlugin {
|
|||
}
|
||||
};
|
||||
|
||||
private class DeleteMoteMenuAction implements MoteMenuAction {
|
||||
public boolean isEnabled(Mote mote) {
|
||||
return true;
|
||||
}
|
||||
public String getDescription(Mote mote) {
|
||||
return "Delete " + mote;
|
||||
}
|
||||
public void doAction(Mote mote) {
|
||||
simulation.removeMote(mote);
|
||||
}
|
||||
};
|
||||
|
||||
private Vector<MoteMenuAction> menuActions = new Vector<MoteMenuAction>();
|
||||
|
||||
/**
|
||||
|
@ -290,6 +302,9 @@ public abstract class Visualizer2D extends VisPlugin {
|
|||
// Add menu action for clicking mote button
|
||||
addMoteMenuAction(new ButtonClickMoteMenuAction());
|
||||
|
||||
// Add menu action for deleting mote
|
||||
addMoteMenuAction(new DeleteMoteMenuAction());
|
||||
|
||||
try {
|
||||
setSelected(true);
|
||||
} catch (java.beans.PropertyVetoException e) {
|
||||
|
|
Loading…
Reference in a new issue