1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.webbnd; 20 21 import org.netbeans.api.xml.cookies.CheckXMLCookie; 22 import org.netbeans.api.xml.cookies.ValidateXMLCookie; 23 import org.netbeans.modules.j2ee.websphere6.dd.beans.EjbRefBindingsType; 24 import org.netbeans.modules.j2ee.websphere6.dd.beans.ResEnvRefBindingsType; 25 import org.netbeans.modules.j2ee.websphere6.dd.beans.ResRefBindingsType; 26 import org.netbeans.modules.j2ee.websphere6.dd.loaders.DDUtils; 27 import org.netbeans.modules.xml.multiview.*; 28 import org.netbeans.modules.schema2beans.*; 29 import java.io.IOException ; 30 import org.openide.filesystems.FileObject; 31 import org.openide.loaders.DataObjectExistsException; 32 import org.openide.loaders.MultiDataObject; 33 import org.openide.nodes.CookieSet; 34 import org.openide.nodes.Node; 35 import org.openide.text.DataEditorSupport; 36 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSWebBnd; 37 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmi; 38 import org.netbeans.modules.j2ee.websphere6.dd.loaders.WSMultiViewDataObject; 39 import org.netbeans.spi.xml.cookies.*; 40 import org.openide.filesystems.FileObject; 41 import org.openide.filesystems.FileUtil; 42 import java.nio.channels.FileLock ; 43 import org.openide.ErrorManager; 44 import java.io.StringWriter ; 45 import java.io.Writer ; 46 import javax.xml.parsers.*; 47 import org.xml.sax.*; 48 49 public class WSWebBndDataObject extends WSMultiViewDataObject 50 { 51 52 53 public static final String WEBBND_DATA_MULTIVIEW_PREFIX="webbnd_data"; 54 public static final String WEBBND_MULTIVIEW_ATTR="attr"; 55 56 public WSWebBndDataObject(FileObject pf, WSWebBndDataLoader loader) throws DataObjectExistsException, IOException { 57 super(pf, loader); 58 } 59 60 protected Node createNodeDelegate() { 61 return new WSWebBndDataNode(this); 62 } 63 64 public WSWebBnd getWebBnd() throws java.io.IOException { 65 return (WSWebBnd)getDD(); 66 } 67 68 public DDXmi getDD() throws java.io.IOException { 69 if (ddBaseBean==null) { 70 ddBaseBean = new WSWebBnd(FileUtil.toFile(getPrimaryFile()),false); 71 } 72 return (WSWebBnd)ddBaseBean; 73 } 74 75 protected DDXmi createDDXmiFromDataCache() { 76 return new WSWebBnd(getInputStream(), false); 77 } 78 79 protected DesignMultiViewDesc[] getMultiViewDesc() { 80 designView = new DesignView(this); 81 return new DesignMultiViewDesc[]{designView}; 82 } 83 84 85 86 public WSWebBndToolBarMVElement getWBTB() { 87 return ((DesignView)designView).getWBTB(); 88 } 89 90 protected class DesignView extends WSDesignView { 91 private WSWebBndToolBarMVElement wbtb; 92 private static final long serialVersionUID=7209572130942350230L; 93 DesignView(WSWebBndDataObject dObj) { 94 super(dObj); 95 } 96 97 public org.netbeans.core.spi.multiview.MultiViewElement createElement() { 98 WSWebBndDataObject dObj = (WSWebBndDataObject)getDataObject(); 99 wbtb=new WSWebBndToolBarMVElement(dObj); 100 return wbtb; 101 } 102 103 public String preferredID() { 104 return "webbnd_multiview_design"; 105 } 106 public WSWebBndToolBarMVElement getWBTB() { 107 return wbtb; 108 } 109 public java.awt.Image getIcon() { 110 return org.openide.util.Utilities.loadImage("org/netbeans/modules/j2ee/websphere6/dd/resources/ws5.gif"); } 112 } 113 114 117 118 public void showElement(Object element) { 119 Object target=null; 120 if (element instanceof ResRefBindingsType || 121 element instanceof EjbRefBindingsType || 122 element instanceof ResEnvRefBindingsType) { 123 openView(0); 124 target=element; 125 } 126 if (target!=null) { 127 final Object key=target; 128 org.netbeans.modules.xml.multiview.Utils.runInAwtDispatchThread(new Runnable () { 129 public void run() { 130 getActiveMultiViewElement0().getSectionView().openPanel(key); 131 } 132 }); 133 } 134 } 135 136 137 138 139 } 140 | Popular Tags |