IssueZilla 10578 - Update command line support to reflect current functionality

Improve exception handling and fix parcel removal code.
This commit is contained in:
Tomas O'Connor
2003-01-30 15:22:20 +00:00
parent b7ec4546b5
commit 4e16bd6a8a
8 changed files with 55 additions and 40 deletions

View File

@@ -3,9 +3,9 @@
#
# $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
# either of the following licenses
@@ -93,6 +93,12 @@
<pathelement path="${install.dir}/bsh-1.2b7.jar"/>
</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">
<pathelement path="${netbeans.home}/lib/openide.jar"/>
<pathelement path="${install.dir}/xerces.jar"/>
@@ -125,11 +131,12 @@
<target name="idesupport.compile" depends="prepare">
<javac srcdir="." destdir="${jardir}"
debug="${debug}" deprecation="on">
<classpath refid="openide.class.path"/>
<classpath refid="idesupport.class.path"/>
<exclude name="${idesupport.dir}/**/.*/*"/>
<exclude name="${idesupport.dir}/localoffice/**/*"/>
<include name="${idesupport.dir}/*.java"/>
<include name="${idesupport.dir}/*/*.java"/>
<include name="${netbeans.dir}/utils/CommandLineTools.java"/>
</javac>
</target>
@@ -194,6 +201,7 @@
<jar jarfile="${jardir}/idesupport.jar">
<fileset dir="${jardir}">
<include name="${idesupport.dir}/**/*.class"/>
<include name="CommandLineTools.class"/>
<exclude name="${idesupport.dir}/localoffice/*.class"/>
</fileset>
<fileset dir=".">

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -77,10 +77,8 @@ public class OfficeDocument
ParcelZipper.PARCEL_PREFIX_DIR;
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";
private static ParcelZipper zipper = ParcelZipper.getParcelZipper();
private File file = null;
public OfficeDocument(File file) throws IllegalArgumentException
@@ -116,10 +114,8 @@ public class OfficeDocument
String tmp = ze.getName();
int end = tmp.lastIndexOf("/");
tmp = tmp.substring(0, end);
int start = tmp.lastIndexOf("/") + 1;
String parcelName = ARCHIVE_TAG +
ze.getName().substring(start, end);
String parcelName = ze.getName().substring(0, end);
parcels.add(parcelName);
}
}
@@ -143,15 +139,10 @@ public class OfficeDocument
return parcels.elements();
}
public String getParcelEntryFromName(String parcelName) {
return parcelName.substring(ARCHIVE_TAG.length()) + "/";
}
public boolean removeParcel(String parcelName) {
try {
ParcelZipper.getParcelZipper().removeParcel(
file, getParcelEntryFromName(parcelName));
ParcelZipper.getParcelZipper().removeParcel(file, parcelName);
}
catch (IOException ioe) {
ioe.printStackTrace();

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -97,6 +97,7 @@ public class SVersionRCFile {
private static final HashMap files = new HashMap(3);
private File sverionrc = null;
private String defaultversion = null;
private long lastModified = 0;
public SVersionRCFile() {
@@ -150,6 +151,14 @@ public class SVersionRCFile {
return buf.toString();
}
public String getDefaultVersion() throws IOException {
if (defaultversion == null) {
getVersions();
}
return defaultversion;
}
public Hashtable getVersions() throws IOException {
BufferedReader br;
@@ -183,8 +192,11 @@ public class SVersionRCFile {
String name = tokens.nextToken();
String path = tokens.nextToken();
OfficeInstallation oi = new OfficeInstallation(name, path);
if (oi.supportsFramework())
if (oi.supportsFramework()) {
versions.put(name, oi.getPath());
if (defaultversion == null)
defaultversion = oi.getPath();
}
}
return versions;
}

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -62,7 +62,7 @@
package org.openoffice.idesupport.ui;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Vector;
import java.util.Enumeration;
@@ -107,7 +107,7 @@ public class ConfigurePanel extends JPanel {
}
public ConfigurePanel(String basedir, Vector classpath)
throws FileNotFoundException {
throws IOException {
this.basedir = new File(basedir);
this.classpath = classpath;
@@ -134,7 +134,7 @@ public class ConfigurePanel extends JPanel {
}
public void reload(String basedir, Vector classpath)
throws FileNotFoundException {
throws IOException {
if (basedir != null)
this.basedir = new File(basedir);

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -85,7 +85,7 @@ public class Manifest {
private Document document = null;
private boolean baseElementsExist = false;
public Manifest(InputStream inputStream) {
public Manifest(InputStream inputStream) throws IOException {
document = XMLParserFactory.getParser().parse(inputStream);
}

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -327,8 +327,11 @@ public class ParcelZipper
ZipOutputStream outStream;
Manifest manifest;
String language = getParcelLanguage(parcel);
if (isDocumentOverwriteNeeded(parcel, targetDocument)) {
String parcelName = getParcelDirFromParcelZip(parcel.getName());
String parcelName = language + "/" +
getParcelDirFromParcelZip(parcel.getName());
removeParcel(targetDocument, parcelName);
}
@@ -336,7 +339,6 @@ public class ParcelZipper
File tmpfile = new File(targetDocument.getAbsolutePath() + ".tmp");
manifest = addParcelToManifest(targetDocument, parcel);
String language = getParcelLanguage(parcel);
documentStream =
new ZipInputStream(new FileInputStream(targetDocument));
@@ -425,7 +427,8 @@ public class ParcelZipper
ZipOutputStream outStream;
Manifest manifest = null;
parcelName = PARCEL_PREFIX_DIR + parcelName;
if (!parcelName.startsWith(PARCEL_PREFIX_DIR))
parcelName = PARCEL_PREFIX_DIR + parcelName;
manifest = removeParcelFromManifest(document, parcelName);
// first write contents of document to tmpfile

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -169,8 +169,8 @@ public class ParcelFolderSupport implements ParcelFolderCookie
else
configuror.reload(contents.getAbsolutePath(), classpath);
}
catch (FileNotFoundException fnfe) {
ErrorManager.getDefault().notify(fnfe);
catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
DialogDescriptor descriptor = new DialogDescriptor(configuror,

View File

@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -73,7 +73,8 @@ import org.openide.util.HelpCtx;
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;
@@ -135,7 +136,7 @@ public class OfficeDocumentChildren extends Children.Keys implements ChangeListe
setIconBase("/org/openoffice/netbeans/modules/office/resources/OfficeIcon");
setName(name);
setDisplayName(name.substring(name.lastIndexOf(".") + 1));
setDisplayName(name.substring(name.lastIndexOf("/") + 1));
setShortDescription(name);
}