1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.netbeans.modules.office.loader;
25 
26 import java.io.IOException;
27 
28 import org.openide.actions.*;
29 import org.openide.filesystems.*;
30 import org.openide.loaders.*;
31 import org.openide.util.NbBundle;
32 import org.openide.util.actions.SystemAction;
33 
34 import org.openoffice.idesupport.OfficeDocument;
35 
36 /** Recognizes single files in the Repository as being of a certain type.
37  *
38  * @author tomaso
39  */
40 public class ParcelDescriptorDataLoader extends UniFileLoader {
41 
ParcelDescriptorDataLoader()42     public ParcelDescriptorDataLoader() {
43         this("org.openoffice.netbeans.modules.office.loader.ParcelDescriptorDataObject");
44     }
45 
46     // Can be useful for subclasses:
ParcelDescriptorDataLoader(String recognizedObjectClass)47     protected ParcelDescriptorDataLoader(String recognizedObjectClass) {
48         super(recognizedObjectClass);
49     }
50 
defaultDisplayName()51     protected String defaultDisplayName() {
52         return OfficeDocument.OFFICE_PRODUCT_NAME + " Script Parcel Descriptor";
53     }
54 
initialize()55     protected void initialize() {
56         super.initialize();
57 
58         // ExtensionList extensions = new ExtensionList();
59         // extensions.addMimeType("text/x-parcel+xml");
60         // extensions.addExtension("pml");
61         getExtensions().addMimeType("text/x-parcel+xml");
62         // setExtensions(extensions);
63     }
64 
defaultActions()65     protected SystemAction[] defaultActions() {
66         return new SystemAction[] {
67             SystemAction.get(OpenAction.class),
68             // SystemAction.get(GenerateParcelAction.class),
69             null,
70             SystemAction.get(CutAction.class),
71             SystemAction.get(CopyAction.class),
72             SystemAction.get(PasteAction.class),
73             null,
74             SystemAction.get(DeleteAction.class),
75             SystemAction.get(RenameAction.class),
76             null,
77             // SystemAction.get(SaveAsTemplateAction.class),
78             // null,
79             // SystemAction.get(ToolsAction.class),
80             SystemAction.get(PropertiesAction.class),
81         };
82     }
83 
createMultiObject(FileObject primaryFile)84     protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
85         return new ParcelDescriptorDataObject(primaryFile, this);
86     }
87 }
88