IssueZilla 11564 - Add classpath property for parcel recipes

This commit is contained in:
Tomas O'Connor
2003-02-24 11:53:10 +00:00
parent 1151d21d14
commit f1664b337a
3 changed files with 89 additions and 11 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelFolderCookie.java,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:33 $
* last change: $Author: toconnor $ $Date: 2003-02-24 12:53:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,4 +68,7 @@ public interface ParcelFolderCookie extends Node.Cookie
public void generate();
public boolean configure();
public void setClasspath(String value);
public String getClasspath();
}

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelFolderSupport.java,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: toconnor $ $Date: 2003-02-20 12:00:21 $
* last change: $Author: toconnor $ $Date: 2003-02-24 12:53:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,6 +98,7 @@ import org.openoffice.netbeans.modules.office.utils.ManifestParser;
import org.openoffice.idesupport.zip.ParcelZipper;
import org.openoffice.idesupport.filter.FileFilter;
import org.openoffice.idesupport.ui.ConfigurePanel;
import org.openoffice.idesupport.xml.ParcelDescriptor;
public class ParcelFolderSupport implements ParcelFolderCookie
{
@@ -108,6 +109,42 @@ public class ParcelFolderSupport implements ParcelFolderCookie
this.pf = pf;
}
public String getClasspath() {
FileObject primary = pf.getPrimaryFile();
File contents = FileUtil.toFile(
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
try {
ParcelDescriptor pd = new ParcelDescriptor(
new File(contents, ParcelZipper.PARCEL_DESCRIPTOR_XML));
return pd.getLanguageProperty("classpath");
}
catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
return "";
}
public void setClasspath(String value) {
FileObject primary = pf.getPrimaryFile();
File contents = FileUtil.toFile(
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
try {
ParcelDescriptor pd = 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();
@@ -162,7 +199,7 @@ public class ParcelFolderSupport implements ParcelFolderCookie
File parcelDescriptor = new File(contents,
ParcelZipper.PARCEL_DESCRIPTOR_XML);
Vector classpath = getClasspath();
Vector classpath = getConfigureClasspath();
classpath.addElement(contents.getAbsolutePath());
try {
@@ -176,13 +213,13 @@ public class ParcelFolderSupport implements ParcelFolderCookie
ErrorManager.getDefault().notify(ioe);
}
DialogDescriptor descriptor = new DialogDescriptor(configuror,
DialogDescriptor dd = new DialogDescriptor(configuror,
ConfigurePanel.DIALOG_TITLE);
Dialog dialog = TopManager.getDefault().createDialog(descriptor);
Dialog dialog = TopManager.getDefault().createDialog(dd);
dialog.show();
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
try {
Document doc = configuror.getConfiguration();
FileOutputStream fos = new FileOutputStream(parcelDescriptor);
@@ -198,7 +235,7 @@ public class ParcelFolderSupport implements ParcelFolderCookie
return true;
}
private Vector getClasspath() {
private Vector getConfigureClasspath() {
Vector result = new Vector();
String classpath = NbClassPath.createRepositoryPath().getClassPath();

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelFolder.java,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: toconnor $ $Date: 2003-01-28 20:52:34 $
* last change: $Author: toconnor $ $Date: 2003-02-24 12:53:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,7 @@ import org.openide.util.HelpCtx;
import org.openoffice.idesupport.filter.*;
import org.openoffice.idesupport.zip.ParcelZipper;
import org.openoffice.netbeans.modules.office.actions.ParcelFolderCookie;
import org.openoffice.netbeans.modules.office.actions.ParcelFolderSupport;
public class ParcelFolder extends DataFolder {
@@ -103,10 +104,12 @@ public class ParcelFolder extends DataFolder {
private static final String LOCATION = "location";
private static final String FILTER = "filter";
private static final String LANGUAGE = LANGUAGE_ATTRIBUTE;
private static final String CLASSPATH = "classpath";
private File location;
private FileFilter filter;
private String language;
private String classpath;
private final FileFilter DEFAULT_FILTER = BinaryOnlyFilter.getInstance();
@@ -127,6 +130,14 @@ public class ParcelFolder extends DataFolder {
}
language = (String)pf.getPrimaryFile().getAttribute(LANGUAGE);
ParcelFolderCookie cookie =
(ParcelFolderCookie)pf.getCookie(ParcelFolderCookie.class);
String s = cookie.getClasspath();
if (s != null)
classpath = s;
else
classpath = ".";
}
public File getTargetDir() {
@@ -161,9 +172,15 @@ public class ParcelFolder extends DataFolder {
prop = createFilterProperty();
props.put(prop);
prop = createFilterProperty();
props.put(prop);
// prop = createLanguageProperty();
// props.put(prop);
prop = createClasspathProperty();
props.put(prop);
return sheet;
}
@@ -283,6 +300,27 @@ public class ParcelFolder extends DataFolder {
};
return prop;
}
private Node.Property createClasspathProperty() {
Node.Property prop =
new PropertySupport.ReadWrite(CLASSPATH, String.class,
"Classpath", "Classpath property for scripts in this parcel") {
public void setValue(Object obj) {
if (obj instanceof String) {
classpath = (String)obj;
ParcelFolderCookie cookie = (ParcelFolderCookie)
getDataObject().getCookie(ParcelFolderCookie.class);
cookie.setClasspath(classpath);
}
}
public Object getValue() {
return classpath;
}
};
return prop;
}
}
private class ParcelFolderFilter implements DataFilter {