IssueZilla 10518 -
Add a language attribute to the parcel element Add support for deploying to language specific directories
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeDocument.java,v $
|
* $RCSfile: OfficeDocument.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-26 12:46:44 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:30 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -63,10 +63,9 @@ package org.openoffice.idesupport;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.*;
|
import java.util.zip.*;
|
||||||
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.beans.PropertyVetoException;
|
|
||||||
import javax.naming.InvalidNameException;
|
|
||||||
|
|
||||||
import org.openoffice.idesupport.filter.FileFilter;
|
import org.openoffice.idesupport.filter.FileFilter;
|
||||||
import org.openoffice.idesupport.filter.BinaryOnlyFilter;
|
import org.openoffice.idesupport.filter.BinaryOnlyFilter;
|
||||||
@@ -74,58 +73,44 @@ import org.openoffice.idesupport.zip.ParcelZipper;
|
|||||||
|
|
||||||
public class OfficeDocument
|
public class OfficeDocument
|
||||||
{
|
{
|
||||||
public static final String PARCEL_PREFIX_DIR = "Scripts/java/";
|
public static final String PARCEL_PREFIX_DIR =
|
||||||
public static final String OFFICE_EXTENSIONS = "sxc,sxw";
|
ParcelZipper.PARCEL_PREFIX_DIR;
|
||||||
|
|
||||||
|
public static final String[] OFFICE_EXTENSIONS = {".sxc" , ".sxw"};
|
||||||
public static final String ARCHIVE_TAG = "[PARCEL_FILE]";
|
public static final String ARCHIVE_TAG = "[PARCEL_FILE]";
|
||||||
public static final String OFFICE_PRODUCT_NAME = "OpenOffice.org";
|
public static final String OFFICE_PRODUCT_NAME = "OpenOffice.org";
|
||||||
|
|
||||||
private static ParcelZipper zipper = ParcelZipper.getParcelZipper();
|
private static ParcelZipper zipper = ParcelZipper.getParcelZipper();
|
||||||
private File officeFile = null;
|
private File file = null;
|
||||||
private String parcelName = null;
|
|
||||||
private String extension = null;
|
|
||||||
|
|
||||||
public OfficeDocument(File officeFile) throws InvalidNameException
|
public OfficeDocument(File file) throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
this.officeFile = officeFile;
|
if (!file.exists() || file.isDirectory() || !isOfficeFile(file)) {
|
||||||
if( !checkIfOfficeDocument() )
|
throw new IllegalArgumentException("This is not a valid " +
|
||||||
{
|
|
||||||
throw new InvalidNameException("This is not a valid " +
|
|
||||||
OFFICE_PRODUCT_NAME + " document.");
|
OFFICE_PRODUCT_NAME + " document.");
|
||||||
}
|
}
|
||||||
|
this.file = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkIfOfficeDocument()
|
private boolean isOfficeFile(File file) {
|
||||||
{
|
for (int i = 0; i < OFFICE_EXTENSIONS.length; i++)
|
||||||
if( officeFile.isDirectory() )
|
if (file.getName().endsWith(OFFICE_EXTENSIONS[i]))
|
||||||
{
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
String tmpName = officeFile.getName();
|
|
||||||
if( tmpName.lastIndexOf(".") == 0 )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.extension = tmpName.substring(tmpName.lastIndexOf(".")+1);
|
|
||||||
if( (OFFICE_EXTENSIONS.indexOf(extension)==-1) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.parcelName = tmpName.substring(0,tmpName.lastIndexOf("."));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getParcels()
|
public Enumeration getParcels() {
|
||||||
{
|
|
||||||
java.util.Vector parcelEntries = new java.util.Vector();
|
Vector parcels = new Vector();
|
||||||
ZipFile zp = null;
|
ZipFile zp = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
zp = new ZipFile(this.officeFile);
|
zp = new ZipFile(this.file);
|
||||||
|
|
||||||
for (Enumeration officeEntries = zp.entries(); officeEntries.hasMoreElements(); )
|
for (Enumeration enum = zp.entries(); enum.hasMoreElements(); )
|
||||||
{
|
{
|
||||||
ZipEntry ze = (ZipEntry)officeEntries.nextElement();
|
ZipEntry ze = (ZipEntry)enum.nextElement();
|
||||||
if (ze.getName().endsWith(ParcelZipper.PARCEL_DESCRIPTOR_XML))
|
if (ze.getName().endsWith(ParcelZipper.PARCEL_DESCRIPTOR_XML))
|
||||||
{
|
{
|
||||||
String tmp = ze.getName();
|
String tmp = ze.getName();
|
||||||
@@ -135,7 +120,7 @@ public class OfficeDocument
|
|||||||
|
|
||||||
String parcelName = ARCHIVE_TAG +
|
String parcelName = ARCHIVE_TAG +
|
||||||
ze.getName().substring(start, end);
|
ze.getName().substring(start, end);
|
||||||
parcelEntries.add(parcelName);
|
parcels.add(parcelName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,23 +140,18 @@ public class OfficeDocument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return parcelEntries.elements();
|
return parcels.elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParcelNameFromEntry(String parcelName)
|
public String getParcelEntryFromName(String parcelName) {
|
||||||
{
|
|
||||||
return parcelName.substring(PARCEL_PREFIX_DIR.length(), parcelName.length()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParcelEntryFromName(String parcelName)
|
|
||||||
{
|
|
||||||
return parcelName.substring(ARCHIVE_TAG.length()) + "/";
|
return parcelName.substring(ARCHIVE_TAG.length()) + "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeParcel(String parcelName)
|
public boolean removeParcel(String parcelName) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
ParcelZipper.getParcelZipper().unzipToZipExceptParcel(this.officeFile, getParcelEntryFromName(parcelName));
|
ParcelZipper.getParcelZipper().removeParcel(
|
||||||
|
file, getParcelEntryFromName(parcelName));
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
@@ -179,9 +159,4 @@ public class OfficeDocument
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String unzipOneParcel(String parcelName)
|
|
||||||
{
|
|
||||||
return new String("location");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: SVersionRCFile.java,v $
|
* $RCSfile: SVersionRCFile.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.5 $
|
* $Revision: 1.6 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 11:42:46 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:30 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -105,7 +105,6 @@ public class SVersionRCFile {
|
|||||||
|
|
||||||
public SVersionRCFile(String name) {
|
public SVersionRCFile(String name) {
|
||||||
sverionrc = new File(name);
|
sverionrc = new File(name);
|
||||||
System.out.println("Created new SVersionRCFile: " + name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SVersionRCFile createInstance() {
|
public static SVersionRCFile createInstance() {
|
||||||
@@ -126,6 +125,31 @@ public class SVersionRCFile {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, '/');
|
||||||
|
|
||||||
|
StringBuffer buf = new StringBuffer(FILE_URL_PREFIX);
|
||||||
|
buf.append(path);
|
||||||
|
|
||||||
|
if (f.isDirectory())
|
||||||
|
buf.append("/");
|
||||||
|
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public Hashtable getVersions() throws IOException {
|
public Hashtable getVersions() throws IOException {
|
||||||
BufferedReader br;
|
BufferedReader br;
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ConfigurePanel.java,v $
|
* $RCSfile: ConfigurePanel.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 17:47:56 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:31 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -62,6 +62,8 @@
|
|||||||
package org.openoffice.idesupport.ui;
|
package org.openoffice.idesupport.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
@@ -88,23 +90,33 @@ public class ConfigurePanel extends JPanel {
|
|||||||
|
|
||||||
private File basedir;
|
private File basedir;
|
||||||
private Vector classpath;
|
private Vector classpath;
|
||||||
|
private ParcelDescriptor descriptor;
|
||||||
|
|
||||||
private MethodPanel methodPanel;
|
private MethodPanel methodPanel;
|
||||||
private ScriptPanel scriptPanel;
|
private ScriptPanel scriptPanel;
|
||||||
private ParcelDescriptor descriptor = ParcelDescriptor.getParcelDescriptor();
|
|
||||||
|
|
||||||
public static final String DIALOG_TITLE = "Choose What to Export as Scripts";
|
public static final String DIALOG_TITLE =
|
||||||
|
"Choose What to Export as Scripts";
|
||||||
|
|
||||||
public ConfigurePanel(String basedir, Vector classpath, Document doc,
|
public ConfigurePanel(String basedir, Vector classpath, Document doc) {
|
||||||
String language) {
|
|
||||||
|
|
||||||
this.basedir = new File(basedir);
|
this.basedir = new File(basedir);
|
||||||
this.classpath = classpath;
|
this.classpath = classpath;
|
||||||
initUI(doc, language);
|
this.descriptor = new ParcelDescriptor(doc);
|
||||||
|
initUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload(String basedir, Vector classpath, Document doc,
|
public ConfigurePanel(String basedir, Vector classpath)
|
||||||
String language) {
|
throws FileNotFoundException {
|
||||||
|
|
||||||
|
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, Vector classpath, Document doc) {
|
||||||
|
|
||||||
if (basedir != null)
|
if (basedir != null)
|
||||||
this.basedir = new File(basedir);
|
this.basedir = new File(basedir);
|
||||||
@@ -112,27 +124,51 @@ public class ConfigurePanel extends JPanel {
|
|||||||
if (classpath != null)
|
if (classpath != null)
|
||||||
this.classpath = classpath;
|
this.classpath = classpath;
|
||||||
|
|
||||||
methodPanel.reload(this.basedir, this.classpath, language);
|
if (doc != null) {
|
||||||
|
descriptor = new ParcelDescriptor(doc);
|
||||||
|
}
|
||||||
|
|
||||||
if (doc != null)
|
methodPanel.reload(this.basedir, this.classpath,
|
||||||
scriptPanel.reload(descriptor.parse(doc));
|
descriptor.getLanguage());
|
||||||
|
scriptPanel.reload(descriptor.getScriptEntries());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reload(String basedir, Vector classpath)
|
||||||
|
throws FileNotFoundException {
|
||||||
|
|
||||||
|
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 Document getConfiguration() throws Exception {
|
public Document getConfiguration() throws Exception {
|
||||||
Enumeration scripts = scriptPanel.getScriptEntries();
|
Enumeration scripts = scriptPanel.getScriptEntries();
|
||||||
return descriptor.generate(scripts);
|
descriptor.setScriptEntries(scripts);
|
||||||
|
return descriptor.getDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initUI(Document doc, String language) {
|
private void initUI() {
|
||||||
|
|
||||||
JPanel leftPanel = new JPanel();
|
JPanel leftPanel = new JPanel();
|
||||||
JPanel methodButtons = initMethodButtons();
|
JPanel methodButtons = initMethodButtons();
|
||||||
methodPanel = new MethodPanel(basedir, classpath, language);
|
methodPanel = new MethodPanel(basedir, classpath, descriptor.getLanguage());
|
||||||
|
|
||||||
leftPanel.setLayout(new BorderLayout());
|
leftPanel.setLayout(new BorderLayout());
|
||||||
leftPanel.add(methodPanel, BorderLayout.CENTER);
|
leftPanel.add(methodPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
JPanel rightPanel = new JPanel();
|
JPanel rightPanel = new JPanel();
|
||||||
JPanel scriptButtons = initScriptButtons();
|
JPanel scriptButtons = initScriptButtons();
|
||||||
scriptPanel = new ScriptPanel(descriptor.parse(doc));
|
scriptPanel = new ScriptPanel(descriptor.getScriptEntries());
|
||||||
|
|
||||||
rightPanel.setLayout(new BorderLayout());
|
rightPanel.setLayout(new BorderLayout());
|
||||||
rightPanel.add(scriptPanel, BorderLayout.CENTER);
|
rightPanel.add(scriptPanel, BorderLayout.CENTER);
|
||||||
rightPanel.add(scriptButtons, BorderLayout.SOUTH);
|
rightPanel.add(scriptButtons, BorderLayout.SOUTH);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: MethodPanel.java,v $
|
* $RCSfile: MethodPanel.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 17:47:56 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:31 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -75,9 +75,12 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
|
||||||
import org.openoffice.idesupport.ScriptEntry;
|
import org.openoffice.idesupport.ScriptEntry;
|
||||||
import org.openoffice.idesupport.DefaultScriptClassLoader;
|
import org.openoffice.idesupport.SVersionRCFile;
|
||||||
import org.openoffice.idesupport.zip.ParcelZipper;
|
import org.openoffice.idesupport.zip.ParcelZipper;
|
||||||
|
|
||||||
public class MethodPanel extends JPanel {
|
public class MethodPanel extends JPanel {
|
||||||
@@ -162,8 +165,7 @@ public class MethodPanel extends JPanel {
|
|||||||
classNames = findClassNames();
|
classNames = findClassNames();
|
||||||
if (classNames != null && classNames.length != 0) {
|
if (classNames != null && classNames.length != 0) {
|
||||||
|
|
||||||
DefaultScriptClassLoader classloader =
|
ClassLoader classloader = getClassLoader();
|
||||||
new DefaultScriptClassLoader(classpath);
|
|
||||||
|
|
||||||
for (int i = 0; i < classNames.length; i++)
|
for (int i = 0; i < classNames.length; i++)
|
||||||
{
|
{
|
||||||
@@ -203,6 +205,26 @@ public class MethodPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ClassLoader getClassLoader() {
|
||||||
|
|
||||||
|
int len = classpath.size();
|
||||||
|
ArrayList urls = new ArrayList(len);
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
try {
|
||||||
|
String s = (String)classpath.elementAt(i);
|
||||||
|
s = SVersionRCFile.toFileURL(s);
|
||||||
|
|
||||||
|
if (s != null)
|
||||||
|
urls.add(new URL(s));
|
||||||
|
}
|
||||||
|
catch (MalformedURLException mue) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new URLClassLoader((URL[])urls.toArray(new URL[0]));
|
||||||
|
}
|
||||||
|
|
||||||
private void initBeanShellValues(String parcelName) {
|
private void initBeanShellValues(String parcelName) {
|
||||||
|
|
||||||
ArrayList bshFiles = findFiles(basedir, ".bsh");
|
ArrayList bshFiles = findFiles(basedir, ".bsh");
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Manifest.java,v $
|
* $RCSfile: Manifest.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-13 17:44:14 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:31 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -83,12 +83,10 @@ import org.w3c.dom.Element;
|
|||||||
public class Manifest {
|
public class Manifest {
|
||||||
|
|
||||||
private Document document = null;
|
private Document document = null;
|
||||||
private XMLParser parser = null;
|
|
||||||
private boolean baseElementsExist = false;
|
private boolean baseElementsExist = false;
|
||||||
|
|
||||||
public Manifest(InputStream inputStream, XMLParser parser) {
|
public Manifest(InputStream inputStream) {
|
||||||
this.parser = parser;
|
document = XMLParserFactory.getParser().parse(inputStream);
|
||||||
document = parser.parse(inputStream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(String entry) {
|
public void add(String entry) {
|
||||||
@@ -119,7 +117,6 @@ public class Manifest {
|
|||||||
if (baseElementsExist == false) {
|
if (baseElementsExist == false) {
|
||||||
baseElementsExist = true;
|
baseElementsExist = true;
|
||||||
add("Scripts/", "application/script-parcel");
|
add("Scripts/", "application/script-parcel");
|
||||||
add("Scripts/java/", "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +191,6 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void write(OutputStream out) throws IOException {
|
public void write(OutputStream out) throws IOException {
|
||||||
parser.write(document, out);
|
XMLParserFactory.getParser().write(document, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelZipper.java,v $
|
* $RCSfile: ParcelZipper.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-26 12:46:44 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:32 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -70,18 +70,17 @@ import org.openoffice.idesupport.filter.FileFilter;
|
|||||||
import org.openoffice.idesupport.filter.BinaryOnlyFilter;
|
import org.openoffice.idesupport.filter.BinaryOnlyFilter;
|
||||||
import org.openoffice.idesupport.filter.ExceptParcelFilter;
|
import org.openoffice.idesupport.filter.ExceptParcelFilter;
|
||||||
|
|
||||||
import org.openoffice.idesupport.xml.XMLParser;
|
|
||||||
import org.openoffice.idesupport.xml.Manifest;
|
import org.openoffice.idesupport.xml.Manifest;
|
||||||
|
import org.openoffice.idesupport.xml.ParcelDescriptor;
|
||||||
|
|
||||||
public class ParcelZipper
|
public class ParcelZipper
|
||||||
{
|
{
|
||||||
public static final String PARCEL_PREFIX_DIR = "Scripts/java/";
|
public static final String PARCEL_PREFIX_DIR = "Scripts/";
|
||||||
public static final String PARCEL_EXTENSION = "sxp";
|
public static final String PARCEL_EXTENSION = "sxp";
|
||||||
public static final String CONTENTS_DIRNAME = "Contents";
|
public static final String CONTENTS_DIRNAME = "Contents";
|
||||||
public static final String PARCEL_DESCRIPTOR_XML = "parcel-descriptor.xml";
|
public static final String PARCEL_DESCRIPTOR_XML = "parcel-descriptor.xml";
|
||||||
|
|
||||||
private static ParcelZipper zipper = null;
|
private static ParcelZipper zipper = null;
|
||||||
private static XMLParser parser = null;
|
|
||||||
|
|
||||||
private static final FileFilter DEFAULT_FILTER =
|
private static final FileFilter DEFAULT_FILTER =
|
||||||
BinaryOnlyFilter.getInstance();
|
BinaryOnlyFilter.getInstance();
|
||||||
@@ -99,10 +98,6 @@ public class ParcelZipper
|
|||||||
return zipper;
|
return zipper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setXMLParser(XMLParser parser) {
|
|
||||||
getParcelZipper().parser = parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String zipParcel(File basedir) throws IOException {
|
public String zipParcel(File basedir) throws IOException {
|
||||||
File targetfile, targetdir;
|
File targetfile, targetdir;
|
||||||
|
|
||||||
@@ -197,7 +192,9 @@ public class ParcelZipper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOverwriteNeeded(File parcel, File target) {
|
public boolean isOverwriteNeeded(File parcel, File target)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|
||||||
if (target.isDirectory())
|
if (target.isDirectory())
|
||||||
@@ -219,7 +216,9 @@ public class ParcelZipper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDocumentOverwriteNeeded(File parcel, File document) {
|
private boolean isDocumentOverwriteNeeded(File parcel, File document)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
ZipFile documentZip;
|
ZipFile documentZip;
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
@@ -231,7 +230,8 @@ public class ParcelZipper
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name =
|
String name =
|
||||||
PARCEL_PREFIX_DIR + getParcelDirFromParcelZip(parcel.getName()) +
|
PARCEL_PREFIX_DIR + getParcelLanguage(parcel) +
|
||||||
|
"/" + getParcelDirFromParcelZip(parcel.getName()) +
|
||||||
"/" + PARCEL_DESCRIPTOR_XML;
|
"/" + PARCEL_DESCRIPTOR_XML;
|
||||||
|
|
||||||
if (documentZip.getEntry(name) != null)
|
if (documentZip.getEntry(name) != null)
|
||||||
@@ -267,6 +267,7 @@ public class ParcelZipper
|
|||||||
|
|
||||||
ZipInputStream in;
|
ZipInputStream in;
|
||||||
File parcelDir = new File(targetDirectory,
|
File parcelDir = new File(targetDirectory,
|
||||||
|
getParcelLanguage(parcel) + File.separator +
|
||||||
getParcelDirFromParcelZip(parcel.getName()));
|
getParcelDirFromParcelZip(parcel.getName()));
|
||||||
|
|
||||||
if (isDirectoryOverwriteNeeded(parcel, targetDirectory)) {
|
if (isDirectoryOverwriteNeeded(parcel, targetDirectory)) {
|
||||||
@@ -328,13 +329,14 @@ public class ParcelZipper
|
|||||||
|
|
||||||
if (isDocumentOverwriteNeeded(parcel, targetDocument)) {
|
if (isDocumentOverwriteNeeded(parcel, targetDocument)) {
|
||||||
String parcelName = getParcelDirFromParcelZip(parcel.getName());
|
String parcelName = getParcelDirFromParcelZip(parcel.getName());
|
||||||
unzipToZipExceptParcel(targetDocument, parcelName);
|
removeParcel(targetDocument, parcelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// first write contents of document to tmpfile
|
// first write contents of document to tmpfile
|
||||||
File tmpfile = new File(targetDocument.getAbsolutePath() + ".tmp");
|
File tmpfile = new File(targetDocument.getAbsolutePath() + ".tmp");
|
||||||
|
|
||||||
manifest = addParcelToManifest(targetDocument, parcel);
|
manifest = addParcelToManifest(targetDocument, parcel);
|
||||||
|
String language = getParcelLanguage(parcel);
|
||||||
|
|
||||||
documentStream =
|
documentStream =
|
||||||
new ZipInputStream(new FileInputStream(targetDocument));
|
new ZipInputStream(new FileInputStream(targetDocument));
|
||||||
@@ -343,7 +345,7 @@ public class ParcelZipper
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
copyParcelToZip(parcelStream, outStream, PARCEL_PREFIX_DIR +
|
copyParcelToZip(parcelStream, outStream, PARCEL_PREFIX_DIR +
|
||||||
getParcelDirFromParcelZip(parcel.getName()));
|
language + "/" + getParcelDirFromParcelZip(parcel.getName()));
|
||||||
copyDocumentToZip(documentStream, outStream, manifest);
|
copyDocumentToZip(documentStream, outStream, manifest);
|
||||||
documentStream.close();
|
documentStream.close();
|
||||||
parcelStream.close();
|
parcelStream.close();
|
||||||
@@ -416,7 +418,7 @@ public class ParcelZipper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String unzipToZipExceptParcel(File document, String parcelName)
|
public String removeParcel(File document, String parcelName)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
ZipInputStream documentStream;
|
ZipInputStream documentStream;
|
||||||
@@ -494,7 +496,7 @@ public class ParcelZipper
|
|||||||
if (original != null) {
|
if (original != null) {
|
||||||
try {
|
try {
|
||||||
result =
|
result =
|
||||||
new Manifest(documentZip.getInputStream(original), parser);
|
new Manifest(documentZip.getInputStream(original));
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
catch (IOException ioe) {
|
||||||
result = null;
|
result = null;
|
||||||
@@ -510,7 +512,9 @@ public class ParcelZipper
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Manifest addParcelToManifest(File document, File parcel) {
|
private Manifest addParcelToManifest(File document, File parcel)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
ZipFile parcelZip;
|
ZipFile parcelZip;
|
||||||
Manifest result = null;
|
Manifest result = null;
|
||||||
|
|
||||||
@@ -518,6 +522,8 @@ public class ParcelZipper
|
|||||||
if (result == null)
|
if (result == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
String language = getParcelLanguage(parcel);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parcelZip = new ZipFile(parcel);
|
parcelZip = new ZipFile(parcel);
|
||||||
}
|
}
|
||||||
@@ -525,7 +531,7 @@ public class ParcelZipper
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String prefix = PARCEL_PREFIX_DIR +
|
String prefix = PARCEL_PREFIX_DIR + language + "/" +
|
||||||
getParcelDirFromParcelZip(parcel.getName()) + "/";
|
getParcelDirFromParcelZip(parcel.getName()) + "/";
|
||||||
|
|
||||||
Enumeration entries = parcelZip.entries();
|
Enumeration entries = parcelZip.entries();
|
||||||
@@ -553,4 +559,17 @@ public class ParcelZipper
|
|||||||
result.remove(name);
|
result.remove(name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getParcelLanguage(File file) throws IOException {
|
||||||
|
ZipFile zf = new ZipFile(file);
|
||||||
|
ZipEntry ze = zf.getEntry(PARCEL_DESCRIPTOR_XML);
|
||||||
|
|
||||||
|
if (ze == null)
|
||||||
|
throw new IOException("Could not find Parcel Descriptor in parcel");
|
||||||
|
|
||||||
|
InputStream is = zf.getInputStream(ze);
|
||||||
|
ParcelDescriptor pd = new ParcelDescriptor(is);
|
||||||
|
|
||||||
|
return pd.getLanguage().toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: DeployParcelAction.java,v $
|
* $RCSfile: DeployParcelAction.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 11:42:47 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -166,8 +166,7 @@ public class DeployParcelAction extends CookieAction implements Presenter.Popup
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
target = new File((String)versions.get(label) +
|
target = new File((String)versions.get(label) +
|
||||||
File.separator + "user" + File.separator + "Scripts" +
|
File.separator + "user" + File.separator + "Scripts");
|
||||||
File.separator + "java");
|
|
||||||
if (!target.exists()) {
|
if (!target.exists()) {
|
||||||
boolean response = askIfCreateDirectory(target);
|
boolean response = askIfCreateDirectory(target);
|
||||||
if (response == false) {
|
if (response == false) {
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeDocumentSupport.java,v $
|
* $RCSfile: OfficeDocumentSupport.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-13 17:44:23 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -81,7 +81,6 @@ import org.openide.filesystems.FileRenameEvent;
|
|||||||
import org.openide.cookies.OpenCookie;
|
import org.openide.cookies.OpenCookie;
|
||||||
|
|
||||||
import org.openoffice.idesupport.OfficeDocument;
|
import org.openoffice.idesupport.OfficeDocument;
|
||||||
import org.openoffice.idesupport.zip.ParcelZipper;
|
|
||||||
|
|
||||||
import org.openoffice.netbeans.modules.office.options.OfficeSettings;
|
import org.openoffice.netbeans.modules.office.options.OfficeSettings;
|
||||||
import org.openoffice.netbeans.modules.office.loader.OfficeDocumentDataObject;
|
import org.openoffice.netbeans.modules.office.loader.OfficeDocumentDataObject;
|
||||||
@@ -107,11 +106,6 @@ public class OfficeDocumentSupport implements OfficeDocumentCookie, OpenCookie,
|
|||||||
fo.addFileChangeListener(this);
|
fo.addFileChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that ParcelZipper's XMLParser is set
|
|
||||||
static {
|
|
||||||
ParcelZipper.setXMLParser(ManifestParser.getManifestParser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mount() {
|
public void mount() {
|
||||||
File file = FileUtil.toFile(dataObj.getPrimaryFile());
|
File file = FileUtil.toFile(dataObj.getPrimaryFile());
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelFolderCookie.java,v $
|
* $RCSfile: ParcelFolderCookie.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-13 17:44:24 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -67,5 +67,5 @@ public interface ParcelFolderCookie extends Node.Cookie
|
|||||||
{
|
{
|
||||||
public void generate();
|
public void generate();
|
||||||
|
|
||||||
public void configure();
|
public boolean configure();
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelFolderSupport.java,v $
|
* $RCSfile: ParcelFolderSupport.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: npower $ $Date: 2003-01-16 18:54:46 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -108,11 +108,6 @@ public class ParcelFolderSupport implements ParcelFolderCookie
|
|||||||
this.pf = pf;
|
this.pf = pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that ParcelZipper's XMLParser is set
|
|
||||||
static {
|
|
||||||
ParcelZipper.setXMLParser(ManifestParser.getManifestParser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void generate() {
|
public void generate() {
|
||||||
ParcelFolder.ParcelFolderNode node =
|
ParcelFolder.ParcelFolderNode node =
|
||||||
(ParcelFolder.ParcelFolderNode)pf.getNodeDelegate();
|
(ParcelFolder.ParcelFolderNode)pf.getNodeDelegate();
|
||||||
@@ -127,7 +122,9 @@ public class ParcelFolderSupport implements ParcelFolderCookie
|
|||||||
File targetfile = new File(node.getTargetDir() + File.separator +
|
File targetfile = new File(node.getTargetDir() + File.separator +
|
||||||
parcelBase.getName() + "." + ParcelZipper.PARCEL_EXTENSION);
|
parcelBase.getName() + "." + ParcelZipper.PARCEL_EXTENSION);
|
||||||
|
|
||||||
configure();
|
boolean proceed = configure();
|
||||||
|
if (proceed == false)
|
||||||
|
return;
|
||||||
|
|
||||||
final OutputWriter out =
|
final OutputWriter out =
|
||||||
ParcelSupport.getOutputWindowWriter(parcelDir.getName() + " (generating)");
|
ParcelSupport.getOutputWindowWriter(parcelDir.getName() + " (generating)");
|
||||||
@@ -152,45 +149,29 @@ public class ParcelFolderSupport implements ParcelFolderCookie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configure() {
|
public boolean configure() {
|
||||||
|
|
||||||
FileObject primary = pf.getPrimaryFile();
|
FileObject primary = pf.getPrimaryFile();
|
||||||
|
|
||||||
ParcelFolder.ParcelFolderNode node =
|
|
||||||
(ParcelFolder.ParcelFolderNode)pf.getNodeDelegate();
|
|
||||||
|
|
||||||
File contents = FileUtil.toFile(
|
File contents = FileUtil.toFile(
|
||||||
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
|
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
|
||||||
|
|
||||||
File parcelDescriptor = new File(contents,
|
File parcelDescriptor = new File(contents,
|
||||||
ParcelZipper.PARCEL_DESCRIPTOR_XML);
|
ParcelZipper.PARCEL_DESCRIPTOR_XML);
|
||||||
|
|
||||||
InputSource is;
|
|
||||||
Document previous = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
is = new InputSource(new FileInputStream(parcelDescriptor));
|
|
||||||
previous = XMLUtil.parse(is, false, false, null, null);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException fnfe) {
|
|
||||||
System.out.println("Couldn't find file: " + parcelDescriptor.getName());
|
|
||||||
}
|
|
||||||
catch (IOException ioe) {
|
|
||||||
System.out.println("IO Error parsing file: " + parcelDescriptor.getName());
|
|
||||||
}
|
|
||||||
catch (SAXException se) {
|
|
||||||
System.out.println("Sax Error parsing file: " + parcelDescriptor.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector classpath = getClasspath();
|
Vector classpath = getClasspath();
|
||||||
classpath.addElement(contents.getAbsolutePath());
|
classpath.addElement(contents.getAbsolutePath());
|
||||||
|
|
||||||
if (configuror == null)
|
try {
|
||||||
configuror = new ConfigurePanel(contents.getAbsolutePath(),
|
if (configuror == null)
|
||||||
classpath, previous, node.getLanguage());
|
configuror = new ConfigurePanel(
|
||||||
else
|
contents.getAbsolutePath(), classpath);
|
||||||
configuror.reload(contents.getAbsolutePath(), classpath, previous,
|
else
|
||||||
node.getLanguage());
|
configuror.reload(contents.getAbsolutePath(), classpath);
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException fnfe) {
|
||||||
|
ErrorManager.getDefault().notify(fnfe);
|
||||||
|
}
|
||||||
|
|
||||||
DialogDescriptor descriptor = new DialogDescriptor(configuror,
|
DialogDescriptor descriptor = new DialogDescriptor(configuror,
|
||||||
ConfigurePanel.DIALOG_TITLE);
|
ConfigurePanel.DIALOG_TITLE);
|
||||||
@@ -208,6 +189,10 @@ public class ParcelFolderSupport implements ParcelFolderCookie
|
|||||||
ErrorManager.getDefault().notify(e);
|
ErrorManager.getDefault().notify(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector getClasspath() {
|
private Vector getClasspath() {
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelSupport.java,v $
|
* $RCSfile: ParcelSupport.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-13 17:44:25 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:34 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -96,11 +96,6 @@ public class ParcelSupport implements ParcelCookie
|
|||||||
this.fo = fo;
|
this.fo = fo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that ParcelZipper's XMLParser is set
|
|
||||||
static {
|
|
||||||
ParcelZipper.setXMLParser(ManifestParser.getManifestParser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return FileUtil.toFile(fo);
|
return FileUtil.toFile(fo);
|
||||||
}
|
}
|
||||||
@@ -145,13 +140,20 @@ public class ParcelSupport implements ParcelCookie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zipper.isOverwriteNeeded(source, target) == true)
|
|
||||||
if (promptForOverwrite(source, target) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
OutputWriter out =
|
OutputWriter out =
|
||||||
getOutputWindowWriter(fo.getName() + " (deploying)");
|
getOutputWindowWriter(fo.getName() + " (deploying)");
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (zipper.isOverwriteNeeded(source, target) == true)
|
||||||
|
if (promptForOverwrite(source, target) == false)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (IOException ioe) {
|
||||||
|
out.println("DEPLOYMENT FAILED: reason: " +
|
||||||
|
ioe.getClass().getName() + ": "+ ioe.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
out.println("Deploying: " + fo.getName() +
|
out.println("Deploying: " + fo.getName() +
|
||||||
"\nTo: " + target.getAbsolutePath(), null);
|
"\nTo: " + target.getAbsolutePath(), null);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelFolder.java,v $
|
* $RCSfile: ParcelFolder.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 18:00:19 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:34 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -161,8 +161,8 @@ public class ParcelFolder extends DataFolder {
|
|||||||
prop = createFilterProperty();
|
prop = createFilterProperty();
|
||||||
props.put(prop);
|
props.put(prop);
|
||||||
|
|
||||||
prop = createLanguageProperty();
|
// prop = createLanguageProperty();
|
||||||
props.put(prop);
|
// props.put(prop);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeModule.java,v $
|
* $RCSfile: OfficeModule.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-21 19:00:05 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:35 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -62,11 +62,16 @@
|
|||||||
package org.openoffice.netbeans.modules.office.utils;
|
package org.openoffice.netbeans.modules.office.utils;
|
||||||
|
|
||||||
import org.openide.modules.ModuleInstall;
|
import org.openide.modules.ModuleInstall;
|
||||||
|
import org.openoffice.idesupport.xml.XMLParserFactory;
|
||||||
|
|
||||||
public class OfficeModule extends ModuleInstall {
|
public class OfficeModule extends ModuleInstall {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8499324854301243852L;
|
private static final long serialVersionUID = -8499324854301243852L;
|
||||||
|
|
||||||
|
public void restored () {
|
||||||
|
XMLParserFactory.setParser(ManifestParser.getManifestParser());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean closing () {
|
public boolean closing () {
|
||||||
FrameworkJarChecker.unmountDependencies();
|
FrameworkJarChecker.unmountDependencies();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelContentsIterator.java,v $
|
* $RCSfile: ParcelContentsIterator.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 17:51:45 $
|
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:35 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -84,6 +84,7 @@ import org.openide.util.NbBundle;
|
|||||||
import org.openide.filesystems.*;
|
import org.openide.filesystems.*;
|
||||||
|
|
||||||
import org.openoffice.idesupport.zip.ParcelZipper;
|
import org.openoffice.idesupport.zip.ParcelZipper;
|
||||||
|
import org.openoffice.idesupport.xml.ParcelDescriptor;
|
||||||
import org.openoffice.netbeans.modules.office.loader.ParcelFolder;
|
import org.openoffice.netbeans.modules.office.loader.ParcelFolder;
|
||||||
import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem;
|
import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem;
|
||||||
import org.openoffice.netbeans.modules.office.utils.PackageRemover;
|
import org.openoffice.netbeans.modules.office.utils.PackageRemover;
|
||||||
@@ -175,12 +176,20 @@ public class ParcelContentsIterator implements TemplateWizard.Iterator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileObject recipe = result.getPrimaryFile();
|
FileObject recipe = result.getPrimaryFile();
|
||||||
recipe.setAttribute(ParcelFolder.LANGUAGE_ATTRIBUTE, language);
|
|
||||||
System.out.println("Called setAttribute from wizard: " + language);
|
|
||||||
|
|
||||||
FileObject contents =
|
FileObject contents =
|
||||||
recipe.getFileObject(ParcelZipper.CONTENTS_DIRNAME);
|
recipe.getFileObject(ParcelZipper.CONTENTS_DIRNAME);
|
||||||
|
|
||||||
|
FileObject descriptor =
|
||||||
|
contents.getFileObject(ParcelZipper.PARCEL_DESCRIPTOR_XML);
|
||||||
|
|
||||||
|
if (descriptor != null) {
|
||||||
|
ParcelDescriptor pd =
|
||||||
|
new ParcelDescriptor(FileUtil.toFile(descriptor));
|
||||||
|
pd.setLanguage(language);
|
||||||
|
pd.write();
|
||||||
|
}
|
||||||
|
|
||||||
if (contents != null) {
|
if (contents != null) {
|
||||||
DataFolder parent = DataFolder.findFolder(contents);
|
DataFolder parent = DataFolder.findFolder(contents);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user