KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > bugs > issues > IssuesLoader


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
20
21 package org.netbeans.modules.tasklist.bugs.issues;
22
23 import java.io.IOException JavaDoc;
24
25 import org.openide.actions.CopyAction;
26 import org.openide.actions.CutAction;
27 import org.openide.actions.DeleteAction;
28 import org.openide.actions.FileSystemAction;
29 import org.openide.actions.OpenAction;
30 import org.openide.actions.PasteAction;
31 import org.openide.actions.PropertiesAction;
32 import org.openide.actions.SaveAsTemplateAction;
33 import org.openide.actions.ToolsAction;
34 import org.openide.filesystems.FileObject;
35 import org.openide.loaders.DataObjectExistsException;
36 import org.openide.loaders.ExtensionList;
37 import org.openide.loaders.MultiDataObject;
38 import org.openide.loaders.UniFileLoader;
39 import org.openide.util.NbBundle;
40 import org.openide.util.actions.SystemAction;
41
42
43 /**
44  * Recognizes TaskList files such as iCalendar files that the user
45  * can browse, open etc.
46  *
47  * @author Tor Norbye, Trond Norbye
48  */

49 public final class IssuesLoader extends UniFileLoader {
50     
51     /** Serial version number */
52     static final long serialVersionUID = 1L;
53
54     /** store the popup menu actions here */
55     protected static SystemAction[] standardActions;
56
57     public IssuesLoader() {
58         super("org.netbeans.modules.tasklist.bugs.issues.IssuesDataObject");//NOI18N
59

60     // These extensions MUST match the ones in the editor kits...
61
ExtensionList extensions = new ExtensionList();
62         extensions.addExtension("issues"); // NOI18N iCalendar
63
setExtensions(extensions);
64     }
65
66     /**
67      * Defer creating the SystemAction array until its actually needed.
68      */

69     protected SystemAction[] createDefaultActions() {
70     return new SystemAction[] {
71         SystemAction.get(OpenAction.class),
72         SystemAction.get(FileSystemAction.class),
73         null,
74         SystemAction.get(CutAction.class),
75         SystemAction.get(CopyAction.class),
76         SystemAction.get(PasteAction.class),
77         null,
78         SystemAction.get(DeleteAction.class),
79         null,
80         SystemAction.get(SaveAsTemplateAction.class),
81         null,
82         SystemAction.get(ToolsAction.class),
83         SystemAction.get(PropertiesAction.class),
84     };
85     }
86
87     /**
88      * Return the SystemAction[]s array. Create it and store it if needed.
89      *
90      * @return The SystemAction[] array
91      */

92     protected SystemAction[] defaultActions() {
93     if (standardActions != null) {
94         return standardActions;
95     } else {
96         synchronized(getClass()) {
97         if (standardActions == null) {
98             standardActions = createDefaultActions();
99         }
100         }
101     }
102     return standardActions;
103     }
104
105     /** set the default display name */
106     protected String JavaDoc defaultDisplayName() {
107     return NbBundle.getMessage(IssuesLoader.class,
108                                    "BugsLoader_Name"); // NOI18N
109
}
110
111     protected MultiDataObject createMultiObject(FileObject primaryFile)
112     throws DataObjectExistsException, IOException JavaDoc {
113     return new IssuesDataObject(primaryFile, this);
114     }
115 }
116
117
Popular Tags