summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorTomas O'Connor <toconnor@openoffice.org>2003-06-04 12:19:54 +0000
committerTomas O'Connor <toconnor@openoffice.org>2003-06-04 12:19:54 +0000
commiteb9b1bb0bca4199495ba8658e1debf3b376d8518 (patch)
tree027597a8e72c774c07e9c2ffd7ff106897353c86 /scripting
parentb2960191c16486c377f5bda88003dcd438d23b7e (diff)
IssueZilla 15244 - classpath property does not always get written to parcel-descriptor.xml file
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java20
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java91
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java11
3 files changed, 67 insertions, 55 deletions
diff --git a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java
index d77f1be365a1..57138c9e5ba2 100644
--- a/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java
+++ b/scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ConfigurePanel.java,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: toconnor $ $Date: 2003-01-30 16:22:17 $
+ * last change: $Author: toconnor $ $Date: 2003-06-04 13:19:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,11 +98,12 @@ public class ConfigurePanel extends JPanel {
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,
+ ParcelDescriptor descriptor) {
this.basedir = new File(basedir);
this.classpath = classpath;
- this.descriptor = new ParcelDescriptor(doc);
+ this.descriptor = descriptor;
initUI();
}
@@ -116,7 +117,8 @@ public class ConfigurePanel extends JPanel {
initUI();
}
- public void reload(String basedir, Vector classpath, Document doc) {
+ public void reload(String basedir, Vector classpath,
+ ParcelDescriptor descriptor) {
if (basedir != null)
this.basedir = new File(basedir);
@@ -124,8 +126,8 @@ public class ConfigurePanel extends JPanel {
if (classpath != null)
this.classpath = classpath;
- if (doc != null) {
- descriptor = new ParcelDescriptor(doc);
+ if (descriptor != null) {
+ descriptor = descriptor;
}
methodPanel.reload(this.basedir, this.classpath,
@@ -150,10 +152,10 @@ public class ConfigurePanel extends JPanel {
scriptPanel.reload(descriptor.getScriptEntries());
}
- public Document getConfiguration() throws Exception {
+ public ParcelDescriptor getConfiguration() throws Exception {
Enumeration scripts = scriptPanel.getScriptEntries();
descriptor.setScriptEntries(scripts);
- return descriptor.getDocument();
+ return descriptor;
}
private void initUI() {
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 8a6faae5674b..5baafa2f758b 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelFolderSupport.java,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: toconnor $ $Date: 2003-02-24 12:53:09 $
+ * last change: $Author: toconnor $ $Date: 2003-06-04 13:19:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -102,54 +102,55 @@ import org.openoffice.idesupport.xml.ParcelDescriptor;
public class ParcelFolderSupport implements ParcelFolderCookie
{
- protected ParcelFolder pf;
+ protected ParcelFolder parcelFolder;
private ConfigurePanel configuror = null;
+ private ParcelDescriptor descriptor = null;
- public ParcelFolderSupport(ParcelFolder pf) {
- this.pf = pf;
+ public ParcelFolderSupport(ParcelFolder parcelFolder) {
+ this.parcelFolder = parcelFolder;
}
public String getClasspath() {
- FileObject primary = pf.getPrimaryFile();
-
- File contents = FileUtil.toFile(
- primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
+ if (descriptor == null) {
+ try {
+ descriptor = getParcelDescriptor();
+ }
+ catch (IOException ioe) {
+ ErrorManager.getDefault().notify(ioe);
+ return null;
+ }
+ }
+ return descriptor.getLanguageProperty("classpath");
+ }
+ public void setClasspath(String value) {
try {
- ParcelDescriptor pd = new ParcelDescriptor(
- new File(contents, ParcelZipper.PARCEL_DESCRIPTOR_XML));
-
- return pd.getLanguageProperty("classpath");
+ if (descriptor == null) {
+ descriptor = getParcelDescriptor();
+ }
+ descriptor.setLanguageProperty("classpath", value);
+ descriptor.write();
}
catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
- return "";
}
- public void setClasspath(String value) {
- FileObject primary = pf.getPrimaryFile();
+ private ParcelDescriptor getParcelDescriptor() throws IOException {
+ FileObject primary = parcelFolder.getPrimaryFile();
File contents = FileUtil.toFile(
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
- try {
- ParcelDescriptor pd = new ParcelDescriptor(
+ return new ParcelDescriptor(
new File(contents, ParcelZipper.PARCEL_DESCRIPTOR_XML));
-
- pd.setLanguageProperty("classpath", value);
- pd.write();
- }
- catch (IOException ioe) {
- ErrorManager.getDefault().notify(ioe);
- }
}
public void generate() {
ParcelFolder.ParcelFolderNode node =
- (ParcelFolder.ParcelFolderNode)pf.getNodeDelegate();
+ (ParcelFolder.ParcelFolderNode)parcelFolder.getNodeDelegate();
- FileObject parcelBase = pf.getPrimaryFile();
+ FileObject parcelBase = parcelFolder.getPrimaryFile();
FileObject contentsBase =
parcelBase.getFileObject(ParcelZipper.CONTENTS_DIRNAME);
@@ -158,13 +159,14 @@ public class ParcelFolderSupport implements ParcelFolderCookie
// The Location property is not displayed so just
// use the Parcel Recipe directory as the target directory
- File targetDir = FileUtil.toFile(pf.getPrimaryFile());
+ File targetDir = FileUtil.toFile(parcelFolder.getPrimaryFile());
File targetfile = new File(targetDir, File.separator +
parcelBase.getName() + "." + ParcelZipper.PARCEL_EXTENSION);
boolean proceed = configure();
- if (proceed == false)
+ if (proceed == false) {
return;
+ }
final OutputWriter out =
ParcelSupport.getOutputWindowWriter(parcelDir.getName() + " (generating)");
@@ -174,8 +176,9 @@ public class ParcelFolderSupport implements ParcelFolderCookie
out.println("\nGENERATION SUCCESSFUL.");
out.println("\nRight click on the generated parcel to deploy it");
- if (targetDir.equals(parcelDir))
+ if (targetDir.equals(parcelDir)) {
parcelBase.refresh(true);
+ }
}
catch (IOException ioe) {
out.println("GENERATION FAILED: reason: " + ioe.getClass().getName() + ": "+ ioe.getMessage());
@@ -191,26 +194,31 @@ public class ParcelFolderSupport implements ParcelFolderCookie
public boolean configure() {
- FileObject primary = pf.getPrimaryFile();
+ FileObject primary = parcelFolder.getPrimaryFile();
File contents = FileUtil.toFile(
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
- File parcelDescriptor = new File(contents,
- ParcelZipper.PARCEL_DESCRIPTOR_XML);
-
Vector classpath = getConfigureClasspath();
classpath.addElement(contents.getAbsolutePath());
try {
- if (configuror == null)
- configuror = new ConfigurePanel(
- contents.getAbsolutePath(), classpath);
- else
- configuror.reload(contents.getAbsolutePath(), classpath);
+ if (descriptor == null) {
+ descriptor = getParcelDescriptor();
+ }
+
+ if (configuror == null) {
+ configuror = new ConfigurePanel(contents.getAbsolutePath(),
+ classpath, descriptor);
+ }
+ else {
+ configuror.reload(contents.getAbsolutePath(), classpath,
+ descriptor);
+ }
}
catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
+ return false;
}
DialogDescriptor dd = new DialogDescriptor(configuror,
@@ -221,9 +229,8 @@ public class ParcelFolderSupport implements ParcelFolderCookie
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
try {
- Document doc = configuror.getConfiguration();
- FileOutputStream fos = new FileOutputStream(parcelDescriptor);
- XMLUtil.write(doc, fos, "");
+ descriptor = configuror.getConfiguration();
+ descriptor.write();
}
catch (Exception e) {
ErrorManager.getDefault().notify(e);
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java
index 979a322b3c45..8676ba149f18 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelFolder.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelFolder.java,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: toconnor $ $Date: 2003-02-24 12:53:10 $
+ * last change: $Author: toconnor $ $Date: 2003-06-04 13:19:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -134,10 +134,13 @@ public class ParcelFolder extends DataFolder {
ParcelFolderCookie cookie =
(ParcelFolderCookie)pf.getCookie(ParcelFolderCookie.class);
String s = cookie.getClasspath();
- if (s != null)
+ if (s != null) {
classpath = s;
- else
+ }
+ else {
classpath = ".";
+ cookie.setClasspath(classpath);
+ }
}
public File getTargetDir() {