KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > core > SchemaDataLoader


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.schema.core;
21
22 import org.openide.filesystems.*;
23 import org.openide.loaders.*;
24 import org.openide.util.NbBundle;
25
26 /**
27  * XML Schema loader. It is mime type based.
28  *
29  * @author Petr Kuzel
30  * @author Jeri Lockhart
31  */

32 public class SchemaDataLoader extends UniFileLoader {
33
34     private static final long serialVersionUID = 3924626446133520078L;
35
36     public static final String JavaDoc MIME_TYPE = "application/x-schema+xml"; // NOI18N
37

38     /**
39      * Creates a new instance of SchemaDataLoader
40      */

41     public SchemaDataLoader() {
42         super("org.netbeans.modules.xml.schema.core.SchemaDataObject"); // NOI18N
43

44     }
45     
46     protected String JavaDoc actionsContext() {
47     return "Loaders/text/x-schema+xml/Actions/";
48     }
49     
50     /** Does initialization. Initializes display name,
51      * extension list and the actions. */

52     protected void initialize () {
53         super.initialize();
54         
55         ExtensionList ext = getExtensions();
56         ext.addMimeType (MIME_TYPE);
57         setExtensions (ext);
58     }
59     
60     /**
61      * Lazy init name.
62      */

63     protected String JavaDoc defaultDisplayName () {
64         return NbBundle.getMessage (SchemaDataLoader.class,"LBL_SchemaDataLoader_name");
65     }
66
67     /** Creates the right data object for given primary file.
68      * It is guaranteed that the provided file is realy primary file
69      * returned from the method findPrimaryFile.
70      *
71      * @param primaryFile the primary file
72      * @return the data object for this file
73      * @exception DataObjectExistsException if the primary file already has data object
74      */

75     protected MultiDataObject createMultiObject (FileObject primaryFile)
76             throws DataObjectExistsException, java.io.IOException JavaDoc {
77         return new SchemaDataObject (primaryFile, this);
78     }
79     
80 }
81
Popular Tags