KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > netbeans > module > WSDLSourceMultiviewDesc


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdl.ui.netbeans.module;
21
22 import java.io.IOException JavaDoc;
23 import java.io.ObjectInput JavaDoc;
24 import java.io.ObjectOutput JavaDoc;
25 import java.io.Serializable JavaDoc;
26
27 import org.netbeans.core.spi.multiview.MultiViewDescription;
28 import org.netbeans.core.spi.multiview.MultiViewFactory;
29 import org.openide.util.NbBundle;
30 import org.openide.util.Utilities;
31 import org.openide.windows.TopComponent;
32 /**
33  *
34  * @author Jeri Lockhart
35  */

36 public class WSDLSourceMultiviewDesc
37                 implements MultiViewDescription, Serializable JavaDoc {
38     
39     
40     private static final long serialVersionUID = -4505309173196320880L;
41     public static final String JavaDoc PREFERRED_ID = "wsdl-sourceview";
42     private WSDLDataObject wsdlDataObject;
43     
44     // Constructor for reserialization
45
public WSDLSourceMultiviewDesc( ) {
46     }
47     
48     /**
49      * Creates a new instance of WSDLSourceMultiviewDesc
50      */

51     public WSDLSourceMultiviewDesc(WSDLDataObject wsdlDataObject) {
52         this.wsdlDataObject = wsdlDataObject;
53     }
54
55     public String JavaDoc preferredID() {
56     return PREFERRED_ID;
57     }
58
59     public int getPersistenceType() {
60             return TopComponent.PERSISTENCE_ONLY_OPENED;
61     }
62
63     public java.awt.Image JavaDoc getIcon() {
64         return Utilities.loadImage(WSDLDataObject.WSDL_ICON_BASE_WITH_EXT);
65     }
66
67     public org.openide.util.HelpCtx getHelpCtx() {
68             return org.openide.util.HelpCtx.DEFAULT_HELP;
69     }
70
71     public String JavaDoc getDisplayName() {
72         return NbBundle.getMessage(WSDLTreeViewMultiViewDesc.class, "LBL_sourceView_name");
73     }
74
75     public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
76             WSDLEditorSupport editorSupport = wsdlDataObject.getWSDLEditorSupport();
77             if (editorSupport != null) {
78                 WSDLSourceMultiViewElement editorComponent = new WSDLSourceMultiViewElement(wsdlDataObject);
79                 return editorComponent;
80             }
81             return MultiViewFactory.BLANK_ELEMENT;
82     
83     }
84     
85     public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
86     out.writeObject(wsdlDataObject);
87     }
88
89     public void readExternal(ObjectInput JavaDoc in)
90     throws IOException JavaDoc, ClassNotFoundException JavaDoc
91     {
92     Object JavaDoc firstObject = in.readObject();
93     if (firstObject instanceof WSDLDataObject)
94         wsdlDataObject = (WSDLDataObject) firstObject;
95     }
96     
97 }
98
Popular Tags