IssueZilla 10578 - Update command line support to reflect current functionality
Improve exception handling and fix parcel removal code.
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
#
|
#
|
||||||
# $RCSfile: build.xml,v $
|
# $RCSfile: build.xml,v $
|
||||||
#
|
#
|
||||||
# $Revision: 1.11 $
|
# $Revision: 1.12 $
|
||||||
#
|
#
|
||||||
# last change: $Author: toconnor $ $Date: 2003-01-21 15:45:59 $
|
# last change: $Author: toconnor $ $Date: 2003-01-30 16:22:15 $
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@@ -93,6 +93,12 @@
|
|||||||
<pathelement path="${install.dir}/bsh-1.2b7.jar"/>
|
<pathelement path="${install.dir}/bsh-1.2b7.jar"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
<path id="idesupport.class.path">
|
||||||
|
<!-- <pathelement path="${solar.jar}/jaxp.jar"/>
|
||||||
|
<pathelement path="${solar.jar}/parser.jar"/> -->
|
||||||
|
<pathelement path="${install.dir}/xerces.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
<path id="openide.class.path">
|
<path id="openide.class.path">
|
||||||
<pathelement path="${netbeans.home}/lib/openide.jar"/>
|
<pathelement path="${netbeans.home}/lib/openide.jar"/>
|
||||||
<pathelement path="${install.dir}/xerces.jar"/>
|
<pathelement path="${install.dir}/xerces.jar"/>
|
||||||
@@ -125,11 +131,12 @@
|
|||||||
<target name="idesupport.compile" depends="prepare">
|
<target name="idesupport.compile" depends="prepare">
|
||||||
<javac srcdir="." destdir="${jardir}"
|
<javac srcdir="." destdir="${jardir}"
|
||||||
debug="${debug}" deprecation="on">
|
debug="${debug}" deprecation="on">
|
||||||
<classpath refid="openide.class.path"/>
|
<classpath refid="idesupport.class.path"/>
|
||||||
<exclude name="${idesupport.dir}/**/.*/*"/>
|
<exclude name="${idesupport.dir}/**/.*/*"/>
|
||||||
<exclude name="${idesupport.dir}/localoffice/**/*"/>
|
<exclude name="${idesupport.dir}/localoffice/**/*"/>
|
||||||
<include name="${idesupport.dir}/*.java"/>
|
<include name="${idesupport.dir}/*.java"/>
|
||||||
<include name="${idesupport.dir}/*/*.java"/>
|
<include name="${idesupport.dir}/*/*.java"/>
|
||||||
|
<include name="${netbeans.dir}/utils/CommandLineTools.java"/>
|
||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -194,6 +201,7 @@
|
|||||||
<jar jarfile="${jardir}/idesupport.jar">
|
<jar jarfile="${jardir}/idesupport.jar">
|
||||||
<fileset dir="${jardir}">
|
<fileset dir="${jardir}">
|
||||||
<include name="${idesupport.dir}/**/*.class"/>
|
<include name="${idesupport.dir}/**/*.class"/>
|
||||||
|
<include name="CommandLineTools.class"/>
|
||||||
<exclude name="${idesupport.dir}/localoffice/*.class"/>
|
<exclude name="${idesupport.dir}/localoffice/*.class"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir=".">
|
<fileset dir=".">
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeDocument.java,v $
|
* $RCSfile: OfficeDocument.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:30 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:15 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -77,10 +77,8 @@ public class OfficeDocument
|
|||||||
ParcelZipper.PARCEL_PREFIX_DIR;
|
ParcelZipper.PARCEL_PREFIX_DIR;
|
||||||
|
|
||||||
public static final String[] OFFICE_EXTENSIONS = {".sxc" , ".sxw"};
|
public static final String[] OFFICE_EXTENSIONS = {".sxc" , ".sxw"};
|
||||||
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 File file = null;
|
private File file = null;
|
||||||
|
|
||||||
public OfficeDocument(File file) throws IllegalArgumentException
|
public OfficeDocument(File file) throws IllegalArgumentException
|
||||||
@@ -116,10 +114,8 @@ public class OfficeDocument
|
|||||||
String tmp = ze.getName();
|
String tmp = ze.getName();
|
||||||
int end = tmp.lastIndexOf("/");
|
int end = tmp.lastIndexOf("/");
|
||||||
tmp = tmp.substring(0, end);
|
tmp = tmp.substring(0, end);
|
||||||
int start = tmp.lastIndexOf("/") + 1;
|
|
||||||
|
|
||||||
String parcelName = ARCHIVE_TAG +
|
String parcelName = ze.getName().substring(0, end);
|
||||||
ze.getName().substring(start, end);
|
|
||||||
parcels.add(parcelName);
|
parcels.add(parcelName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,15 +139,10 @@ public class OfficeDocument
|
|||||||
return parcels.elements();
|
return parcels.elements();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParcelEntryFromName(String parcelName) {
|
|
||||||
return parcelName.substring(ARCHIVE_TAG.length()) + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeParcel(String parcelName) {
|
public boolean removeParcel(String parcelName) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ParcelZipper.getParcelZipper().removeParcel(
|
ParcelZipper.getParcelZipper().removeParcel(file, parcelName);
|
||||||
file, getParcelEntryFromName(parcelName));
|
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: SVersionRCFile.java,v $
|
* $RCSfile: SVersionRCFile.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.6 $
|
* $Revision: 1.7 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:30 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:16 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -97,6 +97,7 @@ public class SVersionRCFile {
|
|||||||
private static final HashMap files = new HashMap(3);
|
private static final HashMap files = new HashMap(3);
|
||||||
|
|
||||||
private File sverionrc = null;
|
private File sverionrc = null;
|
||||||
|
private String defaultversion = null;
|
||||||
private long lastModified = 0;
|
private long lastModified = 0;
|
||||||
|
|
||||||
public SVersionRCFile() {
|
public SVersionRCFile() {
|
||||||
@@ -150,6 +151,14 @@ public class SVersionRCFile {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDefaultVersion() throws IOException {
|
||||||
|
if (defaultversion == null) {
|
||||||
|
getVersions();
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultversion;
|
||||||
|
}
|
||||||
|
|
||||||
public Hashtable getVersions() throws IOException {
|
public Hashtable getVersions() throws IOException {
|
||||||
BufferedReader br;
|
BufferedReader br;
|
||||||
|
|
||||||
@@ -183,8 +192,11 @@ public class SVersionRCFile {
|
|||||||
String name = tokens.nextToken();
|
String name = tokens.nextToken();
|
||||||
String path = tokens.nextToken();
|
String path = tokens.nextToken();
|
||||||
OfficeInstallation oi = new OfficeInstallation(name, path);
|
OfficeInstallation oi = new OfficeInstallation(name, path);
|
||||||
if (oi.supportsFramework())
|
if (oi.supportsFramework()) {
|
||||||
versions.put(name, oi.getPath());
|
versions.put(name, oi.getPath());
|
||||||
|
if (defaultversion == null)
|
||||||
|
defaultversion = oi.getPath();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ConfigurePanel.java,v $
|
* $RCSfile: ConfigurePanel.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:31 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:17 $
|
||||||
*
|
*
|
||||||
* 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,7 +62,7 @@
|
|||||||
package org.openoffice.idesupport.ui;
|
package org.openoffice.idesupport.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
@@ -107,7 +107,7 @@ public class ConfigurePanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurePanel(String basedir, Vector classpath)
|
public ConfigurePanel(String basedir, Vector classpath)
|
||||||
throws FileNotFoundException {
|
throws IOException {
|
||||||
|
|
||||||
this.basedir = new File(basedir);
|
this.basedir = new File(basedir);
|
||||||
this.classpath = classpath;
|
this.classpath = classpath;
|
||||||
@@ -134,7 +134,7 @@ public class ConfigurePanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reload(String basedir, Vector classpath)
|
public void reload(String basedir, Vector classpath)
|
||||||
throws FileNotFoundException {
|
throws IOException {
|
||||||
|
|
||||||
if (basedir != null)
|
if (basedir != null)
|
||||||
this.basedir = new File(basedir);
|
this.basedir = new File(basedir);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Manifest.java,v $
|
* $RCSfile: Manifest.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:31 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:17 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -85,7 +85,7 @@ public class Manifest {
|
|||||||
private Document document = null;
|
private Document document = null;
|
||||||
private boolean baseElementsExist = false;
|
private boolean baseElementsExist = false;
|
||||||
|
|
||||||
public Manifest(InputStream inputStream) {
|
public Manifest(InputStream inputStream) throws IOException {
|
||||||
document = XMLParserFactory.getParser().parse(inputStream);
|
document = XMLParserFactory.getParser().parse(inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelZipper.java,v $
|
* $RCSfile: ParcelZipper.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:32 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:19 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -327,8 +327,11 @@ public class ParcelZipper
|
|||||||
ZipOutputStream outStream;
|
ZipOutputStream outStream;
|
||||||
Manifest manifest;
|
Manifest manifest;
|
||||||
|
|
||||||
|
String language = getParcelLanguage(parcel);
|
||||||
|
|
||||||
if (isDocumentOverwriteNeeded(parcel, targetDocument)) {
|
if (isDocumentOverwriteNeeded(parcel, targetDocument)) {
|
||||||
String parcelName = getParcelDirFromParcelZip(parcel.getName());
|
String parcelName = language + "/" +
|
||||||
|
getParcelDirFromParcelZip(parcel.getName());
|
||||||
removeParcel(targetDocument, parcelName);
|
removeParcel(targetDocument, parcelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +339,6 @@ public class ParcelZipper
|
|||||||
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));
|
||||||
@@ -425,6 +427,7 @@ public class ParcelZipper
|
|||||||
ZipOutputStream outStream;
|
ZipOutputStream outStream;
|
||||||
Manifest manifest = null;
|
Manifest manifest = null;
|
||||||
|
|
||||||
|
if (!parcelName.startsWith(PARCEL_PREFIX_DIR))
|
||||||
parcelName = PARCEL_PREFIX_DIR + parcelName;
|
parcelName = PARCEL_PREFIX_DIR + parcelName;
|
||||||
manifest = removeParcelFromManifest(document, parcelName);
|
manifest = removeParcelFromManifest(document, parcelName);
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ParcelFolderSupport.java,v $
|
* $RCSfile: ParcelFolderSupport.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.5 $
|
* $Revision: 1.6 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:19 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -169,8 +169,8 @@ public class ParcelFolderSupport implements ParcelFolderCookie
|
|||||||
else
|
else
|
||||||
configuror.reload(contents.getAbsolutePath(), classpath);
|
configuror.reload(contents.getAbsolutePath(), classpath);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException fnfe) {
|
catch (IOException ioe) {
|
||||||
ErrorManager.getDefault().notify(fnfe);
|
ErrorManager.getDefault().notify(ioe);
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogDescriptor descriptor = new DialogDescriptor(configuror,
|
DialogDescriptor descriptor = new DialogDescriptor(configuror,
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeDocumentChildren.java,v $
|
* $RCSfile: OfficeDocumentChildren.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2002-11-13 17:44:37 $
|
* last change: $Author: toconnor $ $Date: 2003-01-30 16:22:20 $
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -73,7 +73,8 @@ import org.openide.util.HelpCtx;
|
|||||||
|
|
||||||
import org.openoffice.netbeans.modules.office.actions.OfficeDocumentCookie;
|
import org.openoffice.netbeans.modules.office.actions.OfficeDocumentCookie;
|
||||||
|
|
||||||
public class OfficeDocumentChildren extends Children.Keys implements ChangeListener {
|
public class OfficeDocumentChildren extends Children.Keys
|
||||||
|
implements ChangeListener {
|
||||||
|
|
||||||
private OfficeDocumentCookie document = null;
|
private OfficeDocumentCookie document = null;
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ public class OfficeDocumentChildren extends Children.Keys implements ChangeListe
|
|||||||
setIconBase("/org/openoffice/netbeans/modules/office/resources/OfficeIcon");
|
setIconBase("/org/openoffice/netbeans/modules/office/resources/OfficeIcon");
|
||||||
|
|
||||||
setName(name);
|
setName(name);
|
||||||
setDisplayName(name.substring(name.lastIndexOf(".") + 1));
|
setDisplayName(name.substring(name.lastIndexOf("/") + 1));
|
||||||
setShortDescription(name);
|
setShortDescription(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user