1 26 package org.objectweb.openccm.explorer.Deployment; 27 28 import javax.swing.JOptionPane ; 29 30 import org.objectweb.util.explorer.api.MenuItem; 31 import org.objectweb.util.explorer.api.MenuItemTreeView; 32 import org.objectweb.util.explorer.api.TreeView; 33 import org.omg.Components.Deployment.Assembly; 34 35 44 public class TearDown 45 implements MenuItem 46 { 47 48 protected Assembly getAssembly(TreeView e){ 49 return (Assembly)e.getSelectedObject(); 50 } 51 52 55 public int getStatus(TreeView e){ 56 Assembly assembly = getAssembly(e); 57 org.omg.Components.Deployment.AssemblyState state = assembly.get_state(); 58 if(state.equals(org.omg.Components.Deployment.AssemblyState.INACTIVE)) 59 return MenuItem.DISABLED_STATUS; 60 else 61 return MenuItem.ENABLED_STATUS; 62 } 63 64 67 public void actionPerformed(MenuItemTreeView e) throws Exception { 68 if(JOptionPane.showConfirmDialog(null,"Do you want to tear this assembly down ?", "Tear down action", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)==0){ 69 Assembly assembly = getAssembly(e); 70 assembly.tear_down(); 71 } 72 } 73 74 } | Popular Tags |