1 26 27 package org.objectweb.ccm.demo3.explorer; 28 29 import javax.swing.JOptionPane ; 30 31 import org.objectweb.ccm.demo3.Consumer; 32 import org.objectweb.ccm.demo3.ConsumerHome; 33 import org.objectweb.util.explorer.api.TreeView; 34 import org.objectweb.util.explorer.api.MenuItem; 35 import org.objectweb.util.explorer.api.MenuItemTreeView; 36 37 43 public class ConsumerCreationAction 44 implements MenuItem 45 { 46 47 53 59 65 71 public int getStatus(TreeView treeView) { 72 return MenuItem.ENABLED_STATUS; 73 } 74 75 public void actionPerformed(MenuItemTreeView e) throws Exception { 76 String name = ""; 77 while (name != null && name.equals("")) { 78 name = JOptionPane.showInputDialog("Enter the consumer's name:"); 79 } 80 if(name!=null){ 81 ConsumerHome consumerHome = (ConsumerHome) e.getSelectedObject(); 82 Consumer consumer = consumerHome.create(); 83 consumer.name(name); 84 } 85 } 86 87 } 88 | Popular Tags |