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 org.openide.loaders.*;
27 import org.openide.filesystems.FileObject;
28 import org.openide.actions.*;
29 import org.openide.util.NbBundle;
30 import org.openide.util.actions.SystemAction;
31 
32 import org.openoffice.idesupport.zip.ParcelZipper;
33 
34 public class ParcelContentsFolderDataLoader extends UniFileLoader {
35 
ParcelContentsFolderDataLoader()36     public ParcelContentsFolderDataLoader() {
37         this("org.openide.loaders.DataFolder");
38     }
39 
ParcelContentsFolderDataLoader(String recognizedObjectClass)40     protected ParcelContentsFolderDataLoader(String recognizedObjectClass) {
41         super(recognizedObjectClass);
42     }
43 
defaultDisplayName()44     protected String defaultDisplayName() {
45         return "Office Script Parcel Contents";
46     }
47 
initialize()48     protected void initialize() {
49         super.initialize();
50     }
51 
findPrimaryFile(FileObject fo)52     protected FileObject findPrimaryFile(FileObject fo) {
53         if (fo.isFolder() == false ||
54             fo.getName().equals(ParcelZipper.CONTENTS_DIRNAME) == false ||
55             fo.getFileObject(ParcelZipper.PARCEL_DESCRIPTOR_XML) == null)
56             return null;
57 
58         return fo;
59     }
60 
defaultActions()61     protected SystemAction[] defaultActions() {
62         return new SystemAction[] {
63             SystemAction.get(PasteAction.class),
64             SystemAction.get(NewAction.class),
65             // null,
66             // SystemAction.get(PropertiesAction.class),
67         };
68     }
69 
createMultiObject(FileObject primaryFile)70     protected MultiDataObject createMultiObject(FileObject primaryFile)
71         throws DataObjectExistsException {
72         return new ParcelContentsFolder(primaryFile, this);
73     }
74 
createPrimaryEntry(MultiDataObject obj, FileObject primaryFile)75     protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
76         return new FileEntry.Folder(obj, primaryFile);
77     }
78 }
79