1 package info.mikethomas.fahview.v6project.files.config;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.io.IOException;
25 import org.netbeans.core.spi.multiview.MultiViewElement;
26 import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
27 import org.openide.awt.ActionID;
28 import org.openide.awt.ActionReference;
29 import org.openide.awt.ActionReferences;
30 import org.openide.filesystems.FileObject;
31 import org.openide.filesystems.MIMEResolver;
32 import org.openide.loaders.DataObject;
33 import org.openide.loaders.DataObjectExistsException;
34 import org.openide.loaders.MultiDataObject;
35 import org.openide.loaders.MultiFileLoader;
36 import org.openide.util.Lookup;
37 import org.openide.util.NbBundle.Messages;
38 import org.openide.windows.TopComponent;
39
40
41
42
43
44
45
46 @Messages({
47 "LBL_ConfigFile_LOADER=Files of ConfigFile"
48 })
49 @MIMEResolver.ExtensionRegistration(
50 displayName = "#LBL_ConfigFile_LOADER",
51 mimeType = "text/x-fahconfig",
52 extension = {"cfg", "CFG"},
53 position = 100)
54 @DataObject.Registration(
55 mimeType = "text/x-fahconfig",
56 iconBase = "info/mikethomas/fahview/v6project/files/config/ConfigFile.png",
57 displayName = "#LBL_ConfigFile_LOADER",
58 position = 300)
59 @ActionReferences({
60 @ActionReference(
61 path = "Loaders/text/x-fahconfig/Actions",
62 id =
63 @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
64 position = 100,
65 separatorAfter = 200),
66 @ActionReference(
67 path = "Loaders/text/x-fahconfig/Actions",
68 id =
69 @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
70 position = 300),
71 @ActionReference(
72 path = "Loaders/text/x-fahconfig/Actions",
73 id =
74 @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
75 position = 400,
76 separatorAfter = 500),
77 @ActionReference(
78 path = "Loaders/text/x-fahconfig/Actions",
79 id =
80 @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
81 position = 600),
82 @ActionReference(
83 path = "Loaders/text/x-fahconfig/Actions",
84 id =
85 @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
86 position = 700,
87 separatorAfter = 800),
88 @ActionReference(
89 path = "Loaders/text/x-fahconfig/Actions",
90 id =
91 @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
92 position = 900,
93 separatorAfter = 1000),
94 @ActionReference(
95 path = "Loaders/text/x-fahconfig/Actions",
96 id =
97 @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
98 position = 1100,
99 separatorAfter = 1200),
100 @ActionReference(
101 path = "Loaders/text/x-fahconfig/Actions",
102 id =
103 @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
104 position = 1300),
105 @ActionReference(
106 path = "Loaders/text/x-fahconfig/Actions",
107 id =
108 @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
109 position = 1400)
110 })
111 public class ConfigFileDataObject extends MultiDataObject {
112
113
114
115
116
117
118
119
120
121 public ConfigFileDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
122 super(pf, loader);
123 registerEditor("text/x-fahconfig", true);
124 }
125
126
127 @Override
128 protected int associateLookup() {
129 return 1;
130 }
131
132
133
134
135
136
137
138 @MultiViewElement.Registration(
139 displayName = "#LBL_ConfigFile_EDITOR",
140 iconBase = "info/mikethomas/fahview/v6project/files/config/ConfigFile.png",
141 mimeType = "text/x-fahconfig",
142 persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
143 preferredID = "ConfigFile",
144 position = 1000)
145 @Messages("LBL_ConfigFile_EDITOR=Source")
146 public static MultiViewEditorElement createEditor(Lookup lkp) {
147 return new MultiViewEditorElement(lkp);
148 }
149 }