KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > loaders > ejbext > WSEjbExtDataObject


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ejbext;
20
21 import org.netbeans.modules.j2ee.websphere6.dd.loaders.WSMultiViewDataObject;
22 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSEjbExt;
23 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmi;
24 import org.netbeans.modules.xml.multiview.*;
25 import org.netbeans.modules.schema2beans.*;
26 import org.netbeans.spi.xml.cookies.*;
27 import org.openide.filesystems.FileUtil;
28 import org.openide.filesystems.FileObject;
29 import org.openide.loaders.DataObjectExistsException;
30 import org.openide.loaders.MultiDataObject;
31 import org.openide.nodes.CookieSet;
32 import org.openide.nodes.Node;
33 import org.openide.text.DataEditorSupport;
34 import org.openide.ErrorManager;
35 import java.nio.channels.FileLock JavaDoc;
36 import java.io.StringWriter JavaDoc;
37 import java.io.Writer JavaDoc;
38 import java.io.IOException JavaDoc;
39 import javax.xml.parsers.*;
40
41
42 public class WSEjbExtDataObject extends WSMultiViewDataObject {
43     
44     public WSEjbExtDataObject(FileObject pf, WSEjbExtDataLoader loader) throws DataObjectExistsException, IOException JavaDoc {
45         super(pf, loader);
46     }
47     
48     public DDXmi getDD() throws java.io.IOException JavaDoc {
49         if (ddBaseBean==null) {
50             ddBaseBean = new WSEjbExt(FileUtil.toFile(getPrimaryFile()),false);
51         }
52         return (WSEjbExt)ddBaseBean;
53     }
54     public WSEjbExt getEjbExt() throws java.io.IOException JavaDoc{
55         return (WSEjbExt)getDD();
56     }
57     
58     protected DDXmi createDDXmiFromDataCache() {
59         return new WSEjbExt(getInputStream(), false);
60     }
61     
62     
63     protected Node createNodeDelegate() {
64         return new WSEjbExtDataNode(this);
65     }
66     
67     protected DesignMultiViewDesc[] getMultiViewDesc() {
68         designView = new DesignView(this);
69         return new DesignMultiViewDesc[]{designView};
70     }
71     
72     
73     
74     public WSEjbExtToolBarMVElement getEETB() {
75         return ((DesignView)designView).getEETB();
76     }
77     
78     protected class DesignView extends WSDesignView {
79         private WSEjbExtToolBarMVElement eetb;
80         private static final long serialVersionUID=7209502130942350230L;
81         DesignView(WSEjbExtDataObject dObj) {
82             super(dObj);
83         }
84         
85         public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
86             WSEjbExtDataObject dObj = (WSEjbExtDataObject)getDataObject();
87             eetb=new WSEjbExtToolBarMVElement(dObj);
88             return eetb;
89         }
90         
91         public String JavaDoc preferredID() {
92             return "ejbext_multiview_design";
93         }
94         public WSEjbExtToolBarMVElement getEETB() {
95             return eetb;
96             
97         }
98         public java.awt.Image JavaDoc getIcon() {
99             return org.openide.util.Utilities.loadImage("org/netbeans/modules/j2ee/websphere6/dd/resources/ws4.gif"); //NOI18N
100
}
101     }
102     
103     /** Enable to focus specific object in Multiview Editor
104      * The default implementation opens the XML View
105      */

106     
107     public void showElement(Object JavaDoc element) {
108         Object JavaDoc target=null;
109         /*if (element instanceof ResRefBindingsType ||
110                 element instanceof EjbRefBindingsType ||
111                 element instanceof ResEnvRefBindingsType) {
112           */
openView(0);
113             target=element;
114         //}
115
if (target!=null) {
116             final Object JavaDoc key=target;
117             org.netbeans.modules.xml.multiview.Utils.runInAwtDispatchThread(new Runnable JavaDoc() {
118                 public void run() {
119                     getActiveMultiViewElement0().getSectionView().openPanel(key);
120                 }
121             });
122         }
123     }
124     
125 }
126
Popular Tags