01: /**
02: * Miroslav Popov, Sep 19, 2005
03: * miroslav.popov@gmail.com
04: */package org.enhydra.jawe.base.controller.actions.defaultactions;
05:
06: import java.awt.event.ActionEvent;
07: import java.util.List;
08:
09: import org.enhydra.jawe.ActionBase;
10: import org.enhydra.jawe.JaWEComponent;
11: import org.enhydra.jawe.JaWEManager;
12: import org.enhydra.jawe.base.controller.JaWEController;
13: import org.enhydra.shark.xpdl.XMLElement;
14:
15: /**
16: * @author Miroslav Popov
17: *
18: */
19: public class Delete extends ActionBase {
20:
21: public Delete(JaWEComponent jawecomponent) {
22: super (jawecomponent);
23: }
24:
25: public void enableDisableAction() {
26: JaWEController jc = (JaWEController) jawecomponent;
27:
28: if (jc.getSelectionManager().canDelete())
29: setEnabled(true);
30: else
31: setEnabled(false);
32: }
33:
34: public void actionPerformed(ActionEvent e) {
35: JaWEController jc = JaWEManager.getInstance()
36: .getJaWEController();
37: List sel = jc.getSelectionManager().getSelectedElements();
38: XMLElement firstSelected = jc.getSelectionManager()
39: .getSelectedElement();
40:
41: if (jc.confirmDelete(sel, firstSelected)) {
42: jc.getEdit().delete();
43: }
44:
45: }
46:
47: }
|