1 26 27 package org.objectweb.ccm.demo1.explorer; 28 29 import javax.swing.JOptionPane ; 30 31 import org.objectweb.ccm.demo1.Server; 32 import org.objectweb.ccm.demo1.ServerHome; 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 ServerCreationAction 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 server's name:"); 79 } 80 if(name!=null) { 81 ServerHome serverHome = (ServerHome) e.getSelectedObject(); 82 Server server = serverHome.create(); 83 server.the_name(name); 84 } 85 } 86 87 } 88 | Popular Tags |