1 9 10 package org.enhydra.jawe.actions; 11 12 import org.enhydra.jawe.*; 13 import org.enhydra.jawe.xml.elements.WorkflowProcess; 14 15 import org.jgraph.graph.*; 16 17 import java.awt.event.ActionEvent ; 18 import javax.swing.tree.DefaultMutableTreeNode ; 19 import javax.swing.JOptionPane ; 20 21 25 public class Delete extends ActionBase { 26 27 public Delete (AbstractEditor editor) { 28 super(editor); 29 } 30 31 public void actionPerformed(ActionEvent e) { 32 if (editor instanceof ProcessEditor) { 33 Object [] cells = editor.getGraph().getSelectionCells(); 34 WorkflowManager dm=editor.getGraph().getWorkflowManager(); 35 dm.removeCellsAndArrangeParticipants(cells); 36 } else { 37 Object cell = editor.getGraph().getSelectionCell(); 38 if (cell!=null && !(cell instanceof Port)) { 39 org.enhydra.jawe.xml.elements.WorkflowProcess wp= 40 (org.enhydra.jawe.xml.elements.WorkflowProcess) 41 ((DefaultMutableTreeNode )cell).getUserObject(); 42 if (wp.getCollection().canRemoveElement(wp)) { 43 WorkflowManager dm=editor.getGraph().getWorkflowManager(); 44 dm.removeCellsAndArrangeParticipants(new Object [] {cell}); 45 } else { 46 JaWE.getInstance().message(ResourceManager.getLanguageDependentString( 47 "WarningCannotDeleteProcessThatIsInUseBySomeSubflowActivity"), 48 JOptionPane.WARNING_MESSAGE); 49 } 50 } 51 } 52 } 53 54 55 } 56 | Popular Tags |