summaryrefslogtreecommitdiff
path: root/scripting/java
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2004-01-05 11:51:30 +0000
committerRüdiger Timm <rt@openoffice.org>2004-01-05 11:51:30 +0000
commit5626d9bca143ea5a8a5d2b5c7ff55ec6b381d00d (patch)
tree2976a4a708c13e9ac4dc83171bf644c17b2be0bd /scripting/java
parentef8f01fdd3dab55910fe9cbf318a43f4ca775f4d (diff)
INTEGRATION: CWS scriptingf2 (1.4.2); FILE MERGED
2003/12/09 19:21:13 npower 1.4.2.1: #22568# Java script providers now use embedd.storage API to access scripts. Issue number: Submitted by: Reviewed by:
Diffstat (limited to 'scripting/java')
-rw-r--r--scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java58
1 files changed, 15 insertions, 43 deletions
diff --git a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java
index b718385327b8..a7b81dd02eb7 100644
--- a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java
+++ b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelBrowseNode.java,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: toconnor $ $Date: 2003-10-29 15:01:09 $
+ * last change: $Author: rt $ $Date: 2004-01-05 12:51:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,10 +73,7 @@ import java.util.*;
public class ParcelBrowseNode extends PropertySet implements XBrowseNode {
- private ParcelDescriptor pd;
- private File dir;
private String name;
- private String location;
private Collection browsenodes;
private XComponentContext m_XCtx;
public boolean deletable = true;
@@ -90,26 +87,11 @@ public class ParcelBrowseNode extends PropertySet implements XBrowseNode {
(short)0, "editable");
}
- public ParcelBrowseNode(XComponentContext ctx, File dir) {
- this(dir.getName());
- this.dir = dir;
- this.m_XCtx = ctx;
- this.location = PathUtils.toScriptLocation( m_XCtx, dir.getAbsolutePath() );
- this.pd = ParcelDescriptor.getParcelDescriptor(dir);
- this.deletable = true;
- }
-
- public ParcelBrowseNode(XComponentContext ctx,InputStream is, String name) {
+ public ParcelBrowseNode(XComponentContext ctx, Collection scripts, String name ) {
this(name);
this.m_XCtx = ctx;
- this.location = "document";
-
- try {
- this.pd = new ParcelDescriptor(is);
- }
- catch (IOException ioe) {
- this.pd = null;
- }
+ this.deletable = true;
+ loadScripts( scripts );
}
public String getName() {
@@ -119,7 +101,7 @@ public class ParcelBrowseNode extends PropertySet implements XBrowseNode {
public XBrowseNode[] getChildNodes() {
if (browsenodes == null)
{
- loadScripts();
+ return new XBrowseNode[0];
}
return (XBrowseNode[])browsenodes.toArray(new XBrowseNode[0]);
}
@@ -127,7 +109,7 @@ public class ParcelBrowseNode extends PropertySet implements XBrowseNode {
public boolean hasChildNodes() {
if (browsenodes == null)
{
- loadScripts();
+ return false;
}
return browsenodes.size() > 0;
}
@@ -140,24 +122,14 @@ public class ParcelBrowseNode extends PropertySet implements XBrowseNode {
return getName();
}
- private void loadScripts() {
- browsenodes = new ArrayList();
-
- if (pd != null) {
- ScriptEntry[] entries = pd.getScriptEntries();
-
- if (entries != null) {
- for (int i = 0; i < entries.length; i++) {
- ScriptBrowseNode sbn;
- if (dir != null) {
- sbn = new ScriptBrowseNode(entries[i], location, dir);
- }
- else {
- sbn = new ScriptBrowseNode(entries[i], location);
- }
- browsenodes.add(sbn);
- }
- }
+ private void loadScripts(Collection scripts ) {
+ browsenodes = new ArrayList( scripts.size() );
+ Iterator iter = scripts.iterator();
+ while ( iter.hasNext() )
+ {
+ ScriptMetaData script = (ScriptMetaData)iter.next();
+ ScriptBrowseNode sbn = new ScriptBrowseNode(script);
+ browsenodes.add(sbn);
}
}
}