View Javadoc
1   package info.mikethomas.fahview.v6project.files.queue;
2   
3   /*
4    * #%L
5    * This file is part of FAHView-v6project.
6    * %%
7    * Copyright (C) 2011 - 2017 Mike Thomas <mikepthomas@outlook.com>
8    * %%
9    * FAHView is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as published by
11   * the Free Software Foundation, either version 3 of the License, or
12   * (at your option) any later version.
13   * %
14   * FAHView is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * %
19   * You should have received a copy of the GNU General Public License
20   * along with FAHView.  If not, see <http://www.gnu.org/licenses/>.
21   * #L%
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   * <p>QueueFileDataObject class.</p>
42   *
43   * @author <a href="mailto:mikepthomas@outlook.com">Michael Thomas</a>
44   * @version $Id: $Id
45   */
46  @Messages({
47      "LBL_QueueFile_LOADER=Files of QueueFile"
48  })
49  @MIMEResolver.ExtensionRegistration(
50          displayName = "#LBL_QueueFile_LOADER",
51          mimeType = "application/x-fahqueue",
52          extension = {"dat", "DAT"},
53          position = 200)
54  @DataObject.Registration(
55          mimeType = "application/x-fahqueue",
56          iconBase = "info/mikethomas/fahview/v6project/files/queue/QueueFile.png",
57          displayName = "#LBL_QueueFile_LOADER",
58          position = 300)
59  @ActionReferences({
60      @ActionReference(
61              path = "Loaders/application/x-fahqueue/Actions",
62              id =
63              @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
64              position = 100,
65              separatorAfter = 200),
66      @ActionReference(
67              path = "Loaders/application/x-fahqueue/Actions",
68              id =
69              @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
70              position = 300),
71      @ActionReference(
72              path = "Loaders/application/x-fahqueue/Actions",
73              id =
74              @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
75              position = 400,
76              separatorAfter = 500),
77      @ActionReference(
78              path = "Loaders/application/x-fahqueue/Actions",
79              id =
80              @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
81              position = 600),
82      @ActionReference(
83              path = "Loaders/application/x-fahqueue/Actions",
84              id =
85              @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
86              position = 700,
87              separatorAfter = 800),
88      @ActionReference(
89              path = "Loaders/application/x-fahqueue/Actions",
90              id =
91              @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
92              position = 900,
93              separatorAfter = 1000),
94      @ActionReference(
95              path = "Loaders/application/x-fahqueue/Actions",
96              id =
97              @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
98              position = 1100,
99              separatorAfter = 1200),
100     @ActionReference(
101             path = "Loaders/application/x-fahqueue/Actions",
102             id =
103             @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
104             position = 1300),
105     @ActionReference(
106             path = "Loaders/application/x-fahqueue/Actions",
107             id =
108             @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
109             position = 1400)
110 })
111 public class QueueFileDataObject extends MultiDataObject {
112 
113     /**
114      * <p>Constructor for QueueFileDataObject.</p>
115      *
116      * @param pf a {@link org.openide.filesystems.FileObject} object.
117      * @param loader a {@link org.openide.loaders.MultiFileLoader} object.
118      * @throws org.openide.loaders.DataObjectExistsException if any.
119      * @throws java.io.IOException if any.
120      */
121     public QueueFileDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
122         super(pf, loader);
123         registerEditor("application/x-fahqueue", true);
124     }
125 
126     /** {@inheritDoc} */
127     @Override
128     protected int associateLookup() {
129         return 1;
130     }
131 
132     /**
133      * <p>createEditor.</p>
134      *
135      * @param lkp a {@link org.openide.util.Lookup} object.
136      * @return a {@link org.netbeans.core.spi.multiview.text.MultiViewEditorElement} object.
137      */
138     @MultiViewElement.Registration(
139             displayName = "#LBL_QueueFile_EDITOR",
140             iconBase = "info/mikethomas/fahview/v6project/files/queue/QueueFile.png",
141             mimeType = "application/x-fahqueue",
142             persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
143             preferredID = "QueueFile",
144             position = 1000)
145     @Messages("LBL_QueueFile_EDITOR=Source")
146     public static MultiViewEditorElement createEditor(Lookup lkp) {
147         return new MultiViewEditorElement(lkp);
148     }
149 }