1 26 27 package org.objectweb.openccm.packaging; 28 29 import org.objectweb.openccm.descriptor.softpkg.beans.SoftpkgBean; 30 import org.objectweb.openccm.descriptor.softpkg.beans.SoftpkgBeanImpl; 31 32 36 public class ComponentfileEditActionListener 37 implements org.objectweb.util.browser.api.MenuItem 38 { 39 44 public int 45 getStatus(org.objectweb.util.browser.api.TreeView treeView) 46 { 47 return org.objectweb.util.browser.api.MenuItem.ENABLED_STATUS; 48 } 49 50 public void 51 actionPerformed (org.objectweb.util.browser.api.MenuItemTreeView the_event) 52 { 53 org.objectweb.openccm.descriptor.componentassembly.beans.ComponentfileBean csd_file 55 = (org.objectweb.openccm.descriptor.componentassembly.beans.ComponentfileBean) 56 the_event.getSelectedObject(); 57 58 org.objectweb.util.browser.core.common.DynamicTree calling_tree 60 = (org.objectweb.util.browser.core.common.DynamicTree) 61 the_event.getTree(); 62 63 org.objectweb.apollon.gui.ApollonFrame calling_frame 65 = (org.objectweb.apollon.gui.ApollonFrame) 66 calling_tree.getRootPane().getParent(); 67 68 String softpkg_path = null; 70 71 if (csd_file.getFileinarchive() != null) 73 { 74 if (csd_file.getFileinarchive().getLink() != null) 76 { 77 if( csd_file.getFileinarchive().getLink() 79 .getHref().indexOf(":")==-1) 80 { 81 softpkg_path 82 = csd_file.getFileinarchive().getLink() 83 .getHref(); 84 } 85 else 86 { 87 System.err.println( 88 "*** remote files access not implemented"); 89 } 90 } 91 else 92 { 93 softpkg_path 95 = csd_file.getFileinarchive().getName(); 96 } 97 } 98 99 if (csd_file.getLink() != null ) 100 { 101 if( csd_file.getLink().getHref().indexOf(":")==-1) 103 { 104 softpkg_path 105 = csd_file.getLink().getHref(); 106 } 107 else 108 { 109 System.err.println( 110 "*** remote files access not implemented"); 111 } 112 } 113 114 java.io.File softpkg = new java.io.File (softpkg_path); 115 if ( softpkg!=null && !softpkg.exists()) 117 { 118 SoftpkgBean softpkg_instance 119 = new SoftpkgBeanImpl(); 120 121 softpkg_instance.setDocType("softpkg","-//OMG//DTD CORBA Software Descriptor 3.0//EN","http://openccm.objectweb.org/dtd/ccm/softpkg.dtd"); 122 123 try { 124 softpkg_instance.marshalBean( 125 new java.io.File (softpkg_path) 126 ); 127 } catch (Exception exception) { 128 exception.printStackTrace(); 129 } 130 } 131 else 132 { 133 } 135 136 FileOperations.open_file( 137 new java.io.File (softpkg_path) 138 , calling_frame 139 ); 140 } 141 } 142 | Popular Tags |