dev/null |binary scripting/java/manifest.mf | 26 scripting/java/org/openoffice/idesupport/CommandLineTools.java | 337 - scripting/java/org/openoffice/idesupport/ExtensionFinder.java | 81 scripting/java/org/openoffice/idesupport/JavaFinder.java | 231 - scripting/java/org/openoffice/idesupport/LocalOffice.java | 54 scripting/java/org/openoffice/idesupport/MethodFinder.java | 26 scripting/java/org/openoffice/idesupport/OfficeDocument.java | 106 scripting/java/org/openoffice/idesupport/OfficeInstallation.java | 85 scripting/java/org/openoffice/idesupport/SVersionRCFile.java | 226 - scripting/java/org/openoffice/idesupport/filter/AllFilesFilter.java | 39 scripting/java/org/openoffice/idesupport/filter/BinaryOnlyFilter.java | 44 scripting/java/org/openoffice/idesupport/filter/ExceptParcelFilter.java | 45 scripting/java/org/openoffice/idesupport/filter/FileFilter.java | 23 scripting/java/org/openoffice/idesupport/localoffice/LocalOfficeImpl.java | 131 scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java | 223 - scripting/java/org/openoffice/idesupport/ui/MethodPanel.java | 164 scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java | 199 scripting/java/org/openoffice/idesupport/xml/Manifest.java | 125 scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java | 159 scripting/java/org/openoffice/netbeans/editor/JavaKit.java | 237 - scripting/java/org/openoffice/netbeans/editor/NetBeansSourceView.java | 197 scripting/java/org/openoffice/netbeans/editor/OOo.jcb | 5 scripting/java/org/openoffice/netbeans/editor/OOo.jcs | 21 scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java | 60 scripting/java/org/openoffice/netbeans/modules/office/actions/CompileParcelAction.java | 35 scripting/java/org/openoffice/netbeans/modules/office/actions/ConfigureParcelAction.java | 61 scripting/java/org/openoffice/netbeans/modules/office/actions/DeployParcelAction.java | 238 - scripting/java/org/openoffice/netbeans/modules/office/actions/MountDocumentAction.java | 62 scripting/java/org/openoffice/netbeans/modules/office/actions/MountParcelAction.java | 61 scripting/java/org/openoffice/netbeans/modules/office/actions/OfficeDocumentCookie.java | 32 scripting/java/org/openoffice/netbeans/modules/office/actions/OfficeDocumentSupport.java | 133 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelCookie.java | 32 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelDescriptorEditorSupport.java | 136 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelDescriptorParserCookie.java | 32 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelDescriptorParserSupport.java | 107 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderCookie.java | 32 scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java | 242 - scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelSupport.java | 175 scripting/java/org/openoffice/netbeans/modules/office/filesystem/Bundle.properties | 61 scripting/java/org/openoffice/netbeans/modules/office/filesystem/OpenOfficeDocFileSystem.java | 1182 ----- scripting/java/org/openoffice/netbeans/modules/office/filesystem/OpenOfficeDocFileSystemBeanInfo.java | 110 scripting/java/org/openoffice/netbeans/modules/office/loader/Bundle.properties | 30 scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.java | 99 scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoaderBeanInfo.java | 63 scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataNode.java | 113 scripting/java/org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataObject.java | 50 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java | 129 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.java | 70 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoaderBeanInfo.java | 65 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.java | 76 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataLoaderBeanInfo.java | 65 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataNode.java | 103 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDataObject.java | 67 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.java | 73 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoaderBeanInfo.java | 65 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataNode.java | 70 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataObject.java | 75 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java | 290 - scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.java | 93 scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoaderBeanInfo.java | 65 scripting/java/org/openoffice/netbeans/modules/office/nodes/OfficeDocumentChildren.java | 142 scripting/java/org/openoffice/netbeans/modules/office/nodes/ParcelDescriptorChildren.java | 83 scripting/java/org/openoffice/netbeans/modules/office/nodes/ScriptNode.java | 126 scripting/java/org/openoffice/netbeans/modules/office/options/Bundle.properties | 31 scripting/java/org/openoffice/netbeans/modules/office/options/OfficeSettings.java | 119 scripting/java/org/openoffice/netbeans/modules/office/options/OfficeSettingsBeanInfo.java | 135 scripting/java/org/openoffice/netbeans/modules/office/resources/AppStorage.html | 28 scripting/java/org/openoffice/netbeans/modules/office/resources/AppStorage.settings | 7 scripting/java/org/openoffice/netbeans/modules/office/resources/Bundle.properties | 41 scripting/java/org/openoffice/netbeans/modules/office/resources/EmptyParcel.html | 28 scripting/java/org/openoffice/netbeans/modules/office/resources/OfficeSettings.settings | 9 scripting/java/org/openoffice/netbeans/modules/office/resources/OpenOfficeDocFileSystem.html | 28 scripting/java/org/openoffice/netbeans/modules/office/resources/OpenOfficeDocFileSystem.settings | 7 scripting/java/org/openoffice/netbeans/modules/office/resources/ScriptParcel.html | 28 scripting/java/org/openoffice/netbeans/modules/office/resources/ScriptParcelDescriptor.html | 28 scripting/java/org/openoffice/netbeans/modules/office/resources/layer.xml | 115 scripting/java/org/openoffice/netbeans/modules/office/resources/mime-resolver.xml | 32 scripting/java/org/openoffice/netbeans/modules/office/resources/office-scripting.url | 1 scripting/java/org/openoffice/netbeans/modules/office/resources/templates/Empty.bsh_ | 42 scripting/java/org/openoffice/netbeans/modules/office/resources/templates/Empty.java_ | 45 scripting/java/org/openoffice/netbeans/modules/office/resources/templates/EmptyParcelDescriptor.xml_ | 3 scripting/java/org/openoffice/netbeans/modules/office/resources/templates/HelloWorld.java_ | 59 scripting/java/org/openoffice/netbeans/modules/office/resources/templates/ParcelDescriptor.xml_ | 8 scripting/java/org/openoffice/netbeans/modules/office/utils/FrameworkJarChecker.java | 128 scripting/java/org/openoffice/netbeans/modules/office/utils/ManifestParser.java | 83 scripting/java/org/openoffice/netbeans/modules/office/utils/NagDialog.java | 115 scripting/java/org/openoffice/netbeans/modules/office/utils/OfficeModule.java | 60 scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java | 98 scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java | 81 scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties | 44 scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java | 63 scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathIterator.java | 150 scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java | 246 - scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java | 248 - scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java | 124 scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form | 90 scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java | 163 scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java | 134 scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form | 98 scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java | 196 scripting/workben/bindings/EditDebug.xdl | 53 scripting/workben/bindings/EventsBinding.xdl | 78 scripting/workben/bindings/HelpBinding.xdl | 47 scripting/workben/bindings/KeyBinding.xdl | 76 scripting/workben/bindings/MacroEditor.xdl | 27 scripting/workben/bindings/MenuBinding.xdl | 82 scripting/workben/bindings/ScriptBinding.xba | 2110 ---------- scripting/workben/bindings/calckeybinding.xml | 111 scripting/workben/bindings/calcmenubar.xml | 334 - scripting/workben/bindings/drawkeybinding.xml | 75 scripting/workben/bindings/drawmenubar.xml | 369 - scripting/workben/bindings/eventbindings.xml | 21 scripting/workben/bindings/impresskeybinding.xml | 79 scripting/workben/bindings/impressmenubar.xml | 344 - scripting/workben/bindings/manifest.xml | 31 scripting/workben/bindings/writerkeybinding.xml | 118 scripting/workben/bindings/writermenubar.xml | 298 - scripting/workben/build.xml | 387 - scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.protocolhandler.Dispatch.csv | 5 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.Function.csv | 1 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.FunctionProvider.csv | 1 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager.csv | 2 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptInfo.csv | 8 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorage.csv | 4 scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorageManager.csv | 6 scripting/workben/data/testdata/Function.csv | 4 scripting/workben/data/testdata/FunctionProvider.csv | 1 scripting/workben/data/testdata/ScriptInfo.csv | 8 scripting/workben/data/testdata/ScriptRuntimeManager.csv | 8 scripting/workben/data/testdata/ScriptStorage.csv | 4 scripting/workben/data/testdata/ScriptStorageManager.csv | 18 scripting/workben/ifc/scripting/ScriptingUtils.java | 106 scripting/workben/ifc/scripting/SecurityDialogUtil.java | 147 scripting/workben/ifc/scripting/_XFunction.java | 150 scripting/workben/ifc/scripting/_XFunctionProvider.java | 81 scripting/workben/ifc/scripting/_XScriptInfo.java | 308 - scripting/workben/ifc/scripting/_XScriptInfoAccess.java | 192 scripting/workben/ifc/scripting/_XScriptInvocation.java | 212 - scripting/workben/ifc/scripting/_XScriptNameResolver.java | 167 scripting/workben/ifc/scripting/_XScriptSecurity.java | 353 - scripting/workben/ifc/scripting/_XScriptStorageManager.java | 257 - scripting/workben/ifc/scripting/_XScriptStorageRefresh.java | 75 scripting/workben/ifc/scripting/makefile.mk | 31 scripting/workben/installer/Banner.java | 41 scripting/workben/installer/ExceptionTraceHelper.java | 49 scripting/workben/installer/ExecCmd.java | 105 scripting/workben/installer/FileUpdater.java | 183 scripting/workben/installer/Final.java | 136 scripting/workben/installer/IdeFinal.java | 121 scripting/workben/installer/IdeUpdater.java | 113 scripting/workben/installer/IdeVersion.java | 337 - scripting/workben/installer/IdeWelcome.java | 79 scripting/workben/installer/InstUtil.java | 326 - scripting/workben/installer/InstallListener.java | 23 scripting/workben/installer/InstallWizard.java | 350 - scripting/workben/installer/InstallationEvent.java | 36 scripting/workben/installer/LogStream.java | 62 scripting/workben/installer/NavPanel.java | 128 scripting/workben/installer/Navigation.java | 66 scripting/workben/installer/ProtocolHandler.xcu | 27 scripting/workben/installer/Register.java | 107 scripting/workben/installer/Scripting.BeanShell.xcu | 28 scripting/workben/installer/Scripting.JavaScript.xcu | 28 scripting/workben/installer/Scripting.xcs | 48 scripting/workben/installer/Version.java | 350 - scripting/workben/installer/Welcome.java | 84 scripting/workben/installer/XmlUpdater.java | 389 - scripting/workben/installer/ZipData.java | 114 scripting/workben/makefile.mk | 26 scripting/workben/mod/_scripting/Dispatch.java | 100 scripting/workben/mod/_scripting/Function.java | 88 scripting/workben/mod/_scripting/FunctionProvider.java | 79 scripting/workben/mod/_scripting/ScriptInfo.java | 108 scripting/workben/mod/_scripting/ScriptRuntimeManager.java | 61 scripting/workben/mod/_scripting/ScriptStorage.java | 101 scripting/workben/mod/_scripting/ScriptStorageManager.java | 76 scripting/workben/mod/_scripting/TestDataLoader.java | 116 scripting/workben/mod/_scripting/makefile.mk | 31 179 files changed, 21407 deletions(-)
New commits: commit a1552a0ec3fcddd968db274ef41bc2452c50bed9 Author: David Ostrovsky <da...@ostrovsky.org> Date: Thu Oct 9 10:47:42 2014 +0200 Scripting: Remove org package Change-Id: If0b6ac87b5d53da43557dee5824e9413a260ba7c Signed-off-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/scripting/java/manifest.mf b/scripting/java/manifest.mf deleted file mode 100644 index ba14e30..0000000 --- a/scripting/java/manifest.mf +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: org.openoffice.netbeans.modules.office/1 -OpenIDE-Module-Name: Office Support -OpenIDE-Module-Short-Description: Scripting Support for Office Documents -OpenIDE-Module-Localizing-Bundle: org/openoffice/netbeans/modules/office/Bundle.properties -OpenIDE-Module-Specification-Version: 0.2 -OpenIDE-Module-Implementation-Version: 0.2 -OpenIDE-Module-Install: org/openoffice/netbeans/modules/office/utils/OfficeModule.class -OpenIDE-Module-Layer: org/openoffice/netbeans/modules/office/resources/layer.xml - -Name: org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.class -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.class -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.class -Install-Before: org.openide.loaders.XMLDataObject, org.netbeans.modules.xml.core.XMLDataObject -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.class -Install-Before: org.openoffice.netbeans.modules.office.loader.ParcelDescriptorDataLoader -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.class -OpenIDE-Module-Class: Loader diff --git a/scripting/java/org/openoffice/idesupport/CommandLineTools.java b/scripting/java/org/openoffice/idesupport/CommandLineTools.java deleted file mode 100644 index 85995cd..0000000 --- a/scripting/java/org/openoffice/idesupport/CommandLineTools.java +++ /dev/null @@ -1,337 +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 . - */ - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.StringTokenizer; - -import com.sun.star.script.framework.container.ScriptEntry; -import com.sun.star.script.framework.container.ParcelDescriptor; - -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.idesupport.filter.AllFilesFilter; -import com.sun.star.script.framework.container.XMLParserFactory; -import org.openoffice.idesupport.*; - -public class CommandLineTools { - private static final String PARCEL_XML_FILE = - ParcelZipper.PARCEL_DESCRIPTOR_XML; - - private static String officePath = null; - - public static void main(String[] args) { - CommandLineTools driver = new CommandLineTools(); - Command command = driver.parseArgs(args); - - // Get the URL for the Office DTD directory and pass it to the - // XMLParserFactory so that Office xml files can be parsed - if (officePath == null) { - try { - SVersionRCFile sv = SVersionRCFile.createInstance(); - - if (sv.getDefaultVersion() != null) { - officePath = sv.getDefaultVersion().getPath(); - } - } catch (IOException ioe) { - System.err.println("Error getting Office directory"); - } - } - - if (officePath == null) { - driver.fatalUsage("Error: Office Installation path not set"); - } - - File officeDir = new File(officePath); - - if (!officeDir.exists() || !officeDir.isDirectory()) { - driver.fatalUsage( - "Error: Office Installation path not valid: " + officePath); - } - - OfficeInstallation oi = new OfficeInstallation(officePath); - String url = oi.getURL("share/dtd/officedocument/1_0/"); - XMLParserFactory.setOfficeDTDURL(url); - - if (command == null) - driver.printUsage(); - else { - try { - command.execute(); - } catch (Exception e) { - driver.fatal("Error: " + e.getMessage()); - } - } - } - - private interface Command { - void execute() throws Exception; - } - - private void printUsage() { - System.out.println("java " + getClass().getName() + " -h " + - "prints this message"); - System.out.println("java " + getClass().getName() + - " [-o Path to Office Installation] " + - "-d <script parcel zip file> " + - "<destination document or directory>"); - System.out.println("java " + getClass().getName() + - " [-o Path to Office Installation] " + - "-g [parcel root directory] [options] [script names]"); - System.out.println("options:"); - System.out.println("\t[-l language[=supported extension 1[" + - File.pathSeparator + "supported extension 2]]]"); - System.out.println("\t[-p name=value]"); - System.out.println("\t[-v]"); - } - - private void fatal(String message) { - System.err.println(message); - System.exit(-1); - } - - private void fatalUsage(String message) { - System.err.println(message); - System.err.println(); - printUsage(); - System.exit(-1); - } - private Command parseArgs(String[] args) { - - if (args.length < 1) { - return null; - } else if (args[0].equals("-h")) { - return new Command() { - public void execute() { - printUsage(); - } - }; - } - - int i = 0; - - if (args[0].equals("-o")) { - officePath = args[i + 1]; - i += 2; - } - - if (args[i].equals("-d")) { - if ((args.length - i) != 3) - return null; - else - return new DeployCommand(args[i + 1], args[i + 2]); - } else if (args[i].equals("-g")) { - - if ((args.length - i) == 1) - return new GenerateCommand(System.getProperty("user.dir")); - - GenerateCommand command; - i++; - - if (!args[i].startsWith("-")) - command = new GenerateCommand(args[i++]); - else - command = new GenerateCommand(System.getProperty("user.dir")); - - for (; i < args.length; i++) { - if (args[i].equals("-l")) { - command.setLanguage(args[++i]); - } else if (args[i].equals("-p")) { - command.addProperty(args[++i]); - } else if (args[i].equals("-v")) { - command.setVerbose(); - } else { - command.addScript(args[i]); - } - } - - return command; - } - - return null; - } - - private static class GenerateCommand implements Command { - - private File basedir, contents, parcelxml; - private boolean verbose = false; - private String language = null; - private MethodFinder finder = null; - private ArrayList<ScriptEntry> scripts = null; - private HashMap properties = new HashMap(3); - - public GenerateCommand(String basedir) { - this.basedir = new File(basedir); - this.contents = new File(basedir, ParcelZipper.CONTENTS_DIRNAME); - this.parcelxml = new File(contents, PARCEL_XML_FILE); - } - - public void setLanguage(String language) { - StringTokenizer tokenizer = new StringTokenizer(language, "="); - this.language = tokenizer.nextToken(); - - if (this.language.equalsIgnoreCase("java")) { - this.finder = JavaFinder.getInstance(); - return; - } - - if (tokenizer.hasMoreTokens()) { - String ext = (String)tokenizer.nextToken(); - String[] extensions; - - if (ext.indexOf(File.pathSeparator) != -1) { - tokenizer = new StringTokenizer(ext, File.pathSeparator); - extensions = new String[tokenizer.countTokens()]; - int i = 0; - - while (tokenizer.hasMoreTokens()) - extensions[i++] = (String)tokenizer.nextToken(); - } else { - extensions = new String[1]; - extensions[0] = ext; - } - - this.finder = new ExtensionFinder(this.language, extensions); - } - } - - public void addProperty(String prop) { - StringTokenizer tok = new StringTokenizer(prop, "="); - - if (tok.countTokens() != 2) - return; - - String name = tok.nextToken(); - String value = tok.nextToken(); - - properties.put(name, value); - } - - public void setVerbose() { - verbose = true; - } - - public void addScript(String script) { - if (language == null) - return; - - addScript(new ScriptEntry(language, script, script, basedir.getName())); - } - - public void addScript(ScriptEntry entry) { - if (scripts == null) - scripts = new ArrayList(3); - - scripts.add(entry); - } - - public void execute() throws Exception { - - if (!basedir.isDirectory()) { - throw new Exception(basedir.getName() + " is not a directory"); - } else if (!contents.exists()) { - throw new Exception(basedir.getName() + - " does not contain a Contents directory"); - } - - if (language == null && !parcelxml.exists()) { - throw new Exception(parcelxml.getName() + " not found and language " + - "not specified"); - } - - if (language != null && parcelxml.exists()) { - ParcelDescriptor desc; - String desclang = ""; - - desc = new ParcelDescriptor(parcelxml); - desclang = desc.getLanguage().toLowerCase(); - - if (!desclang.equals(language.toLowerCase())) - throw new Exception(parcelxml.getName() + " already exists, " + - "and has a different language attribute: " + - desc.getLanguage()); - } - - if (language != null && scripts == null) { - if (finder == null) - throw new Exception("Extension list not specified for this language"); - - log("Searching for " + language + " scripts"); - - ScriptEntry[] entries = finder.findMethods(contents); - - for (int i = 0; i < entries.length; i++) { - addScript(entries[i]); - log("Found: " + entries[i].getLogicalName()); - } - } - - if (scripts != null) { - if (scripts.isEmpty()) - throw new Exception("No valid scripts found"); - - ParcelDescriptor desc = new ParcelDescriptor(parcelxml, language); - desc.setScriptEntries(scripts.toArray(new ScriptEntry[scripts.size()])); - if (properties.size() != 0) { - Enumeration enumer = properties.keys(); - - while (enumer.hasMoreElements()) { - String name = (String)enumer.nextElement(); - String value = (String)properties.get(name); - log("Setting property: " + name + " to " + value); - - desc.setLanguageProperty(name, value); - } - } - - desc.write(); - } else { - if (!parcelxml.exists()) - throw new Exception("No valid scripts found"); - } - - contents = new File(contents.getAbsolutePath()); - String name = ParcelZipper.getParcelZipper().zipParcel(contents, - AllFilesFilter.getInstance()); - System.out.println(name + " generated"); - } - - private void log(String message) { - if (verbose) - System.out.println(message); - } - } - - private static class DeployCommand implements Command { - - File source, target; - - public DeployCommand(String source, String target) { - this.source = new File(source); - this.target = new File(target); - } - - public void execute() throws Exception { - ParcelZipper.getParcelZipper().deployParcel(source, target); - System.out.println(source.getName() + - " successfully deployed to " + target.getAbsolutePath()); - } - } -} diff --git a/scripting/java/org/openoffice/idesupport/ExtensionFinder.java b/scripting/java/org/openoffice/idesupport/ExtensionFinder.java deleted file mode 100644 index 48b80fd..0000000 --- a/scripting/java/org/openoffice/idesupport/ExtensionFinder.java +++ /dev/null @@ -1,81 +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.idesupport; - -import java.io.File; -import java.util.ArrayList; -import org.openoffice.idesupport.zip.ParcelZipper; - -import com.sun.star.script.framework.container.ScriptEntry; - -public class ExtensionFinder implements MethodFinder { - - private String[] extensions; - private String language; - - public ExtensionFinder(String language, String[] extensions) { - this.language = language; - this.extensions = extensions; - } - - public ScriptEntry[] findMethods(File basedir) { - String parcelName; - ArrayList<ScriptEntry> files = new ArrayList<ScriptEntry>(10); - ScriptEntry[] empty = new ScriptEntry[0]; - - if (basedir == null || !basedir.exists() || - !basedir.isDirectory()) - return empty; - - parcelName = basedir.getName(); - - if (parcelName.equals(ParcelZipper.CONTENTS_DIRNAME)) - parcelName = basedir.getParentFile().getName(); - - findFiles(files, basedir, parcelName); - - if (files.size() != 0) - return files.toArray(empty); - - return empty; - } - - private void findFiles(ArrayList<ScriptEntry> list, File basedir, - String parcelName) { - File[] children = basedir.listFiles(); - File f; - - for (int i = 0; i < children.length; i++) { - f = children[i]; - - if (f.isDirectory()) - findFiles(list, f, parcelName); - else { - for (int j = 0; j < extensions.length; j++) { - if (f.getName().endsWith(extensions[j])) { - ScriptEntry entry = new ScriptEntry(language, - f.getName(), parcelName); - list.add(entry); - break; - } - } - } - } - } -} diff --git a/scripting/java/org/openoffice/idesupport/JavaFinder.java b/scripting/java/org/openoffice/idesupport/JavaFinder.java deleted file mode 100644 index b1139ab..0000000 --- a/scripting/java/org/openoffice/idesupport/JavaFinder.java +++ /dev/null @@ -1,231 +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.idesupport; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.openoffice.idesupport.zip.ParcelZipper; - -import com.sun.star.script.framework.container.ScriptEntry; - -public class JavaFinder implements MethodFinder { - - private static JavaFinder finder; - private static final String JAVA_SUFFIX = ".java"; - private static final String CLASS_SUFFIX = ".class"; - private static final String FIRST_PARAM = - "drafts.com.sun.star.script.framework.runtime.XScriptContext"; - - private List<String> classpath = null; - - private JavaFinder() {} - - private JavaFinder(List<String> classpath) { - this.classpath = classpath; - } - - - - public static JavaFinder getInstance(List<String> classpath) { - return new JavaFinder(classpath); - } - - public ScriptEntry[] findMethods(File basedir) { - String parcelName; - ArrayList<ScriptEntry> result = new ArrayList<ScriptEntry>(10); - ScriptEntry[] empty = new ScriptEntry[0]; - - if (basedir == null || !basedir.exists() || - !basedir.isDirectory()) - return empty; - - parcelName = basedir.getName(); - - if (parcelName.equals(ParcelZipper.CONTENTS_DIRNAME)) - parcelName = basedir.getParentFile().getName(); - - String[] classNames = findClassNames(basedir); - - if (classNames != null && classNames.length != 0) { - - ClassLoader classloader; - - if (classpath == null) - classloader = getClassLoader(basedir); - else - classloader = getClassLoader(); - - for (int i = 0; i < classNames.length; i++) { - try { - Class clazz = classloader.loadClass(classNames[i]); - Method[] methods = clazz.getDeclaredMethods(); - - for (int k = 0; k < methods.length; k++) { - if (Modifier.isPublic(methods[k].getModifiers())) { - Class[] params = methods[k].getParameterTypes(); - - if (params.length > 0) { - if (params[0].getName().equals(FIRST_PARAM)) { - ScriptEntry entry = - new ScriptEntry(classNames[i] + "." + - methods[k].getName(), parcelName); - result.add(entry); - } - } - } - } - } catch (ClassNotFoundException e) { - System.err.println("Caught ClassNotFoundException loading: " - + classNames[i]); - continue; - } catch (NoClassDefFoundError nc) { - System.err.println("Caught NoClassDefFoundErr loading: " + - classNames[i]); - continue; - } - } - } - - if (result.size() != 0) - return result.toArray(empty); - - return empty; - } - - private ClassLoader getClassLoader() { - int len = classpath.size(); - ArrayList<URL> urls = new ArrayList<URL>(len); - - for (int i = 0; i < len; i++) { - try { - String s = classpath.get(i); - s = SVersionRCFile.toFileURL(s); - - if (s != null) - urls.add(new URL(s)); - } catch (MalformedURLException mue) { - } - } - - return new URLClassLoader(urls.toArray(new URL[urls.size()])); - } - - private ClassLoader getClassLoader(File basedir) { - ArrayList<File> files = findFiles(basedir, ".jar"); - files.add(basedir); - - try { - Iterator<OfficeInstallation> offices = - SVersionRCFile.createInstance().getVersions(); - - while (offices.hasNext()) { - OfficeInstallation oi = offices.next(); - String unoil = SVersionRCFile.getPathForUnoil(oi.getPath()); - - if (unoil != null) { - files.add(new File(unoil, "unoil.jar")); - break; - } - } - } catch (IOException ioe) { - return null; - } - - URL[] urls = new URL[files.size()]; - String urlpath; - File f; - - for (int i = 0; i < urls.length; i++) { - try { - f = files.get(i); - urlpath = SVersionRCFile.toFileURL(f.getAbsolutePath()); - - if (urlpath != null) - urls[i] = new URL(urlpath); - } catch (MalformedURLException mue) { - // do nothing, go on to next file - } - } - - return new URLClassLoader(urls); - } - - private ArrayList<File> findFiles(File basedir, String suffix) { - ArrayList<File> result = new ArrayList<File>(); - File[] children = basedir.listFiles(); - - for (int i = 0; i < children.length; i++) { - if (children[i].isDirectory()) - result.addAll(findFiles(children[i], suffix)); - else if (children[i].getName().endsWith(suffix)) - result.add(children[i]); - } - - return result; - } - - private String[] findClassNames(File basedir) { - ArrayList<File> classFiles = findFiles(basedir, CLASS_SUFFIX); - if(classFiles == null || classFiles.isEmpty()) - return null; - - ArrayList<File> javaFiles = findFiles(basedir, JAVA_SUFFIX); - - if (javaFiles == null || javaFiles.size() == 0) - return null; - - ArrayList<String> result = new ArrayList<String>(); - - for (int i = 0; i < classFiles.size(); i++) { - File classFile = classFiles.get(i); - String className = classFile.getName(); - className = className.substring(0, className.lastIndexOf(CLASS_SUFFIX)); - boolean finished = false; - - - for (int j = 0; j < javaFiles.size() && !finished; j++) { - File javaFile = javaFiles.get(j); - String javaName = javaFile.getName(); - javaName = javaName.substring(0, javaName.lastIndexOf(JAVA_SUFFIX)); - - if (javaName.equals(className)) { - String path = classFile.getAbsolutePath(); - path = path.substring(basedir.getAbsolutePath().length() + 1); - path = path.replace(File.separatorChar, '.'); - path = path.substring(0, path.lastIndexOf(CLASS_SUFFIX)); - - result.add(path); - javaFiles.remove(j); - finished = true; - } - } - } - - return result.toArray(new String[result.size()]); - } -} diff --git a/scripting/java/org/openoffice/idesupport/LocalOffice.java b/scripting/java/org/openoffice/idesupport/LocalOffice.java deleted file mode 100644 index 0c05cd0..0000000 --- a/scripting/java/org/openoffice/idesupport/LocalOffice.java +++ /dev/null @@ -1,54 +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.idesupport; - -import java.net.ConnectException; - -/** - * LocalOffice represents a connection to the local office. - * - * This class allows to get access to some scripting framework - * related functionality of the locally running office. The - * office has to be started with options appropriate for establishing - * local connection. - */ -public abstract class LocalOffice -{ - /** - * Connects to the running office. - * - * @param officePath is a platform specific path string - * to the office distribution. - * @param port is a communication port. - */ - protected abstract void connect(String officePath, int port) - throws ConnectException; - - /** - * Closes the connection to the running office. - */ - public abstract void disconnect(); - - /** - * Refresh the script storage. - * - * @param uri is an identifier of storage has to be refreshed. - */ - public abstract void refreshStorage(String uri); -} diff --git a/scripting/java/org/openoffice/idesupport/MethodFinder.java b/scripting/java/org/openoffice/idesupport/MethodFinder.java deleted file mode 100644 index 83e81b8..0000000 --- a/scripting/java/org/openoffice/idesupport/MethodFinder.java +++ /dev/null @@ -1,26 +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.idesupport; - -import java.io.File; -import com.sun.star.script.framework.container.ScriptEntry; - -public interface MethodFinder { - ScriptEntry[] findMethods(File basedir); -} diff --git a/scripting/java/org/openoffice/idesupport/OfficeDocument.java b/scripting/java/org/openoffice/idesupport/OfficeDocument.java deleted file mode 100644 index abad0eb..0000000 --- a/scripting/java/org/openoffice/idesupport/OfficeDocument.java +++ /dev/null @@ -1,106 +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.idesupport; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.zip.ZipEntry; -import java.util.zip.ZipException; -import java.util.zip.ZipFile; - -import org.openoffice.idesupport.zip.ParcelZipper; - -public class OfficeDocument { - public static final String PARCEL_PREFIX_DIR = - ParcelZipper.PARCEL_PREFIX_DIR; - - public static final String[] OFFICE_EXTENSIONS = - {".sxc" , ".sxw", ".sxi", ".sxd"}; - public static final String OFFICE_PRODUCT_NAME = "OpenOffice.org"; - - private File file = null; - - public OfficeDocument(File file) throws IllegalArgumentException { - if (!file.exists() || file.isDirectory() || !isOfficeFile(file)) { - throw new IllegalArgumentException("This is not a valid " + - OFFICE_PRODUCT_NAME + " document."); - } - - this.file = file; - } - - private boolean isOfficeFile(File file) { - for (int i = 0; i < OFFICE_EXTENSIONS.length; i++) - if (file.getName().endsWith(OFFICE_EXTENSIONS[i])) - return true; - - return false; - } - - public Iterator<String> getParcels() { - - ArrayList<String> parcels = new ArrayList<String>(); - ZipFile zp = null; - - try { - zp = new ZipFile(this.file); - - for (Enumeration enumer = zp.entries(); enumer.hasMoreElements();) { - ZipEntry ze = (ZipEntry)enumer.nextElement(); - - if (ze.getName().endsWith(ParcelZipper.PARCEL_DESCRIPTOR_XML)) { - String tmp = ze.getName(); - int end = tmp.lastIndexOf('/'); - tmp = tmp.substring(0, end); - - String parcelName = ze.getName().substring(0, end); - parcels.add(parcelName); - } - } - } catch (ZipException ze) { - ze.printStackTrace(); - } catch (IOException ioe) { - ioe.printStackTrace(); - } finally { - if (zp != null) { - try { - zp.close(); - } catch (IOException asdf) { - } - } - } - - return parcels.iterator(); - } - - public boolean removeParcel(String parcelName) { - - try { - ParcelZipper.getParcelZipper().removeParcel(file, parcelName); - } catch (IOException ioe) { - ioe.printStackTrace(); - return false; - } - - return true; - } -} diff --git a/scripting/java/org/openoffice/idesupport/OfficeInstallation.java b/scripting/java/org/openoffice/idesupport/OfficeInstallation.java deleted file mode 100644 index fdc89c9..0000000 --- a/scripting/java/org/openoffice/idesupport/OfficeInstallation.java +++ /dev/null @@ -1,85 +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.idesupport; - -import java.io.File; -import java.net.URLDecoder; - -public class OfficeInstallation implements java.io.Serializable { - - private String name; - private String path; - private String url; - private boolean hasFW = false; - - private static final String FILE_URL_PREFIX = SVersionRCFile.FILE_URL_PREFIX; - - public OfficeInstallation(String path) { - this(path, path); - } - - public OfficeInstallation(String name, String path) { - - this.name = name; - - if (path.startsWith(FILE_URL_PREFIX)) { - this.url = path; - path = URLDecoder.decode(path); - path = path.substring(FILE_URL_PREFIX.length()); - - if (System.getProperty("os.name").startsWith("Windows")) - path = path.replace('/', File.separatorChar); - - this.path = path; - } else { - this.path = path; - - if (System.getProperty("os.name").startsWith("Windows")) - path = path.replace(File.separatorChar, '/'); - - this.url = FILE_URL_PREFIX + path; - } - } - - public String getName() { - return name; - } - - public String getPath() { - return path; - } - - - - public String getURL() { - return url; - } - - - - - - public boolean supportsFramework() { - return true; - } - - @Override - public String toString() { - return getName(); - } -} diff --git a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java b/scripting/java/org/openoffice/idesupport/SVersionRCFile.java deleted file mode 100644 index 4e754e3..0000000 --- a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java +++ /dev/null @@ -1,226 +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.idesupport; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.StringTokenizer; - -public class SVersionRCFile { - - private static final String DEFAULT_NAME = - System.getProperty("os.name").startsWith("Windows") ? - System.getProperty("user.home") + File.separator + - "Application Data" + File.separator + "sversion.ini" : - System.getProperty("user.home") + File.separator + - ".sversionrc"; - - public static final String FILE_URL_PREFIX = - System.getProperty("os.name").startsWith("Windows") ? - "file:///" : "file://"; - - - - private static final String VERSIONS_LINE = "[Versions]"; - - private static final String UNOILJAR = - "skip_registration" + File.separator + "unoil.jar"; - - private static final String UNOPACKAGEDIR = - File.separator + "user" + File.separator + "uno_packages" + - File.separator + "cache" + File.separator + "uno_packages"; - - /* Make sure this is in LowerCase !!!!! */ - private static final String SCRIPTF = "scriptf"; - - private static final HashMap<String, SVersionRCFile> files = new - HashMap<String, SVersionRCFile>(3); - - private File sversionrc = null; - private OfficeInstallation defaultversion = null; - private ArrayList<OfficeInstallation> versions = null; - private long lastModified = 0; - - public SVersionRCFile() { - this(DEFAULT_NAME); - } - - private SVersionRCFile(String name) { - sversionrc = new File(name); - versions = new ArrayList<OfficeInstallation>(5); - } - - public static SVersionRCFile createInstance() { - return (createInstance(DEFAULT_NAME)); - } - - private static SVersionRCFile createInstance(String name) { - SVersionRCFile result = null; - - synchronized (SVersionRCFile.class) { - result = files.get(name); - - if (result == null) { - result = new SVersionRCFile(name); - files.put(name, result); - } - } - - return result; - } - - public OfficeInstallation getDefaultVersion() throws IOException { - if (defaultversion == null) { - getVersions(); - } - - return defaultversion; - } - - public Iterator<OfficeInstallation> getVersions() throws IOException { - - long l = sversionrc.lastModified(); - - if (l > lastModified) { - BufferedReader br = null; - - try { - br = new BufferedReader(new FileReader(sversionrc)); - load(br); - lastModified = l; - } catch (FileNotFoundException fnfe) { - throw new IOException(fnfe.getMessage()); - } finally { - if (br != null) - br.close(); - } - } - - return versions.iterator(); - } - - private void load(BufferedReader br) throws IOException { - String s; - - while ((s = br.readLine()) != null && - !(s.equals(VERSIONS_LINE))) {} - - while ((s = br.readLine()) != null && - s.length() != 0) { - StringTokenizer tokens = new StringTokenizer(s, "="); - int count = tokens.countTokens(); - - if (count != 2) - continue; - - String name = tokens.nextToken(); - String path = tokens.nextToken(); - OfficeInstallation oi = new OfficeInstallation(name, path); - - if (oi.supportsFramework()) { - versions.add(oi); - defaultversion = oi; - } - } - } - - public static String toFileURL(String path) { - File f = new File(path); - - if (!f.exists()) - return null; - - try { - path = f.getCanonicalPath(); - } catch (IOException ioe) { - return null; - } - - if (System.getProperty("os.name").startsWith("Windows")) - path = path.replace(File.separatorChar, '/'); - - StringBuilder buf = new StringBuilder(FILE_URL_PREFIX); - buf.append(path); - - if (f.isDirectory()) - buf.append("/"); - - return buf.toString(); - } - - public static String getPathForUnoil(String officeInstall) { - File unopkgdir = new File(officeInstall, UNOPACKAGEDIR); - - if (!unopkgdir.exists()) { - return null; - } - - File scriptf = null; - String[] listunopkg = unopkgdir.list(); - int size = listunopkg.length; - - for (int i = 0; i < size; i++) { - if (listunopkg[i].toLowerCase().indexOf(SCRIPTF) > -1) { - scriptf = new File(unopkgdir, listunopkg[i]); - } - } - - if (scriptf != null) { - File unoil = new File(scriptf, UNOILJAR); - - if (unoil.exists()) { - String path = unoil.getParent(); - path = path.substring(path.indexOf(UNOPACKAGEDIR)); - return officeInstall + path; - } - } - - return null; - } - - public static void main(String[] args) { - SVersionRCFile ov; - - if (args.length == 0) - ov = new SVersionRCFile(); - else - ov = new SVersionRCFile(args[0]); - - Iterator<OfficeInstallation> enumer; - - try { - enumer = ov.getVersions(); - } catch (IOException ioe) { - System.err.println("Error getting versions: " + ioe.getMessage()); - return; - } - - while (enumer.hasNext()) { - OfficeInstallation oi = enumer.next(); - System.out.println("Name: " + oi.getName() + ", Path: " + oi.getPath() + - ", URL: " + oi.getURL()); - } - } -} diff --git a/scripting/java/org/openoffice/idesupport/filter/AllFilesFilter.java b/scripting/java/org/openoffice/idesupport/filter/AllFilesFilter.java deleted file mode 100644 index a274003..0000000 --- a/scripting/java/org/openoffice/idesupport/filter/AllFilesFilter.java +++ /dev/null @@ -1,39 +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.idesupport.filter; - -public class AllFilesFilter implements FileFilter { - private static final AllFilesFilter filter = new AllFilesFilter(); - - private AllFilesFilter() { - } - - public static AllFilesFilter getInstance() { - return filter; - } - - public boolean validate(String name) { - return true; - } - - @Override - public String toString() { - return "<all files>"; - } -} diff --git a/scripting/java/org/openoffice/idesupport/filter/BinaryOnlyFilter.java b/scripting/java/org/openoffice/idesupport/filter/BinaryOnlyFilter.java deleted file mode 100644 index 9543615..0000000 --- a/scripting/java/org/openoffice/idesupport/filter/BinaryOnlyFilter.java +++ /dev/null @@ -1,44 +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.idesupport.filter; - -public class BinaryOnlyFilter implements FileFilter { - private static final String[] EXTENSIONS = {".class", ".jar", ".bsh"}; - private static final String DESCRIPTION = "Executable Files Only"; - private static final BinaryOnlyFilter filter = new BinaryOnlyFilter(); - - private BinaryOnlyFilter() { - } - - public static BinaryOnlyFilter getInstance() { - return filter; - } - public boolean validate(String name) { - for (int i = 0; i < EXTENSIONS.length; i++) - if (name.endsWith(EXTENSIONS[i])) - return true; - - return false; - } - - @Override - public String toString() { - return DESCRIPTION; - } -} diff --git a/scripting/java/org/openoffice/idesupport/filter/ExceptParcelFilter.java b/scripting/java/org/openoffice/idesupport/filter/ExceptParcelFilter.java deleted file mode 100644 index 25ce356..0000000 --- a/scripting/java/org/openoffice/idesupport/filter/ExceptParcelFilter.java +++ /dev/null @@ -1,45 +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.idesupport.filter; - -public class ExceptParcelFilter implements FileFilter { - private static final String DESCRIPTION = "Remove specified Parcel"; - private static final ExceptParcelFilter filter = new ExceptParcelFilter(); - private static String parcelName = null; - - private ExceptParcelFilter() { - } - - public void setParcelToRemove(String parcelName) { - ExceptParcelFilter.parcelName = parcelName; - } - - public static ExceptParcelFilter getInstance() { - return filter; - } - - public boolean validate(String name) { - return name.startsWith(ExceptParcelFilter.parcelName); - } - - @Override - public String toString() { - return DESCRIPTION + ": " + "<" + ExceptParcelFilter.parcelName + ">"; - } -} diff --git a/scripting/java/org/openoffice/idesupport/filter/FileFilter.java b/scripting/java/org/openoffice/idesupport/filter/FileFilter.java deleted file mode 100644 index f64a902..0000000 --- a/scripting/java/org/openoffice/idesupport/filter/FileFilter.java +++ /dev/null @@ -1,23 +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.idesupport.filter; - -public interface FileFilter { - boolean validate(String name); -} diff --git a/scripting/java/org/openoffice/idesupport/localoffice/LocalOfficeImpl.java b/scripting/java/org/openoffice/idesupport/localoffice/LocalOfficeImpl.java deleted file mode 100644 index 3051b72..0000000 --- a/scripting/java/org/openoffice/idesupport/localoffice/LocalOfficeImpl.java +++ /dev/null @@ -1,131 +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.idesupport.localoffice; - -import java.net.ConnectException; - -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.bridge.UnoUrlResolver; -import com.sun.star.bridge.XUnoUrlResolver; -import com.sun.star.beans.XPropertySet; -import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; - -import org.openoffice.idesupport.LocalOffice; - -/** - * LocalOfficeImpl represents a connection to the local office. - * - * This class is an implementation of LocalOffice ane allows to - * get access to some scripting framework releated functionality - * of the locally running office. The office has to be started - * with options appropriate for establishing local connection. - */ -public final class LocalOfficeImpl - extends LocalOffice { - private final static String STORAGE_MRG_SINGLETON = - "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager"; - - private transient XMultiComponentFactory mComponentFactory; - private transient XComponentContext mComponentContext; - - /** - * Connects to the running office. - * - * @param officePath is a platform specific path string - * to the office distribution. - * @param port is a communication port. - */ - @Override - protected void connect(String officePath, int port) - throws ConnectException { - try { - bootstrap(port); - } catch (java.lang.Exception ex) { - throw new ConnectException(ex.getMessage()); - } - } - - /** - * Refresh the script storage. - * - * @param uri is an identifier of storage has to be refreshed. - */ - @Override - public void refreshStorage(String uri) { - try { - Object object = null; - object = mComponentContext.getValueByName(STORAGE_MRG_SINGLETON); - XScriptStorageManager storageMgr; - storageMgr = UnoRuntime.queryInterface( - XScriptStorageManager.class, object); - storageMgr.refreshScriptStorage(uri); - } catch (java.lang.Exception ex) { - System.out.println("*** LocalOfficeImpl.refreshStorage: FAILED " + - ex.getMessage()); - System.out.println("*** LocalOfficeImpl.refreshStorage: FAILED " + - ex.getClass().getName()); - } - - System.out.println("*** LocalOfficeImpl.refreshStorage: DONE"); - } - - /** - * Closes the connection to the running office. - */ - @Override - public void disconnect() { - /* - if(mComponentFactory != null) { - XComponent comp = (XComponent)UnoRuntime.queryInterface( - XComponent.class, mComponentFactory); - comp.dispose(); - } - */ - } - - /** - * Boot straps UNO. - * - * The office has to be started with following string: - * "--accept=socket,host=localhost,port=<PORT>;urp;StarOffice.ServiceManager" - * - * @param port is a communication port. - */ - private void bootstrap(int port) - throws java.lang.Exception { - Object object; - mComponentContext = Bootstrap.createInitialComponentContext(null); - XUnoUrlResolver urlresolver = UnoUrlResolver.create(mComponentContext); - object = urlresolver.resolve( - "uno:socket,host=localhost,port=" + - port + - ";urp;StarOffice.ServiceManager"); - mComponentFactory = UnoRuntime.queryInterface( - XMultiComponentFactory.class, object); - XPropertySet factoryProps; - factoryProps = UnoRuntime.queryInterface( - XPropertySet.class, mComponentFactory); - object = factoryProps.getPropertyValue("DefaultContext"); - mComponentContext = UnoRuntime.queryInterface( - XComponentContext.class, object); - } -} diff --git a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java deleted file mode 100644 index 4098dca..0000000 --- a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java +++ /dev/null @@ -1,223 +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.idesupport.ui; - -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; - -import javax.swing.AbstractButton; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.border.LineBorder; - -import org.openoffice.idesupport.zip.ParcelZipper; - -import com.sun.star.script.framework.container.ParcelDescriptor; -import com.sun.star.script.framework.container.ScriptEntry; - -public class ConfigurePanel extends JPanel { - - private File basedir; - private ArrayList<String> classpath; - private ParcelDescriptor descriptor; - - private MethodPanel methodPanel; - private ScriptPanel scriptPanel; - - public static final String DIALOG_TITLE = - "Choose What to Export as Scripts"; - - public ConfigurePanel(String basedir, ArrayList<String> classpath, - ParcelDescriptor descriptor) { - - this.basedir = new File(basedir); - this.classpath = classpath; - this.descriptor = descriptor; - initUI(); - } - - public ConfigurePanel(String basedir, ArrayList<String> classpath) - throws IOException { - - this.basedir = new File(basedir); - this.classpath = classpath; - this.descriptor = new ParcelDescriptor(new File(this.basedir, - ParcelZipper.PARCEL_DESCRIPTOR_XML)); - initUI(); - } - - public void reload(String basedir, ArrayList<String> classpath, - ParcelDescriptor descriptor) { - - if (basedir != null) - this.basedir = new File(basedir); - - if (classpath != null) - this.classpath = classpath; - - if (descriptor != null) { - this.descriptor = descriptor; - } - - methodPanel.reload(this.basedir, this.classpath, - descriptor.getLanguage()); - scriptPanel.reload(descriptor.getScriptEntries()); - } - - public void reload(String basedir, ArrayList<String> classpath) - throws IOException { - - if (basedir != null) - this.basedir = new File(basedir); - - if (classpath != null) - this.classpath = classpath; - - this.descriptor = new ParcelDescriptor(new File(this.basedir, - ParcelZipper.PARCEL_DESCRIPTOR_XML)); - - methodPanel.reload(this.basedir, this.classpath, - descriptor.getLanguage()); - scriptPanel.reload(descriptor.getScriptEntries()); - } - - public ParcelDescriptor getConfiguration() throws Exception { - Iterator<ScriptEntry> scripts = scriptPanel.getScriptEntries(); - descriptor.setScriptEntries(scripts); - return descriptor; - } - - private void initUI() { - - JPanel leftPanel = new JPanel(); - JPanel methodButtons = initMethodButtons(); - methodPanel = new MethodPanel(basedir, classpath, descriptor.getLanguage()); - - leftPanel.setLayout(new BorderLayout()); - leftPanel.add(methodPanel, BorderLayout.CENTER); - - JPanel rightPanel = new JPanel(); - JPanel scriptButtons = initScriptButtons(); - scriptPanel = new ScriptPanel(descriptor.getScriptEntries()); - - rightPanel.setLayout(new BorderLayout()); - rightPanel.add(scriptPanel, BorderLayout.CENTER); - rightPanel.add(scriptButtons, BorderLayout.SOUTH); - - setLayout(new GridBagLayout()); - setPreferredSize(new java.awt.Dimension(700, 300)); - setBorder(LineBorder.createBlackLineBorder()); - - GridBagConstraints gbc = new GridBagConstraints(); - gbc.gridx = 0; - gbc.gridy = 0; - gbc.fill = java.awt.GridBagConstraints.BOTH; - gbc.ipadx = 40; - gbc.anchor = java.awt.GridBagConstraints.WEST; - gbc.insets = new Insets(10, 5, 5, 5); - gbc.weightx = 0.75; - add(leftPanel, gbc); - - gbc = new java.awt.GridBagConstraints(); - gbc.gridx = 1; - gbc.gridy = 0; - add(methodButtons, gbc); - - gbc = new java.awt.GridBagConstraints(); - gbc.gridx = 2; - gbc.gridy = 0; - gbc.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gbc.fill = java.awt.GridBagConstraints.BOTH; - gbc.anchor = java.awt.GridBagConstraints.EAST; - gbc.insets = new Insets(10, 5, 5, 5); - gbc.weightx = 1.0; - gbc.weighty = 1.0; - add(rightPanel, gbc); - } - - private JPanel initMethodButtons() { - JPanel panel = new JPanel(); - panel.setLayout(new GridBagLayout()); - ImageIcon icon = new ImageIcon( - getClass().getResource("/org/openoffice/idesupport/ui/add.gif")); - JButton addButton = new JButton("Add", icon); - addButton.setHorizontalTextPosition(AbstractButton.LEFT); - - addButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - scriptPanel.addScriptEntries(methodPanel.getSelectedEntries()); - } - } - ); - - GridBagConstraints gbc = new java.awt.GridBagConstraints(); - gbc.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gbc.fill = java.awt.GridBagConstraints.HORIZONTAL; - gbc.insets = new Insets(5, 5, 5, 5); - panel.add(addButton, gbc); - - JPanel dummyPanel = new JPanel(); - gbc = new java.awt.GridBagConstraints(); - gbc.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gbc.gridheight = java.awt.GridBagConstraints.REMAINDER; - gbc.fill = java.awt.GridBagConstraints.BOTH; - gbc.weightx = 1.0; - gbc.weighty = 1.0; - panel.add(dummyPanel, gbc); - - return panel; - } - - private JPanel initScriptButtons() { - JPanel panel = new JPanel(); - JButton removeButton = new JButton("Remove"); - JButton removeAllButton = new JButton("Remove All"); - - removeButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - scriptPanel.removeSelectedRows(); - } - } - ); - - removeAllButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - scriptPanel.removeAllRows(); - } - } - ); - - panel.add(removeButton); - panel.add(removeAllButton); - - return panel; - } -} diff --git a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java b/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java deleted file mode 100644 index 9bedf51..0000000 --- a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java +++ /dev/null @@ -1,164 +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.idesupport.ui; - -import java.awt.BorderLayout; -import java.io.File; -import java.util.ArrayList; - -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; - -import org.openoffice.idesupport.ExtensionFinder; -import org.openoffice.idesupport.JavaFinder; -import org.openoffice.idesupport.MethodFinder; - -import com.sun.star.script.framework.container.ScriptEntry; - -public class MethodPanel extends JPanel { - - private File basedir; - private ArrayList<String> classpath; - - private JList list; - private ScriptEntry[] values; - - public MethodPanel(File basedir, ArrayList<String> classpath, String language) { - this.basedir = basedir; - this.classpath = classpath; - - initValues(language); - initUI(); - } - - public void reload(File basedir, ArrayList<String> classpath, String language) { - this.basedir = basedir; - this.classpath = classpath; - - initValues(language); - list.setListData(values); - } - - public ScriptEntry[] getSelectedEntries() { - Object[] selections = list.getSelectedValues(); - ScriptEntry[] entries = new ScriptEntry[selections.length]; - - for (int i = 0; i < selections.length; i++) { - entries[i] = (ScriptEntry)selections[i]; - } - - return entries; - } - - private void initUI() { - JLabel label = new JLabel("Available Methods:"); - list = new JList(values); - - JScrollPane pane = new JScrollPane(list); - label.setLabelFor(pane); - - BorderLayout layout = new BorderLayout(); - setLayout(layout); - layout.setVgap(5); - - add(label, BorderLayout.NORTH); - add(pane, BorderLayout.CENTER); - } - - private void initValues(String language) { - MethodFinder finder; - - if (language == null) - finder = JavaFinder.getInstance(classpath); - else if (language.equalsIgnoreCase("beanshell")) - finder = new ExtensionFinder(language, new String[] {".bsh"}); - else - finder = JavaFinder.getInstance(classpath); - - values = finder.findMethods(basedir); - } - - /* - private class MethodTableModel extends AbstractTableModel { - final String[] columnNames = {"Method", - "Language"}; - - private ArrayList methods; - private int nextRow; - - public MethodTableModel() { - methods = new ArrayList(11); - } - - public int getColumnCount() { - return columnNames.length; - } - - public int getRowCount() { - return methods.size(); - } - - public String getColumnName(int col) { - return columnNames[col]; - } - - public void add(ScriptEntry entry) { - methods.addElement(entry); - fireTableRowsInserted(nextRow, nextRow); - nextRow++; - } - - public void remove(int row) { - methods.removeElementAt(row); - fireTableRowsDeleted(row, row); - nextRow--; - } - - public void removeAll() { - methods.removeAllElements(); - fireTableRowsDeleted(0, nextRow); - nextRow = 0; - } - - public Object getValueAt(int row) { - return methods.elementAt(row); - } - - public Object getValueAt(int row, int col) { - String result = ""; - ScriptEntry entry; - - entry = (ScriptEntry)methods.elementAt(row); - - if (col == 0) - result = entry.getLanguageName(); - else if (col == 1) - result = entry.getLanguage(); - - return result; - } - - public boolean isCellEditable(int row, int col) { - return false; - } - } - */ -} diff --git a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java b/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java deleted file mode 100644 index c25b5fb..0000000 --- a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java +++ /dev/null @@ -1,199 +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.idesupport.ui; - -import java.awt.BorderLayout; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.util.ArrayList; -import java.util.Iterator; - -import javax.swing.DefaultCellEditor; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableColumn; - -import com.sun.star.script.framework.container.ScriptEntry; - -public class ScriptPanel extends JPanel { - private ScriptTableModel model; - private JTable table; - - public ScriptPanel(ScriptEntry[] scripts) { - model = new ScriptTableModel(scripts); - initUI(); - } - - public void reload(ScriptEntry[] entries) { - model.removeAll(); - addScriptEntries(entries); - } - - public void addScriptEntries(ScriptEntry[] entries) { - for (int i = 0; i < entries.length; i++) { - ScriptEntry entry; - - try { - entry = (ScriptEntry) entries[i].clone(); - } catch (CloneNotSupportedException cnse) { - entry = new ScriptEntry(entries[i].getLanguage(), - entries[i].getLanguageName(), - entries[i].getLocation()); - } - - model.add(entry); - } - } - - public void removeSelectedRows() { - int[] selections = table.getSelectedRows(); - - for (int i = selections.length - 1; i >= 0; i--) { - model.remove(selections[i]); - } - } - - public void removeAllRows() { - model.removeAll(); - } - - public Iterator<ScriptEntry> getScriptEntries() { - return model.getScriptEntries(); - } - - private void initUI() { - table = new JTable(model); - TableColumn column = table.getColumnModel().getColumn(1); - column.setCellEditor(new DefaultCellEditor(new JTextField())); - - table.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent evt) { - tableFocusLost(); - } - }); - - JScrollPane pane = new JScrollPane(table); - JLabel label = new JLabel("Scripts:"); - label.setLabelFor(pane); - - BorderLayout layout = new BorderLayout(); - setLayout(layout); - layout.setVgap(5); - add(label, BorderLayout.NORTH); - add(pane, BorderLayout.CENTER); - } - - private void tableFocusLost() { - TableCellEditor editor = table.getCellEditor(); - - if (editor != null) { - Object value = editor.getCellEditorValue(); - - if (value != null) - model.setValueAt(value, - table.getEditingRow(), table.getEditingColumn()); - } - } - - private class ScriptTableModel extends AbstractTableModel { - final String[] columnNames = {"Exported Method", - "Script Name" - }; - - private ArrayList<ScriptEntry> scripts; - private int nextRow; - - public ScriptTableModel(ScriptEntry[] entries) { - scripts = new ArrayList<ScriptEntry>(entries.length + 11); - - for (int i = 0; i < entries.length; i++) { - scripts.add(entries[i]); - } - - nextRow = entries.length; - } - - public int getColumnCount() { - return columnNames.length; - } - - public int getRowCount() { - return scripts.size(); - } - - @Override - public String getColumnName(int col) { - return columnNames[col]; - } - - public void add(ScriptEntry entry) { - scripts.add(entry); - fireTableRowsInserted(nextRow, nextRow); - nextRow++; - } - - public void remove(int row) { - scripts.remove(row); - fireTableRowsDeleted(row, row); - nextRow--; - } - - public void removeAll() { - scripts.clear(); - fireTableRowsDeleted(0, nextRow); - nextRow = 0; - } - - public Iterator<ScriptEntry> getScriptEntries() { - return scripts.iterator(); - } - - public Object getValueAt(int row, int col) { - String result = ""; - ScriptEntry entry; - - entry = scripts.get(row); - - if (col == 0) - result = entry.getLanguageName(); - else if (col == 1) - result = entry.getLogicalName(); - - return result; - } - - @Override - public boolean isCellEditable(int row, int col) { - return (col != 0); - } - - @Override - public void setValueAt(Object value, int row, int col) { - ScriptEntry entry = scripts.get(row); - entry.setLogicalName((String)value); - fireTableCellUpdated(row, col); - } - } -} diff --git a/scripting/java/org/openoffice/idesupport/ui/add.gif b/scripting/java/org/openoffice/idesupport/ui/add.gif deleted file mode 100644 index e47c986..0000000 Binary files a/scripting/java/org/openoffice/idesupport/ui/add.gif and /dev/null differ diff --git a/scripting/java/org/openoffice/idesupport/xml/Manifest.java b/scripting/java/org/openoffice/idesupport/xml/Manifest.java deleted file mode 100644 index 492df63..0000000 --- a/scripting/java/org/openoffice/idesupport/xml/Manifest.java +++ /dev/null @@ -1,125 +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.idesupport.xml; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.w3c.dom.Element; - -import com.sun.star.script.framework.container.XMLParserFactory; - -public class Manifest { - - private Document document = null; - private boolean baseElementsExist = false; - - public Manifest(InputStream inputStream) throws IOException { - document = XMLParserFactory.getParser().parse(inputStream); - } - - public void add(String entry) { - add(entry, ""); - } - - private void add(String entry, String type) { - Element root, el; - - ensureBaseElementsExist(); - - try { - root = (Element) - document.getElementsByTagName("manifest:manifest").item(0); - - el = document.createElement("manifest:file-entry"); - el.setAttribute("manifest:media-type", type); - el.setAttribute("manifest:full-path", entry); - root.appendChild(el); - } catch (Exception e) { - System.err.println("Error adding entry: " + e.getMessage()); - } - } - - private void ensureBaseElementsExist() { - if (!baseElementsExist) { - baseElementsExist = true; - add("Scripts/", "application/script-parcel"); - } - } - - public void remove(String entry) { - Element root, el; - int len; - - try { - root = (Element) - document.getElementsByTagName("manifest:manifest").item(0); - - NodeList nl = root.getElementsByTagName("manifest:file-entry"); - - if (nl == null || (len = nl.getLength()) == 0) - return; - - ArrayList<Element> list = new ArrayList<Element>(); - - for (int i = 0; i < len; i++) { - el = (Element)nl.item(i); - - if (el.getAttribute("manifest:full-path").startsWith(entry)) { - list.add(el); - } - } - - Iterator iter = list.iterator(); - - while (iter.hasNext()) - root.removeChild((Element)iter.next()); - } catch (Exception e) { - System.err.println("Error removing entry: " + e.getMessage()); - } - } - - public InputStream getInputStream() throws IOException { - InputStream result = null; - ByteArrayOutputStream out = null; - - try { - out = new ByteArrayOutputStream(); - write(out); - result = new ByteArrayInputStream(out.toByteArray()); - } finally { - if (out != null) - out.close(); - } - - return result; - } - - private void write(OutputStream out) throws IOException { - XMLParserFactory.getParser().write(document, out); - } -} diff --git a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java b/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java deleted file mode 100644 index 3c8d797..0000000 --- a/scripting/java/org/openoffice/idesupport/zip/ParcelZipper.java +++ /dev/null @@ -1,159 +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.idesupport.zip; - -import java.io.*; -import java.util.zip.*; -import org.openoffice.idesupport.filter.FileFilter; -import org.openoffice.idesupport.filter.BinaryOnlyFilter; -import org.openoffice.idesupport.xml.Manifest; - -public class ParcelZipper { - public static final String PARCEL_PREFIX_DIR = "Scripts/"; - private static final String PARCEL_EXTENSION = "sxp"; - public static final String CONTENTS_DIRNAME = "Contents"; - public static final String PARCEL_DESCRIPTOR_XML = "parcel-descriptor.xml"; - - private static ParcelZipper zipper = null; - - private static final FileFilter DEFAULT_FILTER = - BinaryOnlyFilter.getInstance(); - - private ParcelZipper() { - } - - public static synchronized ParcelZipper getParcelZipper() { - if (zipper == null) - zipper = new ParcelZipper(); - - return zipper; - } - - - - - - - - public String removeParcel(File document, String parcelName) - throws IOException { - - ZipInputStream documentStream = null; - ZipOutputStream outStream = null; - Manifest manifest = null; - - if (!parcelName.startsWith(PARCEL_PREFIX_DIR)) - parcelName = PARCEL_PREFIX_DIR + parcelName; - - manifest = removeParcelFromManifest(document, parcelName); - - // first write contents of document to tmpfile - File tmpfile = new File(document.getAbsolutePath() + ".tmp"); - - try { - ZipEntry outEntry; - ZipEntry inEntry; - byte[] bytes = new byte[1024]; - int len; - - documentStream = new ZipInputStream(new FileInputStream(document)); - outStream = new ZipOutputStream(new FileOutputStream(tmpfile)); - - while ((inEntry = documentStream.getNextEntry()) != null) { - - if (inEntry.getName().startsWith(parcelName)) - continue; - - outEntry = new ZipEntry(inEntry); - outStream.putNextEntry(outEntry); - - if (inEntry.getName().equals("META-INF/manifest.xml") && - manifest != null) { - InputStream manifestStream = null; - - try { - manifestStream = manifest.getInputStream(); - - while ((len = manifestStream.read(bytes)) != -1) - outStream.write(bytes, 0, len); - } finally { - if (manifestStream != null) - manifestStream.close(); - } - } else if (!inEntry.isDirectory()) { - while ((len = documentStream.read(bytes)) != -1) - outStream.write(bytes, 0, len); - } - - outStream.closeEntry(); - } - } catch (IOException ioe) { - tmpfile.delete(); - throw ioe; - } finally { - if (documentStream != null) - documentStream.close(); - - if (outStream != null) - outStream.close(); - } - - if (!document.delete()) { - tmpfile.delete(); - throw new IOException("Could not overwrite " + document); - } else - tmpfile.renameTo(document); - - return document.getAbsolutePath(); - } - - private Manifest getManifestFromDocument(File document) { - ZipFile documentZip = null; - Manifest result = null; - - try { - documentZip = new ZipFile(document); - ZipEntry original = documentZip.getEntry("META-INF/manifest.xml"); - - if (original != null) { - result = new Manifest(documentZip.getInputStream(original)); - } - } catch (IOException ioe) { - } finally { - try { - if (documentZip != null) - documentZip.close(); - } catch (IOException ioe) {} - } - - return result; - } - - private Manifest removeParcelFromManifest(File document, String name) { - Manifest result = null; - - result = getManifestFromDocument(document); - - if (result == null) - return null; - - result.remove(name); - return result; - } -} diff --git a/scripting/java/org/openoffice/netbeans/editor/JavaKit.java b/scripting/java/org/openoffice/netbeans/editor/JavaKit.java deleted file mode 100644 index 1a3b6ab..0000000 --- a/scripting/java/org/openoffice/netbeans/editor/JavaKit.java +++ /dev/null @@ -1,237 +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.editor; - -import java.io.*; -import java.awt.event.KeyEvent; -import java.awt.event.InputEvent; -import java.awt.event.ActionEvent; -import java.net.URL; -import java.text.MessageFormat; - -import java.util.Map; -import java.util.List; -import java.util.ResourceBundle; -import java.util.MissingResourceException; -import javax.swing.KeyStroke; -import javax.swing.JEditorPane; -import javax.swing.JMenuItem; -import javax.swing.Action; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import javax.swing.text.TextAction; -import javax.swing.text.BadLocationException; -import org.netbeans.editor.*; -import org.netbeans.editor.ext.*; -import org.netbeans.editor.ext.java.*; - -/** -* Java editor kit with appropriate document -* -* @version 1.00 -*/ - -/* This class is based on the JavaKit class in the demosrc directory of - * the editor module of the NetBeans project: http://www.netbeans.org - * - * The class sets up an EditorKit for syntax highlighting and code completion - * of Java syntax - */ - -public class JavaKit extends ExtKit { - - public static final String JAVA_MIME_TYPE = "text/x-java"; // NOI18N - - static final long serialVersionUID = -5445829962533684922L; - - static { - Settings.addInitializer(new JavaSettingsInitializer(JavaKit.class)); - Settings.reset(); - - URL skeleton = null, body = null; - skeleton = JavaKit.class.getResource("OOo.jcs"); - body = JavaKit.class.getResource("OOo.jcb"); - - if (skeleton != null && body != null) { - DAFileProvider provider = new DAFileProvider( - new URLAccessor(skeleton), - new URLAccessor(body)); - - JCBaseFinder finder = new JCBaseFinder(); - finder.append(provider); - JavaCompletion.setFinder(finder); - } - } - - public String getContentType() { - return JAVA_MIME_TYPE; - } - - /** Create new instance of syntax coloring scanner - * @param doc document to operate on. It can be null in the cases the syntax - * creation is not related to the particular document - */ - public Syntax createSyntax(Document doc) { - return new JavaSyntax(); - } - - /** Create syntax support */ - public SyntaxSupport createSyntaxSupport(BaseDocument doc) { - return new JavaSyntaxSupport(doc); - } - - public Completion createCompletion(ExtEditorUI extEditorUI) { - return new JavaCompletion(extEditorUI); - } - - /** Create the formatter appropriate for this kit */ - public Formatter createFormatter() { - return new JavaFormatter(this.getClass()); - } - - protected EditorUI createEditorUI() { - return new ExtEditorUI(); - } - - protected void initDocument(BaseDocument doc) { - doc.addLayer(new JavaDrawLayerFactory.JavaLayer(), - JavaDrawLayerFactory.JAVA_LAYER_VISIBILITY); - doc.addDocumentListener(new JavaDrawLayerFactory.LParenWatcher()); - } - - /** - * DataAccessor for parser DB files via URL streams - */ - public static class URLAccessor implements DataAccessor { - - URL url; - InputStream stream; - int streamOff; - int actOff; - - public URLAccessor(URL url) { - this.url = url; - } - - /** Not implemented - */ - public void append(byte[] buffer, int off, int len) - throws IOException { - throw new IllegalArgumentException("read only!"); - } - - /** - * Reads exactly <code>len</code> bytes from this file resource - * into the byte array, starting at the current file pointer. - * This method reads repeatedly from the file until the requested - * number of bytes are read. This method blocks until the requested - * number of bytes are read, the end of the inputStream is detected, - * or an exception is thrown. - * - * @param buffer the buffer into which the data is read. - * @param off the start offset of the data. - * @param len the number of bytes to read. - */ - public void read(byte[] buffer, int off, int len) throws IOException { - InputStream str = getStream(actOff); - - while (len > 0) { - int count = str.read(buffer, off, len); - streamOff += count; - off += count; - len -= count; - } - } - - /** Opens DataAccessor file resource - * @param requestWrite if true, file is opened for read/write - */ - public void open(boolean requestWrite) throws IOException { - if (requestWrite) - throw new IllegalArgumentException("read only!"); - } - - /** Closes DataAccessor file resource */ - public void close() throws IOException { - if (stream != null) { - stream.close(); - stream = null; - } - } - - /** - * Returns the current offset in this file. - * - * @return the offset from the beginning of the file, in bytes, - * at which the next read or write occurs. - */ - public long getFilePointer() throws IOException { - return actOff; - } - - /** Clears the file and sets the offset to 0 */ - public void resetFile() throws IOException { - throw new IllegalArgumentException("read only!"); - } - - /** - * Sets the file-pointer offset, measured from the beginning of this - * file, at which the next read or write occurs. - */ - public void seek(long pos) throws IOException { - actOff = (int)pos; - } - - /** Gets InputStream prepared for reading from <code>off</code> - * offset position - */ - private InputStream getStream(int off) throws IOException { - if (streamOff > off && stream != null) { - stream.close(); - stream = null; - } - - if (stream == null) { - stream = url.openStream(); - streamOff = 0; - } - - while (streamOff < off) { - long len = stream.skip(off - streamOff); - streamOff += (int)len; - - if (len == 0) throw new IOException("EOF"); - } - - return stream; - } - - public int getFileLength() { - try { - int l = url.openConnection().getContentLength(); - return l; - } catch (IOException e) { - return 0; - } - } - - public String toString() { - return url.toString(); - } - } -} diff --git a/scripting/java/org/openoffice/netbeans/editor/NetBeansSourceView.java b/scripting/java/org/openoffice/netbeans/editor/NetBeansSourceView.java deleted file mode 100644 index 19388fd..0000000 --- a/scripting/java/org/openoffice/netbeans/editor/NetBeansSourceView.java +++ /dev/null @@ -1,197 +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.editor; - -import javax.swing.*; -import javax.swing.text.Document; -import javax.swing.event.DocumentListener; -import javax.swing.event.DocumentEvent; - -import java.io.*; -import java.util.ResourceBundle; - -import javax.swing.text.Caret; -import org.netbeans.editor.*; -import org.netbeans.editor.ext.*; - -import com.sun.star.script.framework.provider.beanshell.ScriptSourceView; -import com.sun.star.script.framework.provider.beanshell.ScriptSourceModel; - -public class NetBeansSourceView extends JPanel - implements ScriptSourceView, DocumentListener { - - private ScriptSourceModel model; - private JEditorPane pane; - private boolean isModified = false; - - static { - // Feed our kits with their default Settings - Settings.addInitializer( - new BaseSettingsInitializer(), Settings.CORE_LEVEL); - Settings.addInitializer( - new ExtSettingsInitializer(), Settings.CORE_LEVEL); - Settings.reset(); - - try { - Class kitClass = Class.forName( - NetBeansSourceView.class.getPackage().getName() + ".JavaKit"); - - JEditorPane.registerEditorKitForContentType( - "text/x-java", kitClass.getName(), kitClass.getClassLoader()); - } catch (ClassNotFoundException exc) { - } - } - - private class MyLocalizer implements LocaleSupport.Localizer { - private ResourceBundle bundle; - - public MyLocalizer(String bundleName) { - bundle = ResourceBundle.getBundle(bundleName); - } - - // Localizer - public String getString(String key) { - return bundle.getString(key); - } - } - - public NetBeansSourceView(ScriptSourceModel model) { - this.model = model; - - LocaleSupport.addLocalizer( - new MyLocalizer("org.netbeans.editor.Bundle")); - - pane = new JEditorPane("text/x-java", ""); - pane.setText(model.getText()); - - JScrollPane spane = new JScrollPane(); - spane.setViewportView(pane); - setLayout(new java.awt.GridLayout(1, 1)); - add(spane); - - pane.getDocument().addDocumentListener(this); - } - - public static void main(String[] args) { - if (args.length < 1) { - System.err.println("No file specified"); - System.exit(-1); - } - - File f = new File(args[0]); - - if (!f.exists() || !f.isFile()) { - System.err.println("Invalid file"); - System.exit(-1); - } - - java.net.URL url = null; - - try { - url = f.toURL(); - } catch (java.net.MalformedURLException mue) { - System.err.println("Invalid file"); - System.exit(-1); - } - - NetBeansSourceView view = - new NetBeansSourceView(new ScriptSourceModel(url)); - - JFrame frame = new JFrame(); - frame.getContentPane().add(view); - frame.setSize(640, 480); - frame.show(); - } - - // Code grabbed from NetBeans editor module - public void scrollToLine(int line) { - BaseDocument doc = Utilities.getDocument(pane); - - int pos = -1; - - if (doc != null) { - // Obtain the offset where to jump - pos = Utilities.getRowStartFromLineOffset(doc, line); - } - - if (pos != -1) { - Caret caret = pane.getCaret(); - - if (caret instanceof BaseCaret) { // support extended scroll mode - BaseCaret bCaret = (BaseCaret)caret; - bCaret.setDot(pos, bCaret, EditorUI.SCROLL_FIND); - } else { - caret.setDot(pos); - } - } - } - - public void clear() { - pane.setText(""); - } - - public void update() { - /* Remove ourselves as a DocumentListener while loading the source - so we don't get a storm of DocumentEvents during loading */ - pane.getDocument().removeDocumentListener(this); - - if (!isModified) { - pane.setText(model.getText()); - } - - // scroll to current position of the model - try { - scrollToLine(model.getCurrentPosition()); - } catch (Exception e) { - // couldn't scroll to line, do nothing - } - - // Add back the listener - pane.getDocument().addDocumentListener(this); - } - - public boolean isModified() { - return isModified; - } - - public void setModified(boolean value) { - isModified = value; - } - - public String getText() { - return pane.getText(); - } - - /* Implementation of DocumentListener interface */ - public void insertUpdate(DocumentEvent e) { - doChanged(e); - } - - public void removeUpdate(DocumentEvent e) { - doChanged(e); - } - - public void changedUpdate(DocumentEvent e) { - doChanged(e); - } - - public void doChanged(DocumentEvent e) { - isModified = true; - } - -} diff --git a/scripting/java/org/openoffice/netbeans/editor/OOo.jcb b/scripting/java/org/openoffice/netbeans/editor/OOo.jcb deleted file mode 100644 index 7286934..0000000 --- a/scripting/java/org/openoffice/netbeans/editor/OOo.jcb +++ /dev/null @@ -1,5 +0,0 @@ ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits