diff options
author | David Ostrovsky <david@ostrovsky.org> | 2014-10-09 10:47:42 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-10-10 09:41:29 +0200 |
commit | a1552a0ec3fcddd968db274ef41bc2452c50bed9 (patch) | |
tree | e5f97283967605204d666c196b4bc5f522d6e08c /scripting/java/org/openoffice/netbeans/modules/office/loader | |
parent | 87bf3fb4a5def8b0536d44ab406dbd31b09c0daf (diff) |
Scripting: Remove org package
Change-Id: If0b6ac87b5d53da43557dee5824e9413a260ba7c
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/loader')
19 files changed, 0 insertions, 1661 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties deleted file mode 100644 index 9bc1619697f1..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties +++ /dev/null @@ -1,30 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# -# Datasystems API -#PROP_myProp=<name of my property> -#HINT_myProp=<description of my property> -#LBL_DataNode_exec_sheet=Execution -#HINT_DataNode_exec_sheet=Properties pertaining to compiling, running, and debugging. -# x-no-translate -LBL_loaderName=<display name of the data loader> -# Datasystems API -#PROP_myProp=<name of my property> -#HINT_myProp=<description of my property> -#LBL_DataNode_exec_sheet=Execution -#HINT_DataNode_exec_sheet=Properties pertaining to compiling, running, and debugging. -LBL_loaderName=<display name of the data loader> diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.java deleted file mode 100644 index 268c6054b2bb..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.IOException; -import java.io.File; - -import org.openide.actions.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.util.actions.SystemAction; - -import org.openoffice.netbeans.modules.office.actions.MountDocumentAction; - -/** Recognizes single files in the Repository as being of a certain type. - */ -public class OfficeDocumentDataLoader extends UniFileLoader { - - public OfficeDocumentDataLoader() { - this("org.openoffice.netbeans.modules.office.loader.OfficeDocumentDataObject"); - } - - // Can be useful for subclasses: - protected OfficeDocumentDataLoader(String recognizedObjectClass) { - super(recognizedObjectClass); - } - - protected String defaultDisplayName() { - return "Office Document"; - } - - protected void initialize() { - super.initialize(); - - ExtensionList extensions = new ExtensionList(); - extensions.addExtension("sxw"); - extensions.addExtension("sxc"); - extensions.addExtension("sxd"); - extensions.addExtension("sxi"); - setExtensions(extensions); - } - - protected FileObject findPrimaryFile(FileObject fo) { - ExtensionList extensions = getExtensions(); - - if (!extensions.isRegistered(fo)) - return null; - - File document = FileUtil.toFile(fo); - JarFileSystem jarFs = new JarFileSystem(); - - try { - jarFs.setJarFile(document); - } catch (IOException e) { - return null; - } catch (Exception e) { - return null; - } - - return fo; - } - - protected SystemAction[] defaultActions() { - return new SystemAction[] { - SystemAction.get(OpenAction.class), - null, - SystemAction.get(CutAction.class), - SystemAction.get(CopyAction.class), - SystemAction.get(PasteAction.class), - null, - SystemAction.get(DeleteAction.class), - SystemAction.get(RenameAction.class), - null, - SystemAction.get(PropertiesAction.class), - }; - } - - protected MultiDataObject createMultiObject(FileObject primaryFile) throws - DataObjectExistsException, IOException { - return new OfficeDocumentDataObject(primaryFile, this); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoaderBeanInfo.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoaderBeanInfo.java deleted file mode 100644 index 1f036b155348..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoaderBeanInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.Image; -import java.beans.*; - -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -public class OfficeDocumentDataLoaderBeanInfo extends SimpleBeanInfo { - - // If you have additional properties: - /* - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor myProp = new PropertyDescriptor("myProp", OfficeDocumentDataLoader.class); - myProp.setDisplayName(NbBundle.getMessage(OfficeDocumentDataLoaderBeanInfo.class, "PROP_myProp")); - myProp.setShortDescription(NbBundle.getMessage(OfficeDocumentDataLoaderBeanInfo.class, "HINT_myProp")); - return new PropertyDescriptor[] {myProp}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - */ - - public BeanInfo[] getAdditionalBeanInfo() { - try { - // I.e. MultiFileLoader.class or UniFileLoader.class. - return new BeanInfo[] {Introspector.getBeanInfo(OfficeDocumentDataLoader.class.getSuperclass())}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - - public Image getIcon(int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/resources/OfficeIcon.gif"); - } else { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/resources/OfficeIcon32.gif"); - } - } - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataNode.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataNode.java deleted file mode 100644 index 32d438f1f3c2..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataNode.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.datatransfer.Transferable; -import java.util.List; -import java.io.*; - -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.util.NbBundle; -import org.openide.filesystems.*; - -import org.openoffice.netbeans.modules.office.actions.OfficeDocumentCookie; -import org.openoffice.netbeans.modules.office.nodes.OfficeDocumentChildren; - -/** A node to represent this object. - */ -public class OfficeDocumentDataNode extends DataNode { - - public OfficeDocumentDataNode(OfficeDocumentDataObject obj) { - this(obj, new OfficeDocumentChildren((OfficeDocumentCookie) - obj.getCookie(OfficeDocumentCookie.class))); - } - - public OfficeDocumentDataNode(OfficeDocumentDataObject obj, Children ch) { - super(obj, ch); - setIconBase("/org/openoffice/netbeans/modules/office/resources/OfficeIcon"); - } - - protected OfficeDocumentDataObject getOfficeDocumentDataObject() { - return (OfficeDocumentDataObject)getDataObject(); - } - - // Allow for pasting of Script Parcels to Office Documents - protected void createPasteTypes(Transferable t, List ls) { - Node[] copies = NodeTransfer.nodes(t, NodeTransfer.COPY); - - if (copies != null) { - for (int i = 0; i < copies.length; i++) { - if (copies[i] instanceof ParcelDataNode) { - File source = FileUtil.toFile(((ParcelDataNode) - copies[i]).getDataObject().getPrimaryFile()); - File target = FileUtil.toFile(getDataObject().getPrimaryFile()); - - if (source.exists() && source.canRead() && - target.exists() && target.canWrite()) { - ls.add(new ParcelDataNode.ParcelPasteType((ParcelDataNode)copies[i], target, - false)); - } - } - } - } - - Node[] moves = NodeTransfer.nodes(t, NodeTransfer.MOVE); - - if (moves != null) { - for (int i = 0; i < moves.length; i++) { - if (moves[i] instanceof ParcelDataNode) { - File source = FileUtil.toFile(((ParcelDataNode) - moves[i]).getDataObject().getPrimaryFile()); - File target = FileUtil.toFile(getDataObject().getPrimaryFile()); - - if (source.exists() && source.canRead() && - target.exists() && target.canWrite()) { - ls.add(new ParcelDataNode.ParcelPasteType((ParcelDataNode)moves[i], target, - true)); - } - } - } - } - - // Also try superclass, but give it lower priority: - super.createPasteTypes(t, ls); - } - - /* Example of adding Executor / Debugger / Arguments to node: - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = sheet.get(ExecSupport.PROP_EXECUTION); - if (set == null) { - set = new Sheet.Set(); - set.setName(ExecSupport.PROP_EXECUTION); - set.setDisplayName(NbBundle.getMessage(OfficeDocumentDataNode.class, "LBL_DataNode_exec_sheet")); - set.setShortDescription(NbBundle.getMessage(OfficeDocumentDataNode.class, "HINT_DataNode_exec_sheet")); - } - ((ExecSupport)getCookie(ExecSupport.class)).addProperties(set); - // Maybe: - ((CompilerSupport)getCookie(CompilerSupport.class)).addProperties(set); - sheet.put(set); - return sheet; - } - */ - - // Don't use getDefaultAction(); just make that first in the data loader's getActions list - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataObject.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataObject.java deleted file mode 100644 index 742b7d882968..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataObject.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import org.openide.actions.*; -import org.openide.cookies.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.util.HelpCtx; - -import org.openoffice.netbeans.modules.office.actions.*; - -public class OfficeDocumentDataObject extends MultiDataObject { - - public OfficeDocumentDataObject(FileObject pf, - OfficeDocumentDataLoader loader) throws DataObjectExistsException { - super(pf, loader); - init(); - } - - private void init() { - CookieSet cookies = getCookieSet(); - cookies.add(new OfficeDocumentSupport(this)); - } - - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - protected Node createNodeDelegate() { - return new OfficeDocumentDataNode(this); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java deleted file mode 100644 index 7ac5ce14069a..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.IOException; - -import org.openide.TopManager; -import org.openide.NotifyDescriptor; -import org.openide.ErrorManager; - -import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileLock; -import org.openide.filesystems.FileUtil; -import org.openide.filesystems.FileSystem; -import org.openide.filesystems.Repository; - -import org.openide.loaders.DataObject; -import org.openide.loaders.DataFolder; -import org.openide.loaders.DataObjectExistsException; - -import org.openide.nodes.Node; -import org.openide.util.datatransfer.NewType; - -import org.openoffice.netbeans.modules.office.actions.ParcelFolderCookie; -import org.openoffice.netbeans.modules.office.utils.PackageRemover; - -public class ParcelContentsFolder extends DataFolder { - public ParcelContentsFolder(FileObject pf, - ParcelContentsFolderDataLoader loader) - throws DataObjectExistsException { - super(pf, loader); - } - - public Node createNodeDelegate() { - return new DataFolder.FolderNode() { - public NewType[] getNewTypes() { - NewType[] newtypes = new NewType[1]; - newtypes[0] = new NewType() { - public String getName() { - return "New Script"; - } - - public void create() { - DataFolder contents = (DataFolder)getDataObject(); - ParcelFolderCookie cookie = - (ParcelFolderCookie)contents.getFolder(). - getCookie(ParcelFolderCookie.class); - - String language = cookie.getLanguage(); - ParcelContentsFolder.createEmptyScript(contents, - language); - } - }; - return newtypes; - } - }; - } - - public static void createEmptyScript(DataFolder parent, String language) { - String sourceFile = "Templates/OfficeScripting/EmptyScript/Empty"; - - if (language.equalsIgnoreCase("java")) { - sourceFile += ".java"; - } - else if (language.equalsIgnoreCase("beanshell")) { - sourceFile += ".bsh"; - } else { - NotifyDescriptor d = new NotifyDescriptor.Message( - "Language not defined for this Parcel Folder"); - TopManager.getDefault().notify(d); - return; - } - - FileSystem fs = Repository.getDefault().getDefaultFileSystem(); - DataObject result = null; - - try { - DataObject dObj = DataObject.find(fs.findResource(sourceFile)); - result = dObj.createFromTemplate(parent); - } catch (IOException ioe) { - ErrorManager.getDefault().notify(ioe); - } - - FileObject fo = result.getPrimaryFile(); - - if (fo.getExt().equals("java")) { - FileLock lock = null; - - try { - PackageRemover.removeDeclaration(FileUtil.toFile(fo)); - - // IssueZilla 11986 - rename the FileObject - // so the JavaNode is resynchronized - lock = fo.lock(); - - if (lock != null) { - fo.rename(lock, fo.getName(), fo.getExt()); - } - } catch (IOException ioe) { - NotifyDescriptor d = new NotifyDescriptor.Message( - "Error removing package declaration from file: " + - fo.getNameExt() + - ". You should manually remove this declaration " + - "before building the Parcel Recipe"); - TopManager.getDefault().notify(d); - } finally { - if (lock != null) { - lock.releaseLock(); - } - } - } - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.java deleted file mode 100644 index 77a0e490b192..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import org.openide.loaders.*; -import org.openide.filesystems.FileObject; -import org.openide.actions.*; -import org.openide.util.NbBundle; -import org.openide.util.actions.SystemAction; - -import org.openoffice.idesupport.zip.ParcelZipper; - -public class ParcelContentsFolderDataLoader extends UniFileLoader { - - public ParcelContentsFolderDataLoader() { - this("org.openide.loaders.DataFolder"); - } - - protected ParcelContentsFolderDataLoader(String recognizedObjectClass) { - super(recognizedObjectClass); - } - - protected String defaultDisplayName() { - return "Office Script Parcel Contents"; - } - - protected FileObject findPrimaryFile(FileObject fo) { - if (!fo.isFolder() || - !fo.getName().equals(ParcelZipper.CONTENTS_DIRNAME) || - fo.getFileObject(ParcelZipper.PARCEL_DESCRIPTOR_XML) == null) - return null; - - return fo; - } - - protected SystemAction[] defaultActions() { - return new SystemAction[] { - SystemAction.get(PasteAction.class), - SystemAction.get(NewAction.class), - // null, - // SystemAction.get(PropertiesAction.class), - }; - } - - protected MultiDataObject createMultiObject(FileObject primaryFile) - throws DataObjectExistsException { - return new ParcelContentsFolder(primaryFile, this); - } - - protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, - FileObject primaryFile) { - return new FileEntry.Folder(obj, primaryFile); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoaderBeanInfo.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoaderBeanInfo.java deleted file mode 100644 index b5c925973199..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoaderBeanInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.Image; -import java.beans.*; - -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -/** Description of {@link ParcelFolderDataLoader}. - */ -public class ParcelContentsFolderDataLoaderBeanInfo extends SimpleBeanInfo { - - // If you have additional properties: - /* - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor myProp = new PropertyDescriptor("myProp", ParcelFolderDataLoader.class); - myProp.setDisplayName(NbBundle.getMessage(ParcelFolderDataLoaderBeanInfo.class, "PROP_myProp")); - myProp.setShortDescription(NbBundle.getMessage(ParcelFolderDataLoaderBeanInfo.class, "HINT_myProp")); - return new PropertyDescriptor[] {myProp}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - */ - - public BeanInfo[] getAdditionalBeanInfo() { - try { - // I.e. MultiFileLoader.class or UniFileLoader.class. - return new BeanInfo[] {Introspector.getBeanInfo(ParcelContentsFolderDataLoader.class.getSuperclass())}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - - public Image getIcon(int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelFolderDataIcon.gif"); - } else { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelFolderDataIcon32.gif"); - } - } - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.java deleted file mode 100644 index 86e86742c43e..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.IOException; -import java.io.File; - -import org.openide.actions.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.util.actions.SystemAction; - -import org.openoffice.netbeans.modules.office.actions.*; -import org.openoffice.idesupport.zip.ParcelZipper; - -/** Recognizes single files in the Repository as being of a certain type. - */ -public class ParcelDataLoader extends UniFileLoader { - - public ParcelDataLoader() { - this("org.openoffice.netbeans.modules.office.loader.ParcelDataObject"); - } - - // Can be useful for subclasses: - protected ParcelDataLoader(String recognizedObjectClass) { - super(recognizedObjectClass); - } - - protected String defaultDisplayName() { - return "Office Script Parcel"; - } - - protected void initialize() { - super.initialize(); - - ExtensionList extensions = new ExtensionList(); - extensions.addExtension(ParcelZipper.PARCEL_EXTENSION); - setExtensions(extensions); - } - - protected SystemAction[] defaultActions() { - return new SystemAction[] { - SystemAction.get(DeployParcelAction.class), - null, - SystemAction.get(CutAction.class), - SystemAction.get(CopyAction.class), - null, - SystemAction.get(DeleteAction.class), - SystemAction.get(RenameAction.class), - null, - SystemAction.get(PropertiesAction.class), - }; - } - - protected MultiDataObject createMultiObject(FileObject primaryFile) throws - DataObjectExistsException, IOException { - return new ParcelDataObject(primaryFile, this); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoaderBeanInfo.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoaderBeanInfo.java deleted file mode 100644 index 68c0374a55e9..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoaderBeanInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.Image; -import java.beans.*; - -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -/** Description of {@link ParcelDataLoader}. - */ -public class ParcelDataLoaderBeanInfo extends SimpleBeanInfo { - - // If you have additional properties: - /* - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor myProp = new PropertyDescriptor("myProp", ParcelDataLoader.class); - myProp.setDisplayName(NbBundle.getMessage(ParcelDataLoaderBeanInfo.class, "PROP_myProp")); - myProp.setShortDescription(NbBundle.getMessage(ParcelDataLoaderBeanInfo.class, "HINT_myProp")); - return new PropertyDescriptor[] {myProp}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - */ - - public BeanInfo[] getAdditionalBeanInfo() { - try { - // I.e. MultiFileLoader.class or UniFileLoader.class. - return new BeanInfo[] {Introspector.getBeanInfo(ParcelDataLoader.class.getSuperclass())}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - - public Image getIcon(int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelDataIcon.gif"); - } else { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelDataIcon32.gif"); - } - } - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataNode.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataNode.java deleted file mode 100644 index cb51b982e7c4..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataNode.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.*; -import java.awt.datatransfer.Transferable; -import java.util.zip.*; - -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.filesystems.FileObject; -import org.openide.util.NbBundle; -import org.openide.util.datatransfer.*; -import org.openide.ErrorManager; -import org.openide.windows.OutputWriter; - -import org.openoffice.netbeans.modules.office.actions.ParcelCookie; - -/** A node to represent this object. - */ -public class ParcelDataNode extends DataNode { - - public ParcelDataNode(ParcelDataObject obj) { - this(obj, Children.LEAF); - } - - public ParcelDataNode(ParcelDataObject obj, Children ch) { - super(obj, ch); - setIconBase("/org/openoffice/netbeans/modules/office/resources/ParcelIcon"); - } - - protected ParcelDataObject getParcelDataObject() { - return (ParcelDataObject)getDataObject(); - } - - public static class ParcelPasteType extends PasteType { - ParcelDataNode sourceParcel = null; - File targetDocument = null; - boolean isCut = false; - - public ParcelPasteType(ParcelDataNode sourceParcel, - File targetDocument, boolean isCut) { - this.sourceParcel = sourceParcel; - this.targetDocument = targetDocument; - this.isCut = isCut; - } - - public Transferable paste() { - ParcelCookie parcelCookie = - (ParcelCookie)sourceParcel.getCookie(ParcelCookie.class); - parcelCookie.deploy(targetDocument); - - if (isCut) { - FileObject fo = sourceParcel.getDataObject().getPrimaryFile(); - - try { - fo.delete(); - } catch (IOException ioe) {} - - return ExTransferable.EMPTY; - } else { - return null; - } - } - } - - /* Example of adding Executor / Debugger / Arguments to node: - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = sheet.get(ExecSupport.PROP_EXECUTION); - if (set == null) { - set = new Sheet.Set(); - set.setName(ExecSupport.PROP_EXECUTION); - set.setDisplayName(NbBundle.getMessage(ParcelDataNode.class, "LBL_DataNode_exec_sheet")); - set.setShortDescription(NbBundle.getMessage(ParcelDataNode.class, "HINT_DataNode_exec_sheet")); - } - ((ExecSupport)getCookie(ExecSupport.class)).addProperties(set); - // Maybe: - ((CompilerSupport)getCookie(CompilerSupport.class)).addProperties(set); - sheet.put(set); - return sheet; - } - */ - - // Don't use getDefaultAction(); just make that first in the data loader's getActions list - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataObject.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataObject.java deleted file mode 100644 index 0c9cf1720ca3..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataObject.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import org.openide.actions.*; -import org.openide.cookies.*; -import org.openide.filesystems.FileObject; -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.util.HelpCtx; - -import org.openoffice.netbeans.modules.office.actions.*; - -/** Represents a Parcel object in the Repository. - */ -public class ParcelDataObject extends MultiDataObject { - - public ParcelDataObject(FileObject pf, - ParcelDataLoader loader) throws DataObjectExistsException { - super(pf, loader); - init(); - } - - private void init() { - CookieSet cookies = getCookieSet(); - cookies.add(new ParcelSupport(getPrimaryFile())); - } - - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - // If you add context help, change to: - // return new HelpCtx(ParcelDataObject.class); - } - - protected Node createNodeDelegate() { - return new ParcelDataNode(this); - } - - /* If you made an Editor Support you will want to add these methods: - - final void addSaveCookie(SaveCookie save) { - getCookieSet().add(save); - } - - final void removeSaveCookie(SaveCookie save) { - getCookieSet().remove(save); - } - - */ - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.java deleted file mode 100644 index 58b94c91031c..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.IOException; - -import org.openide.actions.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.util.actions.SystemAction; - -import org.openoffice.idesupport.OfficeDocument; - -/** Recognizes single files in the Repository as being of a certain type. - */ -public class ParcelDescriptorDataLoader extends UniFileLoader { - - public ParcelDescriptorDataLoader() { - this("org.openoffice.netbeans.modules.office.loader.ParcelDescriptorDataObject"); - } - - // Can be useful for subclasses: - protected ParcelDescriptorDataLoader(String recognizedObjectClass) { - super(recognizedObjectClass); - } - - protected String defaultDisplayName() { - return OfficeDocument.OFFICE_PRODUCT_NAME + " Script Parcel Descriptor"; - } - - protected void initialize() { - super.initialize(); - - getExtensions().addMimeType("text/x-parcel+xml"); - } - - protected SystemAction[] defaultActions() { - return new SystemAction[] { - SystemAction.get(OpenAction.class), - null, - SystemAction.get(CutAction.class), - SystemAction.get(CopyAction.class), - SystemAction.get(PasteAction.class), - null, - SystemAction.get(DeleteAction.class), - SystemAction.get(RenameAction.class), - null, - SystemAction.get(PropertiesAction.class), - }; - } - - protected MultiDataObject createMultiObject(FileObject primaryFile) throws - DataObjectExistsException, IOException { - return new ParcelDescriptorDataObject(primaryFile, this); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoaderBeanInfo.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoaderBeanInfo.java deleted file mode 100644 index f9824ca29b21..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoaderBeanInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.Image; -import java.beans.*; - -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -/** Description of {@link ParcelDescriptorDataLoader}. - */ -public class ParcelDescriptorDataLoaderBeanInfo extends SimpleBeanInfo { - - // If you have additional properties: - /* - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor myProp = new PropertyDescriptor("myProp", ParcelDescriptorDataLoader.class); - myProp.setDisplayName(NbBundle.getMessage(ParcelDescriptorDataLoaderBeanInfo.class, "PROP_myProp")); - myProp.setShortDescription(NbBundle.getMessage(ParcelDescriptorDataLoaderBeanInfo.class, "HINT_myProp")); - return new PropertyDescriptor[] {myProp}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - */ - - public BeanInfo[] getAdditionalBeanInfo() { - try { - // I.e. MultiFileLoader.class or UniFileLoader.class. - return new BeanInfo[] {Introspector.getBeanInfo(ParcelDescriptorDataLoader.class.getSuperclass())}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - - public Image getIcon(int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelDescriptorDataIcon.gif"); - } else { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelDescriptorDataIcon32.gif"); - } - } - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataNode.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataNode.java deleted file mode 100644 index e92a321cd726..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataNode.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.util.NbBundle; - -import org.openoffice.netbeans.modules.office.nodes.*; -import org.openoffice.netbeans.modules.office.actions.*; - -/** A node to represent this object. - */ -public class ParcelDescriptorDataNode extends DataNode { - - public ParcelDescriptorDataNode(ParcelDescriptorDataObject obj) { - this(obj, Children.LEAF); - } - - public ParcelDescriptorDataNode(ParcelDescriptorDataObject obj, Children ch) { - super(obj, ch); - setHidden(true); - setIconBase("/org/openoffice/netbeans/modules/office/resources/OfficeIcon"); - } - - protected ParcelDescriptorDataObject getParcelDescriptorDataObject() { - return (ParcelDescriptorDataObject)getDataObject(); - } - - public boolean canRename() { - return false; - } - - /* Example of adding Executor / Debugger / Arguments to node: - protected Sheet createSheet() { - Sheet sheet = super.createSheet(); - Sheet.Set set = sheet.get(ExecSupport.PROP_EXECUTION); - if (set == null) { - set = new Sheet.Set(); - set.setName(ExecSupport.PROP_EXECUTION); - set.setDisplayName(NbBundle.getMessage(ParcelDescriptorDataNode.class, "LBL_DataNode_exec_sheet")); - set.setShortDescription(NbBundle.getMessage(ParcelDescriptorDataNode.class, "HINT_DataNode_exec_sheet")); - } - ((ExecSupport)getCookie(ExecSupport.class)).addProperties(set); - // Maybe: - ((CompilerSupport)getCookie(CompilerSupport.class)).addProperties(set); - sheet.put(set); - return sheet; - } - */ - - // Don't use getDefaultAction(); just make that first in the data loader's getActions list - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataObject.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataObject.java deleted file mode 100644 index f72735cfc2ad..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataObject.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import org.openide.actions.*; -import org.openide.cookies.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.nodes.*; -import org.openide.util.HelpCtx; - -import org.openoffice.netbeans.modules.office.actions.ParcelDescriptorEditorSupport; -import org.openoffice.netbeans.modules.office.actions.ParcelDescriptorParserSupport; - -/** Represents a ParcelDescriptor object in the Repository. - */ -public class ParcelDescriptorDataObject extends MultiDataObject { - - private boolean canParse = false; - - public ParcelDescriptorDataObject(FileObject pf, - ParcelDescriptorDataLoader loader) throws DataObjectExistsException { - super(pf, loader); - init(); - } - - private void init() { - FileObject fo = getPrimaryFile(); - - if (FileUtil.toFile(fo) != null) - canParse = true; - - CookieSet cookies = getCookieSet(); - cookies.add(new ParcelDescriptorEditorSupport(this)); - - if (canParse) - cookies.add(new ParcelDescriptorParserSupport(getPrimaryFile())); - } - - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - protected Node createNodeDelegate() { - if (canParse) - return new ParcelDescriptorDataNode(this); - else - return new ParcelDescriptorDataNode(this, Children.LEAF); - } - - // If you made an Editor Support you will want to add these methods: - public final void addSaveCookie(SaveCookie save) { - getCookieSet().add(save); - } - - public final void removeSaveCookie(SaveCookie save) { - getCookieSet().remove(save); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java deleted file mode 100644 index 8d2755576aa6..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.File; -import java.io.IOException; -import java.beans.PropertyEditor; -import java.beans.PropertyEditorSupport; - -import org.openide.loaders.DataFolder; -import org.openide.loaders.DataObject; -import org.openide.loaders.DataFilter; -import org.openide.loaders.DataObjectExistsException; - -import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileUtil; - -import org.openide.nodes.CookieSet; -import org.openide.nodes.Node; -import org.openide.nodes.PropertySupport; -import org.openide.nodes.Sheet; -import org.openide.util.HelpCtx; - -import org.openoffice.idesupport.filter.*; -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.netbeans.modules.office.actions.ParcelFolderCookie; -import org.openoffice.netbeans.modules.office.actions.ParcelFolderSupport; - -public class ParcelFolder extends DataFolder { - - public static final String LANGUAGE_ATTRIBUTE = "language"; - - public ParcelFolder(FileObject pf, ParcelFolderDataLoader loader) - throws DataObjectExistsException { - super(pf, loader); - CookieSet cookies = getCookieSet(); - cookies.add(new ParcelFolderSupport(this)); - } - - public Node createNodeDelegate() { - return new ParcelFolderNode(this, new ParcelFolderFilter()); - } - - public class ParcelFolderNode extends DataFolder.FolderNode { - private static final String LOCATION = "location"; - private static final String FILTER = "filter"; - private static final String LANGUAGE = LANGUAGE_ATTRIBUTE; - private static final String CLASSPATH = "classpath"; - - private File location; - private FileFilter filter; - private String language; - private String classpath; - - private final FileFilter DEFAULT_FILTER = BinaryOnlyFilter.getInstance(); - - public ParcelFolderNode(ParcelFolder pf, DataFilter dataFilter) { - super(pf.createNodeChildren(dataFilter)); - - location = (File)pf.getPrimaryFile().getAttribute(LOCATION); - - if (location == null) - location = FileUtil.toFile(pf.getPrimaryFile()); - - String name = (String)pf.getPrimaryFile().getAttribute(FILTER); - - if (name == null) - filter = DEFAULT_FILTER; - else { - for (int i = 0; i < availableFilters.length; i++) - if (name.equals(availableFilters[i].toString())) - filter = availableFilters[i]; - } - - language = (String)pf.getPrimaryFile().getAttribute(LANGUAGE); - - ParcelFolderCookie cookie = - (ParcelFolderCookie)pf.getCookie(ParcelFolderCookie.class); - String s = cookie.getClasspath(); - - if (s != null) { - classpath = s; - } else { - classpath = "."; - cookie.setClasspath(classpath); - } - } - - public File getTargetDir() { - return location; - } - - public FileFilter getFileFilter() { - return filter; - } - - public String getLanguage() { - if (language == null) - language = (String)getPrimaryFile().getAttribute(LANGUAGE); - - return language; - } - - public Sheet createSheet() { - Sheet sheet; - Sheet.Set props; - Node.Property prop; - - sheet = super.createSheet(); - props = sheet.get(Sheet.PROPERTIES); - - if (props == null) { - props = Sheet.createPropertiesSet(); - sheet.put(props); - } - - prop = createFilterProperty(); - props.put(prop); - - prop = createFilterProperty(); - props.put(prop); - - prop = createClasspathProperty(); - props.put(prop); - - return sheet; - } - - private Node.Property createLocationProperty() { - Node.Property prop = - new PropertySupport.ReadWrite(LOCATION, File.class, - "Location", "Output location of Parcel Zip File") { - public void setValue(Object obj) { - if (obj instanceof File) { - location = (File)obj; - - try { - getPrimaryFile().setAttribute(LOCATION, location); - } catch (IOException ioe) { - } - } - } - - public Object getValue() { - return location; - } - }; - prop.setValue("files", Boolean.FALSE); - return prop; - } - - private String[] languages = {"Java", "BeanShell"}; - - private Node.Property createLanguageProperty() { - Node.Property prop = - new PropertySupport.ReadWrite(LANGUAGE, String.class, - "Parcel Language", "Language of scripts in this Parcel") { - public void setValue(Object obj) { - if (obj instanceof String) { - language = (String)obj; - - try { - getPrimaryFile().setAttribute(LANGUAGE, language); - } catch (IOException ioe) { - } - } - } - - public Object getValue() { - if (language == null) - language = (String)getPrimaryFile().getAttribute(LANGUAGE); - - return language; - } - - public PropertyEditor getPropertyEditor() { - return new PropertyEditorSupport() { - public String[] getTags() { - return languages; - } - - public void setAsText(String text) { - for (int i = 0; i < languages.length; i++) - if (text.equals(languages[i])) - this.setValue(languages[i]); - } - - public String getAsText() { - return (String)this.getValue(); - } - }; - } - }; - return prop; - } - - private FileFilter[] availableFilters = new FileFilter[] { - BinaryOnlyFilter.getInstance(), AllFilesFilter.getInstance() - }; - - private Node.Property createFilterProperty() { - Node.Property prop = - new PropertySupport.ReadWrite(FILTER, String.class, - "File Filter", "Files to be included in Parcel") { - public void setValue(Object obj) { - if (obj instanceof FileFilter) { - filter = (FileFilter)obj; - - try { - getPrimaryFile().setAttribute(FILTER, filter.toString()); - } catch (IOException ioe) { - } - } - } - - public Object getValue() { - return filter; - } - - public PropertyEditor getPropertyEditor() { - return new PropertyEditorSupport() { - public String[] getTags() { - String[] tags = new String[availableFilters.length]; - - for (int i = 0; i < availableFilters.length; i++) - tags[i] = availableFilters[i].toString(); - - return tags; - } - - public void setAsText(String text) { - for (int i = 0; i < availableFilters.length; i++) - if (text.equals(availableFilters[i].toString())) - this.setValue(availableFilters[i]); - } - - public String getAsText() { - return this.getValue().toString(); - } - }; - } - }; - return prop; - } - - private Node.Property createClasspathProperty() { - Node.Property prop = - new PropertySupport.ReadWrite(CLASSPATH, String.class, - "Classpath", "Classpath property for scripts in this parcel") { - public void setValue(Object obj) { - if (obj instanceof String) { - classpath = (String)obj; - - ParcelFolderCookie cookie = (ParcelFolderCookie) - getDataObject().getCookie(ParcelFolderCookie.class); - cookie.setClasspath(classpath); - } - } - - public Object getValue() { - return classpath; - } - }; - return prop; - } - } - - private class ParcelFolderFilter implements DataFilter { - public boolean acceptDataObject(DataObject dobj) { - String name = dobj.getPrimaryFile().getNameExt(); - return !name.equals(ParcelZipper.PARCEL_DESCRIPTOR_XML); - } - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.java deleted file mode 100644 index 64b26c248d64..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.io.IOException; -import java.io.File; - -import org.openide.actions.*; -import org.openide.filesystems.*; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.util.actions.SystemAction; - -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.netbeans.modules.office.actions.*; - -/** Recognizes single files in the Repository as being of a certain type. - */ - -public class ParcelFolderDataLoader extends UniFileLoader { - - public ParcelFolderDataLoader() { - this("org.openoffice.netbeans.modules.office.loader.ParcelFolder"); - } - - protected ParcelFolderDataLoader(String recognizedObjectClass) { - super(recognizedObjectClass); - } - - protected String defaultDisplayName() { - return "Office Script Parcel Folder"; - } - - protected FileObject findPrimaryFile(FileObject fo) { - if (!fo.isFolder()) - return null; - - FileObject contents = fo.getFileObject(ParcelZipper.CONTENTS_DIRNAME); - - if (contents == null) - return null; - - FileObject descriptor = contents.getFileObject( - ParcelZipper.PARCEL_DESCRIPTOR_XML); - - if (descriptor == null) - return null; - - return fo; - } - - protected SystemAction[] defaultActions() { - return new SystemAction[] { - SystemAction.get(CompileParcelAction.class), - SystemAction.get(BuildParcelAction.class), - SystemAction.get(ConfigureParcelAction.class), - null, - SystemAction.get(CutAction.class), - SystemAction.get(CopyAction.class), - null, - SystemAction.get(DeleteAction.class), - SystemAction.get(RenameAction.class), - null, - SystemAction.get(PropertiesAction.class), - }; - } - - protected MultiDataObject createMultiObject(FileObject primaryFile) throws - DataObjectExistsException, IOException { - return new ParcelFolder(primaryFile, this); - } - - protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, - FileObject primaryFile) { - return new FileEntry.Folder(obj, primaryFile); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoaderBeanInfo.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoaderBeanInfo.java deleted file mode 100644 index 357658bdb184..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoaderBeanInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.loader; - -import java.awt.Image; -import java.beans.*; - -import org.openide.ErrorManager; -import org.openide.util.NbBundle; -import org.openide.util.Utilities; - -/** Description of {@link ParcelFolderDataLoader}. - */ -public class ParcelFolderDataLoaderBeanInfo extends SimpleBeanInfo { - - // If you have additional properties: - /* - public PropertyDescriptor[] getPropertyDescriptors() { - try { - PropertyDescriptor myProp = new PropertyDescriptor("myProp", ParcelFolderDataLoader.class); - myProp.setDisplayName(NbBundle.getMessage(ParcelFolderDataLoaderBeanInfo.class, "PROP_myProp")); - myProp.setShortDescription(NbBundle.getMessage(ParcelFolderDataLoaderBeanInfo.class, "HINT_myProp")); - return new PropertyDescriptor[] {myProp}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - */ - - public BeanInfo[] getAdditionalBeanInfo() { - try { - // I.e. MultiFileLoader.class or UniFileLoader.class. - return new BeanInfo[] {Introspector.getBeanInfo(ParcelFolderDataLoader.class.getSuperclass())}; - } catch (IntrospectionException ie) { - ErrorManager.getDefault().notify(ie); - return null; - } - } - - public Image getIcon(int type) { - if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelFolderDataIcon.gif"); - } else { - return Utilities.loadImage("org/openoffice/netbeans/modules/office/loaders/ParcelFolderDataIcon32.gif"); - } - } - -} |