KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > design > multiview > SourceMultiViewDesc


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.websvc.design.multiview;
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 import org.netbeans.core.spi.multiview.MultiViewDescription;
27 import org.netbeans.core.spi.multiview.MultiViewElement;
28 import org.netbeans.core.spi.multiview.MultiViewFactory;
29 import org.openide.loaders.DataObject;
30 import org.openide.text.DataEditorSupport;
31 import org.openide.util.NbBundle;
32 import org.openide.windows.TopComponent;
33 /**
34  * The source editor desc for JaxWS node.
35  * @author Ajit Bhate
36  */

37 public class SourceMultiViewDesc
38                 implements MultiViewDescription, Serializable JavaDoc {
39     
40     
41     private static final long serialVersionUID = -4505309173196320880L;
42     /**
43      *
44      */

45     public static final String JavaDoc PREFERRED_ID = "webservice-sourceview";
46     private MultiViewSupport mvSupport;
47     
48     /**
49      *
50      */

51     public SourceMultiViewDesc() {
52     }
53     
54     /**
55      * Creates a new instance of SchemaSourceMultiviewDesc
56      * @param mvSupport
57      */

58     public SourceMultiViewDesc(MultiViewSupport mvSupport) {
59         this.mvSupport = mvSupport;
60     }
61
62     public String JavaDoc preferredID() {
63     return PREFERRED_ID;
64     }
65
66     public int getPersistenceType() {
67             return TopComponent.PERSISTENCE_ONLY_OPENED;
68     }
69
70     public java.awt.Image JavaDoc getIcon() {
71         return MultiViewSupport.SERVICE_BADGE;
72     }
73
74     public org.openide.util.HelpCtx getHelpCtx() {
75             return org.openide.util.HelpCtx.DEFAULT_HELP;
76     }
77
78     public String JavaDoc getDisplayName() {
79         return NbBundle.getMessage(SourceMultiViewDesc.class, "LBL_sourceView_name");
80     }
81
82     public MultiViewElement createElement() {
83         DataObject dataObject = mvSupport.getDataObject();
84         DataEditorSupport editorSupport = (DataEditorSupport)
85                 dataObject.getLookup().lookup(DataEditorSupport.class);
86         if (editorSupport != null) {
87             SourceMultiViewElement editorComponent =
88                     new SourceMultiViewElement(mvSupport,editorSupport);
89             return editorComponent;
90         }
91         return MultiViewFactory.BLANK_ELEMENT;
92     }
93     
94     /**
95      *
96      * @param out
97      * @throws java.io.IOException
98      */

99     public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
100     out.writeObject(mvSupport);
101     }
102
103     /**
104      *
105      * @param in
106      * @throws java.io.IOException
107      * @throws java.lang.ClassNotFoundException
108      */

109     public void readExternal(ObjectInput JavaDoc in)
110     throws IOException JavaDoc, ClassNotFoundException JavaDoc
111     {
112     Object JavaDoc firstObject = in.readObject();
113     if (firstObject instanceof MultiViewSupport)
114         mvSupport = (MultiViewSupport) firstObject;
115     }
116     
117 }
118
Popular Tags