50 lines
1.7 KiB
Java
50 lines
1.7 KiB
Java
package fenetres.create_act;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import javax.swing.AbstractAction;
|
|
import javax.swing.Action;
|
|
import javax.swing.ImageIcon;
|
|
import javax.swing.JOptionPane;
|
|
|
|
import fenetres.create;
|
|
import nodeAC.nodeAC;
|
|
|
|
public class actDeleteNode extends AbstractAction{
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
{
|
|
putValue( Action.NAME, "Supprime" );
|
|
putValue( Action.SMALL_ICON, new ImageIcon(create.class.getResource("/resources/supprimemini.png")) );
|
|
putValue( Action.SHORT_DESCRIPTION, "Supprime" );
|
|
}
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
if(fenetres.create.getTree().getSelectionPath()!=null) {
|
|
int a = JOptionPane.showConfirmDialog(null,"Voulez-vous supprimer le nodeAC " + fenetres.create.getSelectNode().toString() + "?", "Sélectionner un choix", JOptionPane.YES_NO_OPTION);
|
|
|
|
if(a == JOptionPane.YES_NO_OPTION) {
|
|
nodeAC nod = (nodeAC) fenetres.create.getSelectNode().getUserObject();
|
|
if(!(nod.getNomElt().equals("setting")||nod.getNomElt().equals("csv")||nod.getNomElt().equals("import_moodle")||nod.getNomElt().equals("zip")
|
|
||nod.getNomElt().equals("plagiarism")||nod.getNomElt().equals("text:similarity")||nod.getNomElt().equals("color") ||nod.getNomElt().equals("translation") )) {
|
|
|
|
nod.getParent().supprimeNodeEnfant(nod);
|
|
fenetres.create.constructionTree();
|
|
|
|
}else {
|
|
JOptionPane.showMessageDialog(null,"Vous ne devez pas supprimer ce nodeAC !", "Oh non!!!", JOptionPane.INFORMATION_MESSAGE);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|