diff options
Diffstat (limited to 'scripting/java')
10 files changed, 105 insertions, 99 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index 20ac568827eb..70db0b39b680 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -17,28 +17,29 @@ */ package com.sun.star.script.framework.container; +import java.io.ByteArrayInputStream; import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.FileNotFoundException; -import java.io.ByteArrayInputStream; - +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; -import java.util.Map; import java.util.HashMap; import java.util.Hashtable; -import java.util.Enumeration; import java.util.Iterator; +import java.util.Map; +import org.w3c.dom.CharacterData; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; // import javax.xml.parsers.DocumentBuilderFactory; // import javax.xml.parsers.DocumentBuilder; // import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.*; - public class ParcelDescriptor { // File name to be used for parcel descriptor files @@ -294,10 +295,10 @@ public class ParcelDescriptor { addScriptEntry(scripts[i]); } - public void setScriptEntries(Enumeration<ScriptEntry> scripts) { + public void setScriptEntries(Iterator<ScriptEntry> scripts) { clearEntries(); - while (scripts.hasMoreElements()) - addScriptEntry(scripts.nextElement()); + while (scripts.hasNext()) + addScriptEntry(scripts.next()); } public String getLanguageProperty(String name) { diff --git a/scripting/java/org/openoffice/idesupport/JavaFinder.java b/scripting/java/org/openoffice/idesupport/JavaFinder.java index 8c0071844fe9..846481857848 100644 --- a/scripting/java/org/openoffice/idesupport/JavaFinder.java +++ b/scripting/java/org/openoffice/idesupport/JavaFinder.java @@ -20,14 +20,15 @@ package org.openoffice.idesupport; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Vector; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; -import java.net.MalformedURLException; +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; @@ -41,11 +42,11 @@ public class JavaFinder implements MethodFinder { private static final String FIRST_PARAM = "drafts.com.sun.star.script.framework.runtime.XScriptContext"; - private Vector<String> classpath = null; + private List<String> classpath = null; private JavaFinder() {} - private JavaFinder(Vector<String> classpath) { + private JavaFinder(List<String> classpath) { this.classpath = classpath; } @@ -59,7 +60,7 @@ public class JavaFinder implements MethodFinder { return finder; } - public static JavaFinder getInstance(Vector<String> classpath) { + public static JavaFinder getInstance(List<String> classpath) { return new JavaFinder(classpath); } @@ -136,7 +137,7 @@ public class JavaFinder implements MethodFinder { for (int i = 0; i < len; i++) { try { - String s = classpath.elementAt(i); + String s = classpath.get(i); s = SVersionRCFile.toFileURL(s); if (s != null) @@ -154,10 +155,10 @@ public class JavaFinder implements MethodFinder { files.add(basedir); try { - Enumeration offices = SVersionRCFile.createInstance().getVersions(); + Iterator<OfficeInstallation> offices = SVersionRCFile.createInstance().getVersions(); - while (offices.hasMoreElements()) { - OfficeInstallation oi = (OfficeInstallation)offices.nextElement(); + while (offices.hasNext()) { + OfficeInstallation oi = offices.next(); String unoil = SVersionRCFile.getPathForUnoil(oi.getPath()); if (unoil != null) { diff --git a/scripting/java/org/openoffice/idesupport/LocalOffice.java b/scripting/java/org/openoffice/idesupport/LocalOffice.java index ffbbb3fbee36..f28e36ad3c9e 100644 --- a/scripting/java/org/openoffice/idesupport/LocalOffice.java +++ b/scripting/java/org/openoffice/idesupport/LocalOffice.java @@ -20,7 +20,7 @@ package org.openoffice.idesupport; import java.io.File; import java.net.ConnectException; -import java.util.Vector; +import java.util.ArrayList; /** * LocalOffice represents a connection to the local office. @@ -43,12 +43,12 @@ public class LocalOffice public static final LocalOffice create( ClassLoader parent, String officePath, int port) { - Vector<String> path = new Vector<String>(); - path.addElement(officePath + "/program/classes/ridl.jar"); - path.addElement(officePath + "/program/classes/jurt.jar"); - path.addElement(officePath + "/program/classes/unoil.jar"); - path.addElement(officePath + "/program/classes/juh.jar"); - path.addElement(System.getProperties().getProperty("netbeans.home") + + ArrayList<String> path = new ArrayList<String>(); + path.add(officePath + "/program/classes/ridl.jar"); + path.add(officePath + "/program/classes/jurt.jar"); + path.add(officePath + "/program/classes/unoil.jar"); + path.add(officePath + "/program/classes/juh.jar"); + path.add(System.getProperties().getProperty("netbeans.home") + File.separator + "modules" + File.separator + "ext" + File.separator + "localoffice.jar"); diff --git a/scripting/java/org/openoffice/idesupport/OfficeDocument.java b/scripting/java/org/openoffice/idesupport/OfficeDocument.java index 72e17c68ff33..cbb36c53233a 100644 --- a/scripting/java/org/openoffice/idesupport/OfficeDocument.java +++ b/scripting/java/org/openoffice/idesupport/OfficeDocument.java @@ -18,10 +18,15 @@ package org.openoffice.idesupport; -import java.io.*; -import java.util.zip.*; -import java.util.Vector; +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 @@ -51,9 +56,9 @@ public class OfficeDocument return false; } - public Enumeration<String> getParcels() { + public Iterator<String> getParcels() { - Vector<String> parcels = new Vector<String>(); + ArrayList<String> parcels = new ArrayList<String>(); ZipFile zp = null; try @@ -90,7 +95,7 @@ public class OfficeDocument } } - return parcels.elements(); + return parcels.iterator(); } public boolean removeParcel(String parcelName) { diff --git a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java b/scripting/java/org/openoffice/idesupport/SVersionRCFile.java index 9e7bbe209ce4..149eca0e0101 100644 --- a/scripting/java/org/openoffice/idesupport/SVersionRCFile.java +++ b/scripting/java/org/openoffice/idesupport/SVersionRCFile.java @@ -18,14 +18,14 @@ package org.openoffice.idesupport; -import java.io.File; import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.io.FileNotFoundException; -import java.util.Vector; +import java.util.ArrayList; import java.util.HashMap; -import java.util.Enumeration; +import java.util.Iterator; import java.util.StringTokenizer; public class SVersionRCFile { @@ -61,7 +61,7 @@ public class SVersionRCFile { private File sversionrc = null; private OfficeInstallation defaultversion = null; - private Vector<OfficeInstallation> versions = null; + private ArrayList<OfficeInstallation> versions = null; private long lastModified = 0; public SVersionRCFile() { @@ -70,7 +70,7 @@ public class SVersionRCFile { public SVersionRCFile(String name) { sversionrc = new File(name); - versions = new Vector<OfficeInstallation>(5); + versions = new ArrayList<OfficeInstallation>(5); } public static SVersionRCFile createInstance() { @@ -99,7 +99,7 @@ public class SVersionRCFile { return defaultversion; } - public Enumeration<OfficeInstallation> getVersions() throws IOException { + public Iterator<OfficeInstallation> getVersions() throws IOException { long l = sversionrc.lastModified(); @@ -119,7 +119,7 @@ public class SVersionRCFile { br.close(); } } - return versions.elements(); + return versions.iterator(); } private void load(BufferedReader br) throws IOException { @@ -209,8 +209,7 @@ public class SVersionRCFile { else ov = new SVersionRCFile(args[0]); - Enumeration<OfficeInstallation> enumer; - + Iterator<OfficeInstallation> enumer; try { enumer = ov.getVersions(); } @@ -219,8 +218,8 @@ public class SVersionRCFile { return; } - while (enumer.hasMoreElements()) { - OfficeInstallation oi = enumer.nextElement(); + 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/ui/ConfigurePanel.java b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java index b1842d9079f4..72d98823864b 100644 --- a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java @@ -18,34 +18,32 @@ 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 java.util.Vector; -import java.util.Enumeration; - -import javax.swing.JPanel; -import javax.swing.JButton; import javax.swing.AbstractButton; import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JPanel; import javax.swing.border.LineBorder; -import java.awt.BorderLayout; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import org.openoffice.idesupport.zip.ParcelZipper; import com.sun.star.script.framework.container.ParcelDescriptor; import com.sun.star.script.framework.container.ScriptEntry; -import org.openoffice.idesupport.zip.ParcelZipper; - public class ConfigurePanel extends JPanel { private File basedir; - private Vector<String> classpath; + private ArrayList<String> classpath; private ParcelDescriptor descriptor; private MethodPanel methodPanel; @@ -54,7 +52,7 @@ public class ConfigurePanel extends JPanel { public static final String DIALOG_TITLE = "Choose What to Export as Scripts"; - public ConfigurePanel(String basedir, Vector<String> classpath, + public ConfigurePanel(String basedir, ArrayList<String> classpath, ParcelDescriptor descriptor) { this.basedir = new File(basedir); @@ -63,7 +61,7 @@ public class ConfigurePanel extends JPanel { initUI(); } - public ConfigurePanel(String basedir, Vector<String> classpath) + public ConfigurePanel(String basedir, ArrayList<String> classpath) throws IOException { this.basedir = new File(basedir); @@ -73,7 +71,7 @@ public class ConfigurePanel extends JPanel { initUI(); } - public void reload(String basedir, Vector<String> classpath, + public void reload(String basedir, ArrayList<String> classpath, ParcelDescriptor descriptor) { if (basedir != null) @@ -91,7 +89,7 @@ public class ConfigurePanel extends JPanel { scriptPanel.reload(descriptor.getScriptEntries()); } - public void reload(String basedir, Vector<String> classpath) + public void reload(String basedir, ArrayList<String> classpath) throws IOException { if (basedir != null) @@ -109,7 +107,7 @@ public class ConfigurePanel extends JPanel { } public ParcelDescriptor getConfiguration() throws Exception { - Enumeration<ScriptEntry> scripts = scriptPanel.getScriptEntries(); + Iterator<ScriptEntry> scripts = scriptPanel.getScriptEntries(); descriptor.setScriptEntries(scripts); return descriptor; } diff --git a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java b/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java index 9bc31edc30e2..362948c3a82b 100644 --- a/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/MethodPanel.java @@ -18,22 +18,25 @@ package org.openoffice.idesupport.ui; +import java.awt.BorderLayout; import java.io.File; -import java.util.Vector; +import java.util.ArrayList; + +import javax.swing.JLabel; +import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JList; -import javax.swing.JLabel; -import java.awt.BorderLayout; -import com.sun.star.script.framework.container.ScriptEntry; -import org.openoffice.idesupport.MethodFinder; + 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 Vector<String> classpath; + private ArrayList<String> classpath; private final static String FIRST_PARAM = "drafts.com.sun.star.script.framework.runtime.XScriptContext"; @@ -42,7 +45,7 @@ public class MethodPanel extends JPanel { private JList list; private ScriptEntry[] values; - public MethodPanel(File basedir, Vector<String> classpath, String language) { + public MethodPanel(File basedir, ArrayList<String> classpath, String language) { this.basedir = basedir; this.classpath = classpath; @@ -50,7 +53,7 @@ public class MethodPanel extends JPanel { initUI(); } - public void reload(File basedir, Vector<String> classpath, String language) { + public void reload(File basedir, ArrayList<String> classpath, String language) { this.basedir = basedir; this.classpath = classpath; @@ -103,11 +106,11 @@ public class MethodPanel extends JPanel { final String[] columnNames = {"Method", "Language"}; - private Vector methods; + private ArrayList methods; private int nextRow; public MethodTableModel() { - methods = new Vector(11); + methods = new ArrayList(11); } public int getColumnCount() { diff --git a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java b/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java index f34dd4806bdf..9804e5920c7f 100644 --- a/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java +++ b/scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java @@ -18,22 +18,21 @@ package org.openoffice.idesupport.ui; -import java.util.Vector; -import java.util.Enumeration; - import java.awt.BorderLayout; -import java.awt.event.FocusEvent; 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.JLabel; -import javax.swing.JTextField; import javax.swing.JTable; -import javax.swing.DefaultCellEditor; +import javax.swing.JTextField; +import javax.swing.table.AbstractTableModel; import javax.swing.table.TableCellEditor; import javax.swing.table.TableColumn; -import javax.swing.table.AbstractTableModel; import com.sun.star.script.framework.container.ScriptEntry; @@ -81,7 +80,7 @@ public class ScriptPanel extends JPanel { model.removeAll(); } - public Enumeration<ScriptEntry> getScriptEntries() { + public Iterator<ScriptEntry> getScriptEntries() { return model.getScriptEntries(); } @@ -121,13 +120,13 @@ public class ScriptPanel extends JPanel { final String[] columnNames = {"Exported Method", "Script Name"}; - private Vector<ScriptEntry> scripts; + private ArrayList<ScriptEntry> scripts; private int nextRow; public ScriptTableModel(ScriptEntry[] entries) { - scripts = new Vector<ScriptEntry>(entries.length + 11); + scripts = new ArrayList<ScriptEntry>(entries.length + 11); for (int i = 0; i < entries.length; i++) { - scripts.addElement(entries[i]); + scripts.add(entries[i]); } nextRow = entries.length; } @@ -145,32 +144,32 @@ public class ScriptPanel extends JPanel { } public void add(ScriptEntry entry) { - scripts.addElement(entry); + scripts.add(entry); fireTableRowsInserted(nextRow, nextRow); nextRow++; } public void remove(int row) { - scripts.removeElementAt(row); + scripts.remove(row); fireTableRowsDeleted(row, row); nextRow--; } public void removeAll() { - scripts.removeAllElements(); + scripts.clear(); fireTableRowsDeleted(0, nextRow); nextRow = 0; } - public Enumeration<ScriptEntry> getScriptEntries() { - return scripts.elements(); + public Iterator<ScriptEntry> getScriptEntries() { + return scripts.iterator(); } public Object getValueAt(int row, int col) { String result = ""; ScriptEntry entry; - entry = scripts.elementAt(row); + entry = scripts.get(row); if (col == 0) result = entry.getLanguageName(); @@ -188,7 +187,7 @@ public class ScriptPanel extends JPanel { } public void setValueAt(Object value, int row, int col) { - ScriptEntry entry = scripts.elementAt(row); + ScriptEntry entry = scripts.get(row); entry.setLogicalName((String)value); fireTableCellUpdated(row, col); } diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java index 9a29c514b3cd..db68ba7f874a 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java @@ -41,7 +41,7 @@ public class BuildParcelAction extends BuildAllAction { FrameworkJarChecker.mountDependencies(); for (int i = 0; i < activatedNodes.length; i++) { - Vector v = new Vector(1); + ArrayList v = new ArrayList(1); v.addElement(activatedNodes[i]); CompilerJob job = createJob(v.elements(), Compiler.DEPTH_INFINITE); diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java index 96657215b149..fb0268024451 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java @@ -211,7 +211,7 @@ public class ParcelFolderSupport implements ParcelFolderCookie } private Vector getConfigureClasspath() { - Vector result = new Vector(); + ArrayList result = new ArrayList(); String classpath = NbClassPath.createRepositoryPath().getClassPath(); if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) |