1 26 27 package org.objectweb.openccm.explorer.DCI; 28 29 import javax.swing.*; 30 31 import org.objectweb.util.explorer.api.MenuItem; 32 import org.objectweb.util.explorer.api.MenuItemTreeView; 33 import org.objectweb.util.explorer.api.TreeView; 34 35 import java.awt.Component ; 36 import java.awt.event.ActionEvent ; 37 38 44 public class DCICreateAssemblyInstance 45 implements MenuItem 46 { 47 48 51 public int getStatus(TreeView treeView){ 52 return MenuItem.ENABLED_STATUS; 53 } 54 55 58 public void actionPerformed(MenuItemTreeView e) throws Exception { 59 org.ist.coach.DCI.DCIDeployment dciDeployment= 60 (org.ist.coach.DCI.DCIDeployment)e.getSelectedObject(); 61 62 javax.swing.JPanel pan = new javax.swing.JPanel (); 63 64 pan.add(new javax.swing.JLabel ("Choose your AssemblyUUID")); 65 66 String [] data = dciDeployment.get_assemblies(); 67 68 javax.swing.JComboBox jcombo = new javax.swing.JComboBox (data); 69 70 pan.add(jcombo); 71 72 int result = 73 javax.swing 74 .JOptionPane 75 .showOptionDialog( 76 (Component )((ActionEvent )e.getEvent()).getSource(), 77 pan, 78 "Create an assembly", 79 JOptionPane.OK_CANCEL_OPTION, 80 JOptionPane.PLAIN_MESSAGE, 81 null, 82 null, 83 null); 84 85 if(result==0&&jcombo.getSelectedItem()!=null) 86 dciDeployment.create_assembly_instance(((String )jcombo.getSelectedItem()).trim()); 87 88 } 89 90 } 91 | Popular Tags |