1 26 package org.objectweb.openccm.explorer.Deployment; 27 28 import java.net.URL ; 29 30 import org.objectweb.openccm.explorer.menu.JFileChooserSingleton; 31 import org.objectweb.openccm.explorer.menu.OpenCCMBrowserConstants; 32 import org.objectweb.util.explorer.api.MenuItem; 33 import org.objectweb.util.explorer.api.MenuItemTreeView; 34 import org.objectweb.util.explorer.api.TreeView; 35 import org.objectweb.util.explorer.swing.gui.api.DialogAction; 36 import org.objectweb.util.explorer.swing.gui.api.DialogBox; 37 import org.objectweb.util.explorer.swing.gui.lib.DefaultDialogBox; 38 import org.objectweb.util.explorer.swing.gui.lib.FileChooserBox; 39 import org.objectweb.util.explorer.swing.gui.lib.LabelBox; 40 import org.omg.Components.Deployment.ComponentInstallation; 41 42 50 public class InstallOnComponentInstallation 51 implements MenuItem, DialogAction { 52 53 59 60 protected ComponentInstallation componentInstallation_; 61 62 63 protected LabelBox uuid_; 64 65 66 protected FileChooserBox location_; 67 68 74 80 83 protected void createBox(DialogBox dialogBox) { 84 uuid_ = new LabelBox("UUID"); 85 dialogBox.addElementBox(uuid_); 86 location_ = new FileChooserBox("Location",JFileChooserSingleton.getInstance(OpenCCMBrowserConstants.JAR_FILE_CHOOSER)); 87 dialogBox.addElementBox(location_); 88 } 89 90 96 99 public int getStatus(TreeView arg0){ 100 return MenuItem.ENABLED_STATUS; 101 } 102 103 106 public void actionPerformed(MenuItemTreeView e) throws Exception { 107 componentInstallation_ = (ComponentInstallation) e.getSelectedObject(); 108 DialogBox dialogBox = new DefaultDialogBox("Archive installation"); 109 createBox(dialogBox); 110 dialogBox.setValidateAction(this); 111 dialogBox.setValidateLabel("Create"); 112 dialogBox.setCancelLabel("Cancel"); 113 dialogBox.show(); 114 } 115 116 122 125 public void executeAction() throws Exception { 126 URL theURL = location_.getURL(); 127 if(theURL!=null){ 128 componentInstallation_.install(uuid_.getLabel(), theURL.toString()); 129 } else { 130 throw new Exception ("Location: Malformed URL !"); 131 } 132 } 133 134 } 135 | Popular Tags |