1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ejbbnd; 20 21 import java.io.IOException ; 22 import org.netbeans.modules.j2ee.websphere6.dd.loaders.WSMultiViewDataObject; 23 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSEjbBnd; 24 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmi; 25 import org.openide.filesystems.FileObject; 26 import org.openide.filesystems.FileUtil; 27 import org.openide.loaders.DataObjectExistsException; 28 import org.openide.loaders.MultiDataObject; 29 import org.openide.nodes.CookieSet; 30 import org.openide.nodes.Node; 31 import org.openide.text.DataEditorSupport; 32 import org.netbeans.modules.xml.multiview.*; 33 34 35 36 public class WSEjbBndDataObject extends WSMultiViewDataObject { 37 38 public WSEjbBndDataObject(FileObject pf, WSEjbBndDataLoader loader) throws DataObjectExistsException, IOException { 39 super(pf, loader); 40 } 41 42 43 public DDXmi getDD() throws java.io.IOException { 44 if (ddBaseBean==null) { 45 ddBaseBean = new WSEjbBnd(FileUtil.toFile(getPrimaryFile()),false); 46 } 47 return (WSEjbBnd)ddBaseBean; 48 } 49 public WSEjbBnd getEjbBnd() throws java.io.IOException { 50 return (WSEjbBnd)getDD(); 51 } 52 53 protected DDXmi createDDXmiFromDataCache() { 54 return new WSEjbBnd(getInputStream(), false); 55 } 56 57 58 protected Node createNodeDelegate() { 59 return new WSEjbBndDataNode(this); 60 } 61 62 protected DesignMultiViewDesc[] getMultiViewDesc() { 63 designView = new DesignView(this); 64 return new DesignMultiViewDesc[]{designView}; 65 } 66 67 68 69 public WSEjbBndToolBarMVElement getEBTB() { 70 return ((DesignView)designView).getEBTB(); 71 } 72 73 protected class DesignView extends WSDesignView { 74 private WSEjbBndToolBarMVElement ebtb; 75 private static final long serialVersionUID=7209502130942350230L; 76 DesignView(WSEjbBndDataObject dObj) { 77 super(dObj); 78 } 79 80 public org.netbeans.core.spi.multiview.MultiViewElement createElement() { 81 WSEjbBndDataObject dObj = (WSEjbBndDataObject)getDataObject(); 82 ebtb=new WSEjbBndToolBarMVElement(dObj); 83 return ebtb; 84 } 85 86 public String preferredID() { 87 return "ejbbnd_multiview_design"; 88 } 89 public WSEjbBndToolBarMVElement getEBTB() { 90 return ebtb; 91 92 } 93 public java.awt.Image getIcon() { 94 return org.openide.util.Utilities.loadImage("org/netbeans/modules/j2ee/websphere6/dd/resources/ws3.gif"); } 96 } 97 98 101 102 public void showElement(Object element) { 103 Object target=null; 104 openView(0); 108 target=element; 109 if (target!=null) { 111 final Object key=target; 112 org.netbeans.modules.xml.multiview.Utils.runInAwtDispatchThread(new Runnable () { 113 public void run() { 114 getActiveMultiViewElement0().getSectionView().openPanel(key); 115 } 116 }); 117 } 118 } 119 } 120 | Popular Tags |