KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.openide.filesystems.FileObject;
24 import org.openide.loaders.DataObjectExistsException;
25 import org.openide.loaders.ExtensionList;
26 import org.openide.loaders.MultiDataObject;
27 import org.openide.loaders.UniFileLoader;
28 import org.openide.util.NbBundle;
29
30 /**
31  * Recognizes .wsdl files as a single DataObject.
32  *
33  * @author Jerry Waldorf
34  */

35 public class WSDLDataLoader extends UniFileLoader {
36     public static final String JavaDoc PROP_EXTENSIONS = "extensions"; // NOI18N
37

38 // if we use text/*xml mime type then data editor support
39
// automatically recognize this mime type and show xml editor
40
// but there is another mime resolver registered with web svc module
41
// which has text/xml-wsdl as mime type and even though
42
// we install out wsdl editor data object before their data object
43
// it still picks mime resolver registered by web servc module
44
// so work around is to use same mime resovlver as websvc
45
// we need to ask them to disable mime resolver there-->
46

47 // public static final String MIME_TYPE = "text/x-wsdl+xml"; // NOI18N
48
public static final String JavaDoc MIME_TYPE = "text/xml-wsdl"; // NOI18N
49

50     private static final long serialVersionUID = -4579746482156152493L;
51     
52     public WSDLDataLoader() {
53         super("org.netbeans.modules.xml.wsdl.ui.netbeans.module.WSDLDataObject");
54     }
55     
56    /** Does initialization. Initializes display name,
57      * extension list and the actions. */

58     protected void initialize () {
59         super.initialize();
60         ExtensionList ext = getExtensions();
61         ext.addMimeType (MIME_TYPE);
62         //ext.addExtension("wsdl");
63
}
64     
65     
66     protected String JavaDoc defaultDisplayName () {
67         return NbBundle.getMessage(WSDLDataLoader.class, "LBL_loaderName");
68     }
69
70     protected String JavaDoc actionsContext() {
71         // Load actions from layer to avoid direct dependencies on
72
// modules with non-public API.
73
return "Loaders/text/xml-wsdl/Actions/";
74     }
75
76     protected MultiDataObject createMultiObject (FileObject primaryFile)
77     throws DataObjectExistsException, IOException JavaDoc {
78         return new WSDLDataObject(primaryFile, this);
79     }
80   
81 // /**
82
// * For a given file find the primary file.
83
// * @param fo the file to find the primary file for
84
// * @return the primary file for this file or null if this file
85
// * is not recognized by this loader.
86
// */
87
// protected FileObject findPrimaryFile(FileObject fo) {
88
// // never recognize folders.
89
// if (fo.isFolder()) return null;
90
//
91
// if (getExtensions().isRegistered(fo)) {
92
// return fo;
93
// }
94
// return null;
95
// }
96

97 // /** @return The list of extensions this loader recognizes. */
98
// public ExtensionList getExtensions() {
99
// ExtensionList extensions = (ExtensionList)getProperty(PROP_EXTENSIONS);
100
// if (extensions == null) {
101
// extensions = new ExtensionList();
102
// extensions.addExtension(WSDL_EXTENSION);
103
// putProperty(PROP_EXTENSIONS, extensions, false);
104
// }
105
// return extensions;
106
// }
107

108 // /**
109
// * Sets the extension list for this data loader.
110
// * @param ext new list of extensions.
111
// */
112
// public void setExtensions(ExtensionList ext) {
113
// putProperty(PROP_EXTENSIONS, ext, true);
114
// }
115
}
116
Popular Tags